Merge branch 'v0.20.x'
This commit is contained in:
commit
66ab2de578
4
NEWS
4
NEWS
@ -50,6 +50,10 @@ ver 0.21 (not yet released)
|
|||||||
* use GTest instead of cppunit
|
* use GTest instead of cppunit
|
||||||
|
|
||||||
ver 0.20.22 (not yet released)
|
ver 0.20.22 (not yet released)
|
||||||
|
* protocol
|
||||||
|
- add tag fallbacks for AlbumArtistSort, ArtistSort
|
||||||
|
- "count group ..." can print an empty group
|
||||||
|
- fix broken command "list ... group"
|
||||||
* storage
|
* storage
|
||||||
- curl: URL-encode paths
|
- curl: URL-encode paths
|
||||||
* Android
|
* Android
|
||||||
|
@ -732,6 +732,10 @@ The music database
|
|||||||
count group artist
|
count group artist
|
||||||
count title Echoes group artist
|
count title Echoes group artist
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
.. _command_find:
|
.. _command_find:
|
||||||
|
|
||||||
:command:`find {FILTER} [sort {TYPE}] [window {START:END}]`
|
:command:`find {FILTER} [sort {TYPE}] [window {START:END}]`
|
||||||
|
@ -9,8 +9,8 @@ from build.ffmpeg import FfmpegProject
|
|||||||
from build.boost import BoostProject
|
from build.boost import BoostProject
|
||||||
|
|
||||||
libmpdclient = MesonProject(
|
libmpdclient = MesonProject(
|
||||||
'https://www.musicpd.org/download/libmpdclient/2/libmpdclient-2.14.tar.xz',
|
'https://www.musicpd.org/download/libmpdclient/2/libmpdclient-2.16.tar.xz',
|
||||||
'0a84e2791bfe3077cf22ee1784c805d5bb550803dffe56a39aa3690a38061372',
|
'fa6bdab67c0e0490302b38f00c27b4959735c3ec8aef7a88327adb1407654464',
|
||||||
'lib/libmpdclient.a',
|
'lib/libmpdclient.a',
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -38,8 +38,8 @@ libvorbis = AutotoolsProject(
|
|||||||
)
|
)
|
||||||
|
|
||||||
opus = AutotoolsProject(
|
opus = AutotoolsProject(
|
||||||
'https://archive.mozilla.org/pub/opus/opus-1.2.1.tar.gz',
|
'https://archive.mozilla.org/pub/opus/opus-1.3.tar.gz',
|
||||||
'cfafd339ccd9c5ef8d6ab15d7e1a412c054bf4cb4ecbbbcc78c12ef2def70732',
|
'4f3d69aefdf2dbaf9825408e452a8a414ffc60494c70633560700398820dc550',
|
||||||
'lib/libopus.a',
|
'lib/libopus.a',
|
||||||
[
|
[
|
||||||
'--disable-shared', '--enable-static',
|
'--disable-shared', '--enable-static',
|
||||||
@ -341,8 +341,8 @@ ffmpeg = FfmpegProject(
|
|||||||
)
|
)
|
||||||
|
|
||||||
curl = AutotoolsProject(
|
curl = AutotoolsProject(
|
||||||
'http://curl.haxx.se/download/curl-7.61.0.tar.xz',
|
'http://curl.haxx.se/download/curl-7.61.1.tar.xz',
|
||||||
'ef6e55192d04713673b4409ccbcb4cb6cd723137d6e10ca45b0c593a454e1720',
|
'3d5913d6a39bd22e68e34dff697fd6e4c3c81563f580c76fca2009315cd81891',
|
||||||
'lib/libcurl.a',
|
'lib/libcurl.a',
|
||||||
[
|
[
|
||||||
'--disable-shared', '--enable-static',
|
'--disable-shared', '--enable-static',
|
||||||
|
@ -267,7 +267,7 @@ handle_list(Client &client, Request args, Response &r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<SongFilter> filter;
|
std::unique_ptr<SongFilter> filter;
|
||||||
TagMask group_mask = TagMask::None();
|
TagType group = TAG_NUM_OF_ITEM_TYPES;
|
||||||
|
|
||||||
if (args.size == 1) {
|
if (args.size == 1) {
|
||||||
/* for compatibility with < 0.12.0 */
|
/* for compatibility with < 0.12.0 */
|
||||||
@ -282,18 +282,16 @@ handle_list(Client &client, Request args, Response &r)
|
|||||||
args.shift()));
|
args.shift()));
|
||||||
}
|
}
|
||||||
|
|
||||||
while (args.size >= 2 &&
|
if (args.size >= 2 &&
|
||||||
StringIsEqual(args[args.size - 2], "group")) {
|
StringIsEqual(args[args.size - 2], "group")) {
|
||||||
const char *s = args[args.size - 1];
|
const char *s = args[args.size - 1];
|
||||||
TagType gt = tag_name_parse_i(s);
|
group = tag_name_parse_i(s);
|
||||||
if (gt == TAG_NUM_OF_ITEM_TYPES) {
|
if (group == TAG_NUM_OF_ITEM_TYPES) {
|
||||||
r.FormatError(ACK_ERROR_ARG,
|
r.FormatError(ACK_ERROR_ARG,
|
||||||
"Unknown tag type: %s", s);
|
"Unknown tag type: %s", s);
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
group_mask |= gt;
|
|
||||||
|
|
||||||
args.pop_back();
|
args.pop_back();
|
||||||
args.pop_back();
|
args.pop_back();
|
||||||
}
|
}
|
||||||
@ -310,13 +308,13 @@ handle_list(Client &client, Request args, Response &r)
|
|||||||
filter->Optimize();
|
filter->Optimize();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (group_mask.Test(tagType)) {
|
if (tagType < TAG_NUM_OF_ITEM_TYPES && tagType == group) {
|
||||||
r.Error(ACK_ERROR_ARG, "Conflicting group");
|
r.Error(ACK_ERROR_ARG, "Conflicting group");
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintUniqueTags(r, client.GetPartition(),
|
PrintUniqueTags(r, client.GetPartition(),
|
||||||
tagType, group_mask, filter.get());
|
tagType, group, filter.get());
|
||||||
return CommandResult::OK;
|
return CommandResult::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "client/Response.hxx"
|
#include "client/Response.hxx"
|
||||||
#include "song/LightSong.hxx"
|
#include "song/LightSong.hxx"
|
||||||
#include "tag/Tag.hxx"
|
#include "tag/Tag.hxx"
|
||||||
|
#include "tag/VisitFallback.hxx"
|
||||||
#include "TagPrint.hxx"
|
#include "TagPrint.hxx"
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
@ -73,24 +74,15 @@ stats_visitor_song(SearchStats &stats, const LightSong &song) noexcept
|
|||||||
stats.total_duration += duration;
|
stats.total_duration += duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static void
|
||||||
CollectGroupCounts(TagCountMap &map, TagType group, const Tag &tag) noexcept
|
CollectGroupCounts(TagCountMap &map, const Tag &tag,
|
||||||
|
const char *value) noexcept
|
||||||
{
|
{
|
||||||
bool found = false;
|
auto r = map.insert(std::make_pair(value, SearchStats()));
|
||||||
for (const auto &item : tag) {
|
|
||||||
if (item.type == group) {
|
|
||||||
auto r = map.insert(std::make_pair(item.value,
|
|
||||||
SearchStats()));
|
|
||||||
SearchStats &s = r.first->second;
|
SearchStats &s = r.first->second;
|
||||||
++s.n_songs;
|
++s.n_songs;
|
||||||
if (!tag.duration.IsNegative())
|
if (!tag.duration.IsNegative())
|
||||||
s.total_duration += tag.duration;
|
s.total_duration += tag.duration;
|
||||||
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return found;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -98,9 +90,10 @@ GroupCountVisitor(TagCountMap &map, TagType group,
|
|||||||
const LightSong &song) noexcept
|
const LightSong &song) noexcept
|
||||||
{
|
{
|
||||||
const Tag &tag = song.tag;
|
const Tag &tag = song.tag;
|
||||||
if (!CollectGroupCounts(map, group, tag) && group == TAG_ALBUM_ARTIST)
|
VisitTagWithFallbackOrEmpty(tag, group,
|
||||||
/* fall back to "Artist" if no "AlbumArtist" was found */
|
std::bind(CollectGroupCounts, std::ref(map),
|
||||||
CollectGroupCounts(map, TAG_ARTIST, tag);
|
std::cref(tag),
|
||||||
|
std::placeholders::_1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -187,22 +187,34 @@ PrintSongUris(Response &r, Partition &partition,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
PrintUniqueTag(Response &r, TagType tag_type,
|
PrintUniqueTags(Response &r, TagType tag_type,
|
||||||
const Tag &tag) noexcept
|
const std::set<std::string> &values)
|
||||||
{
|
{
|
||||||
const char *value = tag.GetValue(tag_type);
|
const char *const name = tag_item_names[tag_type];
|
||||||
assert(value != nullptr);
|
for (const auto &i : values)
|
||||||
tag_print(r, tag_type, value);
|
r.Format("%s: %s\n", name, i.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
const auto tag_mask = r.GetTagMask();
|
static void
|
||||||
for (const auto &item : tag)
|
PrintGroupedUniqueTags(Response &r, TagType tag_type, TagType group,
|
||||||
if (item.type != tag_type && tag_mask.Test(item.type))
|
const std::map<std::string, std::set<std::string>> &groups)
|
||||||
tag_print(r, item.type, item.value);
|
{
|
||||||
|
if (group == TAG_NUM_OF_ITEM_TYPES) {
|
||||||
|
for (const auto &i : groups)
|
||||||
|
PrintUniqueTags(r, tag_type, i.second);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *const group_name = tag_item_names[group];
|
||||||
|
for (const auto &i : groups) {
|
||||||
|
r.Format("%s: %s\n", group_name, i.first.c_str());
|
||||||
|
PrintUniqueTags(r, tag_type, i.second);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PrintUniqueTags(Response &r, Partition &partition,
|
PrintUniqueTags(Response &r, Partition &partition,
|
||||||
TagType type, TagMask group_mask,
|
TagType type, TagType group,
|
||||||
const SongFilter *filter)
|
const SongFilter *filter)
|
||||||
{
|
{
|
||||||
assert(type < TAG_NUM_OF_ITEM_TYPES);
|
assert(type < TAG_NUM_OF_ITEM_TYPES);
|
||||||
@ -211,7 +223,6 @@ PrintUniqueTags(Response &r, Partition &partition,
|
|||||||
|
|
||||||
const DatabaseSelection selection("", true, filter);
|
const DatabaseSelection selection("", true, filter);
|
||||||
|
|
||||||
using namespace std::placeholders;
|
PrintGroupedUniqueTags(r, type, group,
|
||||||
const auto f = std::bind(PrintUniqueTag, std::ref(r), type, _1);
|
db.CollectUniqueTags(selection, type, group));
|
||||||
db.VisitUniqueTags(selection, type, group_mask, f);
|
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ PrintSongUris(Response &r, Partition &partition,
|
|||||||
|
|
||||||
void
|
void
|
||||||
PrintUniqueTags(Response &r, Partition &partition,
|
PrintUniqueTags(Response &r, Partition &partition,
|
||||||
TagType type, TagMask group_mask,
|
TagType type, TagType group,
|
||||||
const SongFilter *filter);
|
const SongFilter *filter);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -25,6 +25,9 @@
|
|||||||
#include "util/Compiler.h"
|
#include "util/Compiler.h"
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <map>
|
||||||
|
#include <set>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
struct DatabasePlugin;
|
struct DatabasePlugin;
|
||||||
struct DatabaseStats;
|
struct DatabaseStats;
|
||||||
@ -105,14 +108,9 @@ public:
|
|||||||
return Visit(selection, VisitDirectory(), visit_song);
|
return Visit(selection, VisitDirectory(), visit_song);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
virtual std::map<std::string, std::set<std::string>> CollectUniqueTags(const DatabaseSelection &selection,
|
||||||
* Visit all unique tag values.
|
TagType tag_type,
|
||||||
*
|
TagType group=TAG_NUM_OF_ITEM_TYPES) const = 0;
|
||||||
* Throws on error.
|
|
||||||
*/
|
|
||||||
virtual void VisitUniqueTags(const DatabaseSelection &selection,
|
|
||||||
TagType tag_type, TagMask group_mask,
|
|
||||||
VisitTag visit_tag) const = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Throws on error.
|
* Throws on error.
|
||||||
|
@ -20,34 +20,42 @@
|
|||||||
#include "UniqueTags.hxx"
|
#include "UniqueTags.hxx"
|
||||||
#include "Interface.hxx"
|
#include "Interface.hxx"
|
||||||
#include "song/LightSong.hxx"
|
#include "song/LightSong.hxx"
|
||||||
#include "tag/Set.hxx"
|
#include "tag/VisitFallback.hxx"
|
||||||
#include "tag/Mask.hxx"
|
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
static void
|
static void
|
||||||
CollectTags(TagSet &set, TagType tag_type, TagMask group_mask,
|
CollectTags(std::set<std::string> &result,
|
||||||
const LightSong &song)
|
const Tag &tag,
|
||||||
|
TagType tag_type) noexcept
|
||||||
{
|
{
|
||||||
const Tag &tag = song.tag;
|
VisitTagWithFallbackOrEmpty(tag, tag_type, [&result](const char *value){
|
||||||
|
result.emplace(value);
|
||||||
set.InsertUnique(tag, tag_type, group_mask);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
VisitUniqueTags(const Database &db, const DatabaseSelection &selection,
|
CollectGroupTags(std::map<std::string, std::set<std::string>> &result,
|
||||||
TagType tag_type, TagMask group_mask,
|
const Tag &tag,
|
||||||
VisitTag visit_tag)
|
TagType tag_type,
|
||||||
|
TagType group) noexcept
|
||||||
{
|
{
|
||||||
TagSet set;
|
VisitTagWithFallbackOrEmpty(tag, group, [&](const char *group_name){
|
||||||
|
CollectTags(result[group_name], tag, tag_type);
|
||||||
using namespace std::placeholders;
|
});
|
||||||
const auto f = std::bind(CollectTags, std::ref(set),
|
}
|
||||||
tag_type, group_mask, _1);
|
|
||||||
db.Visit(selection, f);
|
std::map<std::string, std::set<std::string>>
|
||||||
|
CollectUniqueTags(const Database &db, const DatabaseSelection &selection,
|
||||||
for (const auto &value : set)
|
TagType tag_type, TagType group)
|
||||||
visit_tag(value);
|
{
|
||||||
|
std::map<std::string, std::set<std::string>> result;
|
||||||
|
|
||||||
|
db.Visit(selection, [&result, tag_type, group](const LightSong &song){
|
||||||
|
CollectGroupTags(result, song.tag, tag_type, group);
|
||||||
|
});
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -20,16 +20,20 @@
|
|||||||
#ifndef MPD_DB_UNIQUE_TAGS_HXX
|
#ifndef MPD_DB_UNIQUE_TAGS_HXX
|
||||||
#define MPD_DB_UNIQUE_TAGS_HXX
|
#define MPD_DB_UNIQUE_TAGS_HXX
|
||||||
|
|
||||||
#include "Visitor.hxx"
|
|
||||||
#include "tag/Type.h"
|
#include "tag/Type.h"
|
||||||
|
#include "util/Compiler.h"
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
#include <set>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
class TagMask;
|
class TagMask;
|
||||||
class Database;
|
class Database;
|
||||||
struct DatabaseSelection;
|
struct DatabaseSelection;
|
||||||
|
|
||||||
void
|
gcc_pure
|
||||||
VisitUniqueTags(const Database &db, const DatabaseSelection &selection,
|
std::map<std::string, std::set<std::string>>
|
||||||
TagType tag_type, TagMask group_mask,
|
CollectUniqueTags(const Database &db, const DatabaseSelection &selection,
|
||||||
VisitTag visit_tag);
|
TagType tag_type, TagType group);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -128,9 +128,9 @@ public:
|
|||||||
VisitSong visit_song,
|
VisitSong visit_song,
|
||||||
VisitPlaylist visit_playlist) const override;
|
VisitPlaylist visit_playlist) const override;
|
||||||
|
|
||||||
void VisitUniqueTags(const DatabaseSelection &selection,
|
std::map<std::string, std::set<std::string>> CollectUniqueTags(const DatabaseSelection &selection,
|
||||||
TagType tag_type, TagMask group_mask,
|
TagType tag_type,
|
||||||
VisitTag visit_tag) const override;
|
TagType group) const override;
|
||||||
|
|
||||||
DatabaseStats GetStats(const DatabaseSelection &selection) const override;
|
DatabaseStats GetStats(const DatabaseSelection &selection) const override;
|
||||||
|
|
||||||
@ -411,31 +411,21 @@ SendConstraints(mpd_connection *connection, const DatabaseSelection &selection)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
SendGroupMask(mpd_connection *connection, TagMask mask)
|
SendGroup(mpd_connection *connection, TagType group)
|
||||||
{
|
{
|
||||||
#if LIBMPDCLIENT_CHECK_VERSION(2,12,0)
|
if (group == TAG_NUM_OF_ITEM_TYPES)
|
||||||
for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; ++i) {
|
return true;
|
||||||
const auto tag_type = TagType(i);
|
|
||||||
if (!mask.Test(tag_type))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
const auto tag = Convert(tag_type);
|
#if LIBMPDCLIENT_CHECK_VERSION(2,12,0)
|
||||||
|
const auto tag = Convert(group);
|
||||||
if (tag == MPD_TAG_COUNT)
|
if (tag == MPD_TAG_COUNT)
|
||||||
throw std::runtime_error("Unsupported tag");
|
throw std::runtime_error("Unsupported tag");
|
||||||
|
|
||||||
if (!mpd_search_add_group_tag(connection, tag))
|
return mpd_search_add_group_tag(connection, tag);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
#else
|
#else
|
||||||
(void)connection;
|
(void)connection;
|
||||||
(void)mask;
|
|
||||||
|
|
||||||
if (mask.TestAny())
|
|
||||||
throw std::runtime_error("Grouping requires libmpdclient 2.12");
|
throw std::runtime_error("Grouping requires libmpdclient 2.12");
|
||||||
|
|
||||||
return true;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -992,11 +982,9 @@ ProxyDatabase::Visit(const DatabaseSelection &selection,
|
|||||||
helper.Commit();
|
helper.Commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
std::map<std::string, std::set<std::string>>
|
||||||
ProxyDatabase::VisitUniqueTags(const DatabaseSelection &selection,
|
ProxyDatabase::CollectUniqueTags(const DatabaseSelection &selection,
|
||||||
TagType tag_type,
|
TagType tag_type, TagType group) const
|
||||||
TagMask group_mask,
|
|
||||||
VisitTag visit_tag) const
|
|
||||||
try {
|
try {
|
||||||
// TODO: eliminate the const_cast
|
// TODO: eliminate the const_cast
|
||||||
const_cast<ProxyDatabase *>(this)->EnsureConnected();
|
const_cast<ProxyDatabase *>(this)->EnsureConnected();
|
||||||
@ -1007,13 +995,16 @@ try {
|
|||||||
|
|
||||||
if (!mpd_search_db_tags(connection, tag_type2) ||
|
if (!mpd_search_db_tags(connection, tag_type2) ||
|
||||||
!SendConstraints(connection, selection) ||
|
!SendConstraints(connection, selection) ||
|
||||||
!SendGroupMask(connection, group_mask))
|
!SendGroup(connection, group))
|
||||||
ThrowError(connection);
|
ThrowError(connection);
|
||||||
|
|
||||||
if (!mpd_search_commit(connection))
|
if (!mpd_search_commit(connection))
|
||||||
ThrowError(connection);
|
ThrowError(connection);
|
||||||
|
|
||||||
TagBuilder builder;
|
std::map<std::string, std::set<std::string>> result;
|
||||||
|
|
||||||
|
if (group == TAG_NUM_OF_ITEM_TYPES) {
|
||||||
|
auto &values = result[std::string()];
|
||||||
|
|
||||||
while (auto *pair = mpd_recv_pair(connection)) {
|
while (auto *pair = mpd_recv_pair(connection)) {
|
||||||
AtScopeExit(this, pair) {
|
AtScopeExit(this, pair) {
|
||||||
@ -1024,37 +1015,36 @@ try {
|
|||||||
if (current_type == TAG_NUM_OF_ITEM_TYPES)
|
if (current_type == TAG_NUM_OF_ITEM_TYPES)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (current_type == tag_type && !builder.empty()) {
|
if (current_type == tag_type)
|
||||||
try {
|
values.emplace(pair->value);
|
||||||
visit_tag(builder.Commit());
|
|
||||||
} catch (...) {
|
|
||||||
mpd_response_finish(connection);
|
|
||||||
throw;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
std::set<std::string> *current_group = nullptr;
|
||||||
|
|
||||||
|
while (auto *pair = mpd_recv_pair(connection)) {
|
||||||
|
AtScopeExit(this, pair) {
|
||||||
|
mpd_return_pair(connection, pair);
|
||||||
|
};
|
||||||
|
|
||||||
|
const auto current_type = tag_name_parse_i(pair->name);
|
||||||
|
if (current_type == TAG_NUM_OF_ITEM_TYPES)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (current_type == tag_type) {
|
||||||
|
if (current_group == nullptr)
|
||||||
|
current_group = &result[std::string()];
|
||||||
|
|
||||||
|
current_group->emplace(pair->value);
|
||||||
|
} else if (current_type == group) {
|
||||||
|
current_group = &result[pair->value];
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.AddItem(current_type, pair->value);
|
|
||||||
|
|
||||||
if (!builder.HasType(current_type))
|
|
||||||
/* if no tag item has been added, then the
|
|
||||||
given value was not acceptable
|
|
||||||
(e.g. empty); forcefully insert an empty
|
|
||||||
tag in this case, as the caller expects the
|
|
||||||
given tag type to be present */
|
|
||||||
builder.AddEmptyItem(current_type);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!builder.empty()) {
|
|
||||||
try {
|
|
||||||
visit_tag(builder.Commit());
|
|
||||||
} catch (...) {
|
|
||||||
mpd_response_finish(connection);
|
|
||||||
throw;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mpd_response_finish(connection))
|
if (!mpd_response_finish(connection))
|
||||||
ThrowError(connection);
|
ThrowError(connection);
|
||||||
|
|
||||||
|
return result;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
if (connection != nullptr)
|
if (connection != nullptr)
|
||||||
mpd_search_cancel(connection);
|
mpd_search_cancel(connection);
|
||||||
|
@ -329,12 +329,11 @@ SimpleDatabase::Visit(const DatabaseSelection &selection,
|
|||||||
"No such directory");
|
"No such directory");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
std::map<std::string, std::set<std::string>>
|
||||||
SimpleDatabase::VisitUniqueTags(const DatabaseSelection &selection,
|
SimpleDatabase::CollectUniqueTags(const DatabaseSelection &selection,
|
||||||
TagType tag_type, TagMask group_mask,
|
TagType tag_type, TagType group) const
|
||||||
VisitTag visit_tag) const
|
|
||||||
{
|
{
|
||||||
::VisitUniqueTags(*this, selection, tag_type, group_mask, visit_tag);
|
return ::CollectUniqueTags(*this, selection, tag_type, group);
|
||||||
}
|
}
|
||||||
|
|
||||||
DatabaseStats
|
DatabaseStats
|
||||||
|
@ -122,9 +122,9 @@ public:
|
|||||||
VisitSong visit_song,
|
VisitSong visit_song,
|
||||||
VisitPlaylist visit_playlist) const override;
|
VisitPlaylist visit_playlist) const override;
|
||||||
|
|
||||||
void VisitUniqueTags(const DatabaseSelection &selection,
|
std::map<std::string, std::set<std::string>> CollectUniqueTags(const DatabaseSelection &selection,
|
||||||
TagType tag_type, TagMask group_mask,
|
TagType tag_type,
|
||||||
VisitTag visit_tag) const override;
|
TagType group) const override;
|
||||||
|
|
||||||
DatabaseStats GetStats(const DatabaseSelection &selection) const override;
|
DatabaseStats GetStats(const DatabaseSelection &selection) const override;
|
||||||
|
|
||||||
|
@ -97,9 +97,9 @@ public:
|
|||||||
VisitSong visit_song,
|
VisitSong visit_song,
|
||||||
VisitPlaylist visit_playlist) const override;
|
VisitPlaylist visit_playlist) const override;
|
||||||
|
|
||||||
void VisitUniqueTags(const DatabaseSelection &selection,
|
std::map<std::string, std::set<std::string>> CollectUniqueTags(const DatabaseSelection &selection,
|
||||||
TagType tag_type, TagMask group_mask,
|
TagType tag_type,
|
||||||
VisitTag visit_tag) const override;
|
TagType group) const override;
|
||||||
|
|
||||||
DatabaseStats GetStats(const DatabaseSelection &selection) const override;
|
DatabaseStats GetStats(const DatabaseSelection &selection) const override;
|
||||||
|
|
||||||
@ -624,17 +624,15 @@ UpnpDatabase::Visit(const DatabaseSelection &selection,
|
|||||||
helper.Commit();
|
helper.Commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
std::map<std::string, std::set<std::string>>
|
||||||
UpnpDatabase::VisitUniqueTags(const DatabaseSelection &selection,
|
UpnpDatabase::CollectUniqueTags(const DatabaseSelection &selection,
|
||||||
TagType tag, gcc_unused TagMask group_mask,
|
TagType tag, TagType group) const
|
||||||
VisitTag visit_tag) const
|
|
||||||
{
|
{
|
||||||
// TODO: use group_mask
|
(void)group; // TODO: use group
|
||||||
|
|
||||||
if (!visit_tag)
|
std::map<std::string, std::set<std::string>> result;
|
||||||
return;
|
auto &values = result[std::string()];
|
||||||
|
|
||||||
std::set<std::string> values;
|
|
||||||
for (auto& server : discovery->GetDirectories()) {
|
for (auto& server : discovery->GetDirectories()) {
|
||||||
const auto dirbuf = SearchSongs(server, rootid, selection);
|
const auto dirbuf = SearchSongs(server, rootid, selection);
|
||||||
|
|
||||||
@ -650,11 +648,7 @@ UpnpDatabase::VisitUniqueTags(const DatabaseSelection &selection,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& value : values) {
|
return result;
|
||||||
TagBuilder builder;
|
|
||||||
builder.AddItem(tag, value.c_str());
|
|
||||||
visit_tag(builder.Commit());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DatabaseStats
|
DatabaseStats
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "TagSongFilter.hxx"
|
#include "TagSongFilter.hxx"
|
||||||
#include "LightSong.hxx"
|
#include "LightSong.hxx"
|
||||||
#include "tag/Tag.hxx"
|
#include "tag/Tag.hxx"
|
||||||
|
#include "tag/Fallback.hxx"
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
TagSongFilter::ToExpression() const noexcept
|
TagSongFilter::ToExpression() const noexcept
|
||||||
@ -62,16 +63,25 @@ TagSongFilter::MatchNN(const Tag &tag) const noexcept
|
|||||||
if (filter.empty())
|
if (filter.empty())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (type == TAG_ALBUM_ARTIST && visited_types[TAG_ARTIST]) {
|
bool result = false;
|
||||||
/* if we're looking for "album artist", but
|
if (ApplyTagFallback(type,
|
||||||
only "artist" exists, use that */
|
[&](TagType tag2) {
|
||||||
for (const auto &item : tag)
|
if (!visited_types[tag2])
|
||||||
if (item.type == TAG_ARTIST &&
|
return false;
|
||||||
filter.Match(item.value))
|
|
||||||
return true;
|
for (const auto &item : tag) {
|
||||||
|
if (item.type == tag2 &&
|
||||||
|
filter.Match(item.value)) {
|
||||||
|
result = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}))
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,6 +186,19 @@ TagBuilder::Complement(const Tag &other) noexcept
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TagBuilder::AddItemUnchecked(TagType type, StringView value) noexcept
|
||||||
|
{
|
||||||
|
TagItem *i;
|
||||||
|
|
||||||
|
{
|
||||||
|
const std::lock_guard<Mutex> protect(tag_pool_lock);
|
||||||
|
i = tag_pool_get_item(type, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
items.push_back(i);
|
||||||
|
}
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
TagBuilder::AddItemInternal(TagType type, StringView value) noexcept
|
TagBuilder::AddItemInternal(TagType type, StringView value) noexcept
|
||||||
{
|
{
|
||||||
@ -195,15 +208,9 @@ TagBuilder::AddItemInternal(TagType type, StringView value) noexcept
|
|||||||
if (!f.IsNull())
|
if (!f.IsNull())
|
||||||
value = { f.data, f.size };
|
value = { f.data, f.size };
|
||||||
|
|
||||||
TagItem *i;
|
AddItemUnchecked(type, value);
|
||||||
{
|
|
||||||
const std::lock_guard<Mutex> protect(tag_pool_lock);
|
|
||||||
i = tag_pool_get_item(type, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
free(f.data);
|
free(f.data);
|
||||||
|
|
||||||
items.push_back(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -229,13 +236,7 @@ TagBuilder::AddItem(TagType type, const char *value) noexcept
|
|||||||
void
|
void
|
||||||
TagBuilder::AddEmptyItem(TagType type) noexcept
|
TagBuilder::AddEmptyItem(TagType type) noexcept
|
||||||
{
|
{
|
||||||
TagItem *i;
|
AddItemUnchecked(type, "");
|
||||||
{
|
|
||||||
const std::lock_guard<Mutex> protect(tag_pool_lock);
|
|
||||||
i = tag_pool_get_item(type, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
items.push_back(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -132,6 +132,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
void Complement(const Tag &other) noexcept;
|
void Complement(const Tag &other) noexcept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A variant of AddItem() which does not attempt to fix up the
|
||||||
|
* value and does not check whether the tag type is disabled.
|
||||||
|
*/
|
||||||
|
void AddItemUnchecked(TagType type, StringView value) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Appends a new tag item.
|
* Appends a new tag item.
|
||||||
*
|
*
|
||||||
|
53
src/tag/Fallback.hxx
Normal file
53
src/tag/Fallback.hxx
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2003-2018 The Music Player Daemon Project
|
||||||
|
* http://www.musicpd.org
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MPD_TAG_FALLBACK_HXX
|
||||||
|
#define MPD_TAG_FALLBACK_HXX
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
template<typename F>
|
||||||
|
bool
|
||||||
|
ApplyTagFallback(TagType type, F &&f) noexcept
|
||||||
|
{
|
||||||
|
if (type == TAG_ALBUM_ARTIST_SORT) {
|
||||||
|
/* fall back to "AlbumArtist", "ArtistSort" and
|
||||||
|
"Artist" if no "AlbumArtistSort" was found */
|
||||||
|
if (f(TAG_ALBUM_ARTIST))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return ApplyTagFallback(TAG_ARTIST_SORT, std::forward<F>(f));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == TAG_ALBUM_ARTIST || type == TAG_ARTIST_SORT)
|
||||||
|
/* fall back to "Artist" if no
|
||||||
|
"AlbumArtist"/"ArtistSort" was found */
|
||||||
|
return f(TAG_ARTIST);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename F>
|
||||||
|
bool
|
||||||
|
ApplyTagWithFallback(TagType type, F &&f) noexcept
|
||||||
|
{
|
||||||
|
return f(type) || ApplyTagFallback(type, std::forward<F>(f));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
114
src/tag/Set.cxx
114
src/tag/Set.cxx
@ -1,114 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2003-2017 The Music Player Daemon Project
|
|
||||||
* http://www.musicpd.org
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "Set.hxx"
|
|
||||||
#include "Builder.hxx"
|
|
||||||
#include "Mask.hxx"
|
|
||||||
#include "Settings.hxx"
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy all tag items of the specified type.
|
|
||||||
*/
|
|
||||||
static bool
|
|
||||||
CopyTagItem(TagBuilder &dest, TagType dest_type,
|
|
||||||
const Tag &src, TagType src_type)
|
|
||||||
{
|
|
||||||
bool found = false;
|
|
||||||
|
|
||||||
for (const auto &item : src) {
|
|
||||||
if (item.type == src_type) {
|
|
||||||
dest.AddItem(dest_type, item.value);
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return found;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy all tag items of the specified type. Fall back to "Artist" if
|
|
||||||
* there is no "AlbumArtist".
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
CopyTagItem(TagBuilder &dest, const Tag &src, TagType type)
|
|
||||||
{
|
|
||||||
if (!CopyTagItem(dest, type, src, type) &&
|
|
||||||
type == TAG_ALBUM_ARTIST)
|
|
||||||
CopyTagItem(dest, type, src, TAG_ARTIST);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy all tag items of the types in the mask.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
CopyTagMask(TagBuilder &dest, const Tag &src, TagMask mask)
|
|
||||||
{
|
|
||||||
for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; ++i)
|
|
||||||
if (mask.Test(TagType(i)))
|
|
||||||
CopyTagItem(dest, src, TagType(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
TagSet::InsertUnique(const Tag &src, TagType type, const char *value,
|
|
||||||
TagMask group_mask) noexcept
|
|
||||||
{
|
|
||||||
TagBuilder builder;
|
|
||||||
if (value == nullptr)
|
|
||||||
builder.AddEmptyItem(type);
|
|
||||||
else
|
|
||||||
builder.AddItem(type, value);
|
|
||||||
CopyTagMask(builder, src, group_mask);
|
|
||||||
emplace(builder.Commit());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
TagSet::CheckUnique(TagType dest_type,
|
|
||||||
const Tag &tag, TagType src_type,
|
|
||||||
TagMask group_mask) noexcept
|
|
||||||
{
|
|
||||||
bool found = false;
|
|
||||||
|
|
||||||
for (const auto &item : tag) {
|
|
||||||
if (item.type == src_type) {
|
|
||||||
InsertUnique(tag, dest_type, item.value, group_mask);
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return found;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
TagSet::InsertUnique(const Tag &tag,
|
|
||||||
TagType type, TagMask group_mask) noexcept
|
|
||||||
{
|
|
||||||
static_assert(sizeof(group_mask) * 8 >= TAG_NUM_OF_ITEM_TYPES,
|
|
||||||
"Mask is too small");
|
|
||||||
|
|
||||||
assert(!group_mask.Test(type));
|
|
||||||
|
|
||||||
if (!CheckUnique(type, tag, type, group_mask) &&
|
|
||||||
(type != TAG_ALBUM_ARTIST ||
|
|
||||||
!IsTagEnabled(TAG_ALBUM_ARTIST) ||
|
|
||||||
/* fall back to "Artist" if no "AlbumArtist" was found */
|
|
||||||
!CheckUnique(type, tag, TAG_ARTIST, group_mask)))
|
|
||||||
InsertUnique(tag, type, nullptr, group_mask);
|
|
||||||
}
|
|
@ -1,74 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2003-2017 The Music Player Daemon Project
|
|
||||||
* http://www.musicpd.org
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef MPD_TAG_SET_HXX
|
|
||||||
#define MPD_TAG_SET_HXX
|
|
||||||
|
|
||||||
#include "util/Compiler.h"
|
|
||||||
#include "Tag.hxx"
|
|
||||||
|
|
||||||
#include <set>
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
class TagMask;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper class for #TagSet which compares two #Tag objects.
|
|
||||||
*/
|
|
||||||
struct TagLess {
|
|
||||||
gcc_pure
|
|
||||||
bool operator()(const Tag &a, const Tag &b) const noexcept {
|
|
||||||
if (a.num_items != b.num_items)
|
|
||||||
return a.num_items < b.num_items;
|
|
||||||
|
|
||||||
const unsigned n = a.num_items;
|
|
||||||
for (unsigned i = 0; i < n; ++i) {
|
|
||||||
const TagItem &ai = *a.items[i];
|
|
||||||
const TagItem &bi = *b.items[i];
|
|
||||||
if (ai.type != bi.type)
|
|
||||||
return unsigned(ai.type) < unsigned(bi.type);
|
|
||||||
|
|
||||||
const int cmp = strcmp(ai.value, bi.value);
|
|
||||||
if (cmp != 0)
|
|
||||||
return cmp < 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A set of #Tag objects.
|
|
||||||
*/
|
|
||||||
class TagSet : public std::set<Tag, TagLess> {
|
|
||||||
public:
|
|
||||||
void InsertUnique(const Tag &tag,
|
|
||||||
TagType type, TagMask group_mask) noexcept;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void InsertUnique(const Tag &src, TagType type, const char *value,
|
|
||||||
TagMask group_mask) noexcept;
|
|
||||||
|
|
||||||
bool CheckUnique(TagType dest_type,
|
|
||||||
const Tag &tag, TagType src_type,
|
|
||||||
TagMask group_mask) noexcept;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
60
src/tag/VisitFallback.hxx
Normal file
60
src/tag/VisitFallback.hxx
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2003-2018 The Music Player Daemon Project
|
||||||
|
* http://www.musicpd.org
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MPD_TAG_VISIT_FALLBACK_HXX
|
||||||
|
#define MPD_TAG_VISIT_FALLBACK_HXX
|
||||||
|
|
||||||
|
#include "Fallback.hxx"
|
||||||
|
#include "Tag.hxx"
|
||||||
|
|
||||||
|
template<typename F>
|
||||||
|
bool
|
||||||
|
VisitTagType(const Tag &tag, TagType type, F &&f) noexcept
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
|
for (const auto &item : tag) {
|
||||||
|
if (item.type == type) {
|
||||||
|
found = true;
|
||||||
|
f(item.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename F>
|
||||||
|
bool
|
||||||
|
VisitTagWithFallback(const Tag &tag, TagType type, F &&f) noexcept
|
||||||
|
{
|
||||||
|
return ApplyTagWithFallback(type,
|
||||||
|
[&](TagType type2) {
|
||||||
|
return VisitTagType(tag, type2, f);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename F>
|
||||||
|
void
|
||||||
|
VisitTagWithFallbackOrEmpty(const Tag &tag, TagType type, F &&f) noexcept
|
||||||
|
{
|
||||||
|
if (!VisitTagWithFallback(tag, type, f))
|
||||||
|
f("");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -9,7 +9,6 @@ tag_sources = [
|
|||||||
'FixString.cxx',
|
'FixString.cxx',
|
||||||
'Pool.cxx',
|
'Pool.cxx',
|
||||||
'Table.cxx',
|
'Table.cxx',
|
||||||
'Set.cxx',
|
|
||||||
'Format.cxx',
|
'Format.cxx',
|
||||||
'VorbisComment.cxx',
|
'VorbisComment.cxx',
|
||||||
'ReplayGain.cxx',
|
'ReplayGain.cxx',
|
||||||
|
Loading…
Reference in New Issue
Block a user