db/Count: print empty group if song without grouped tag exists
Be consistent with "list" responses.
This commit is contained in:
parent
6c06244e83
commit
7cfe929c36
1
NEWS
1
NEWS
|
@ -1,6 +1,7 @@
|
|||
ver 0.20.22 (not yet released)
|
||||
* protocol
|
||||
- add tag fallbacks for AlbumArtistSort, ArtistSort
|
||||
- "count group ..." can print an empty group
|
||||
* storage
|
||||
- curl: URL-encode paths
|
||||
* Android
|
||||
|
|
|
@ -1599,6 +1599,11 @@ OK
|
|||
per-artist counts:
|
||||
</para>
|
||||
<programlisting>count group artist</programlisting>
|
||||
<para>
|
||||
A group with an empty value contains counts of matching
|
||||
song which don't this group tag. It exists only if at
|
||||
least one such song is found.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
|
|
@ -90,10 +90,10 @@ GroupCountVisitor(TagCountMap &map, TagType group, const LightSong &song)
|
|||
assert(song.tag != nullptr);
|
||||
|
||||
const Tag &tag = *song.tag;
|
||||
VisitTagWithFallback(tag, group,
|
||||
std::bind(CollectGroupCounts, std::ref(map),
|
||||
std::cref(tag),
|
||||
std::placeholders::_1));
|
||||
VisitTagWithFallbackOrEmpty(tag, group,
|
||||
std::bind(CollectGroupCounts, std::ref(map),
|
||||
std::cref(tag),
|
||||
std::placeholders::_1));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -49,4 +49,12 @@ VisitTagWithFallback(const Tag &tag, TagType type, F &&f) noexcept
|
|||
});
|
||||
}
|
||||
|
||||
template<typename F>
|
||||
void
|
||||
VisitTagWithFallbackOrEmpty(const Tag &tag, TagType type, F &&f) noexcept
|
||||
{
|
||||
if (!VisitTagWithFallback(tag, type, f))
|
||||
f("");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue