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)
|
ver 0.20.22 (not yet released)
|
||||||
* protocol
|
* protocol
|
||||||
- add tag fallbacks for AlbumArtistSort, ArtistSort
|
- add tag fallbacks for AlbumArtistSort, ArtistSort
|
||||||
|
- "count group ..." can print an empty group
|
||||||
* storage
|
* storage
|
||||||
- curl: URL-encode paths
|
- curl: URL-encode paths
|
||||||
* Android
|
* Android
|
||||||
|
|
|
@ -1599,6 +1599,11 @@ OK
|
||||||
per-artist counts:
|
per-artist counts:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>count group artist</programlisting>
|
<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>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ GroupCountVisitor(TagCountMap &map, TagType group, const LightSong &song)
|
||||||
assert(song.tag != nullptr);
|
assert(song.tag != nullptr);
|
||||||
|
|
||||||
const Tag &tag = *song.tag;
|
const Tag &tag = *song.tag;
|
||||||
VisitTagWithFallback(tag, group,
|
VisitTagWithFallbackOrEmpty(tag, group,
|
||||||
std::bind(CollectGroupCounts, std::ref(map),
|
std::bind(CollectGroupCounts, std::ref(map),
|
||||||
std::cref(tag),
|
std::cref(tag),
|
||||||
std::placeholders::_1));
|
std::placeholders::_1));
|
||||||
|
|
|
@ -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
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue