diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-09-18 13:07:42 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-09-19 16:32:11 +1000 |
| commit | 57af3e64c8d6b13ac03192d9a8429dc801558a6b (patch) | |
| tree | 210a18838536a6b916d49ecbc9971b69f954b0dc /src/tangara/database/index.cpp | |
| parent | 9c95c2b4222da1fb31855f3985ab96d90865086d (diff) | |
| download | tangara-fw-57af3e64c8d6b13ac03192d9a8429dc801558a6b.tar.gz | |
Introduce a MediaType for each track and index
Initially set based on filepath, or by genre if the filepath doesn't
match one of our presets
Diffstat (limited to 'src/tangara/database/index.cpp')
| -rw-r--r-- | src/tangara/database/index.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/tangara/database/index.cpp b/src/tangara/database/index.cpp index dec458f4..f1d8f258 100644 --- a/src/tangara/database/index.cpp +++ b/src/tangara/database/index.cpp @@ -30,28 +30,39 @@ namespace database { const IndexInfo kAlbumsByArtist{ .id = 1, + .type = MediaType::kMusic, .name = "Albums by Artist", .components = {Tag::kAlbumArtist, Tag::kAlbum, Tag::kAlbumOrder}, }; const IndexInfo kTracksByGenre{ .id = 2, + .type = MediaType::kMusic, .name = "Tracks by Genre", .components = {Tag::kGenres, Tag::kTitle}, }; const IndexInfo kAllTracks{ .id = 3, + .type = MediaType::kMusic, .name = "All Tracks", .components = {Tag::kTitle}, }; const IndexInfo kAllAlbums{ .id = 4, + .type = MediaType::kMusic, .name = "All Albums", .components = {Tag::kAlbum, Tag::kAlbumOrder}, }; +const IndexInfo kPodcasts{ + .id = 5, + .type = MediaType::kPodcast, + .name = "Podcasts", + .components = {Tag::kAlbum, Tag::kAlbumOrder}, +}; + static auto titleOrFilename(const TrackData& data, const TrackTags& tags) -> std::pmr::string { auto title = tags.title(); @@ -203,6 +214,9 @@ auto Index(locale::ICollator& collator, const TrackData& data, const TrackTags& tags) -> std::vector<std::pair<IndexKey, std::string>> { + if (index.type != data.type) { + return {}; + } Indexer indexer{collator, index, data, tags}; return indexer.index(); } |
