From 57af3e64c8d6b13ac03192d9a8429dc801558a6b Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 18 Sep 2024 13:07:42 +1000 Subject: 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 --- src/tangara/database/index.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/tangara/database/index.cpp') 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> { + if (index.type != data.type) { + return {}; + } Indexer indexer{collator, index, data, tags}; return indexer.index(); } -- cgit v1.2.3