summaryrefslogtreecommitdiff
path: root/src/db/DatabasePrint.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-07-25 11:18:45 +0200
committerMax Kellermann <max@musicpd.org>2018-07-25 11:18:45 +0200
commit0505cb8f7e2f96f2fc7c993d0673b54648d52582 (patch)
tree31e7394854a6b22dc68ce665c1ee44d01b07bdb2 /src/db/DatabasePrint.cxx
parent2cfccc1c34224cc96b6e595b875180e3a9730c43 (diff)
db/Print: move code to PrintSongUris()
Diffstat (limited to 'src/db/DatabasePrint.cxx')
-rw-r--r--src/db/DatabasePrint.cxx35
1 files changed, 21 insertions, 14 deletions
diff --git a/src/db/DatabasePrint.cxx b/src/db/DatabasePrint.cxx
index f166e4a17..89172299d 100644
--- a/src/db/DatabasePrint.cxx
+++ b/src/db/DatabasePrint.cxx
@@ -273,6 +273,20 @@ PrintSongURIVisitor(Response &r, const LightSong &song) noexcept
song_print_uri(r, song);
}
+void
+PrintSongUris(Response &r, Partition &partition,
+ const SongFilter *filter)
+{
+ const Database &db = partition.GetDatabaseOrThrow();
+
+ const DatabaseSelection selection("", true, filter);
+
+ using namespace std::placeholders;
+ const auto f = std::bind(PrintSongURIVisitor,
+ std::ref(r), _1);
+ db.Visit(selection, f);
+}
+
static void
PrintUniqueTag(Response &r, TagType tag_type,
const Tag &tag) noexcept
@@ -292,22 +306,15 @@ PrintUniqueTags(Response &r, Partition &partition,
unsigned type, TagMask group_mask,
const SongFilter *filter)
{
+ assert(type < TAG_NUM_OF_ITEM_TYPES);
+
const Database &db = partition.GetDatabaseOrThrow();
const DatabaseSelection selection("", true, filter);
- if (type == LOCATE_TAG_FILE_TYPE) {
- using namespace std::placeholders;
- const auto f = std::bind(PrintSongURIVisitor,
- std::ref(r), _1);
- db.Visit(selection, f);
- } else {
- assert(type < TAG_NUM_OF_ITEM_TYPES);
-
- using namespace std::placeholders;
- const auto f = std::bind(PrintUniqueTag, std::ref(r),
- (TagType)type, _1);
- db.VisitUniqueTags(selection, (TagType)type,
- group_mask, f);
- }
+ using namespace std::placeholders;
+ const auto f = std::bind(PrintUniqueTag, std::ref(r),
+ (TagType)type, _1);
+ db.VisitUniqueTags(selection, (TagType)type,
+ group_mask, f);
}