Made the cluster types that are displayed configurable in the release and artist view

This commit is contained in:
emeric
2018-05-11 13:42:25 +02:00
parent 6a96af5d48
commit 070d466380
15 changed files with 194 additions and 58 deletions
+5 -4
View File
@@ -36,7 +36,7 @@ AvFormat::AvFormat(const ClusterTypes& clusterTypes)
}
boost::optional<Items>
AvFormat::parse(const boost::filesystem::path& p)
AvFormat::parse(const boost::filesystem::path& p, bool debug)
{
Items items;
@@ -73,9 +73,10 @@ AvFormat::parse(const boost::filesystem::path& p)
{
const std::string tag = boost::to_upper_copy<std::string>(metadata.first);
const std::string value = metadata.second;
#if 0
std::cout << "TAG = " << tag << ", VAL = " << value << std::endl;
#endif
if (debug)
std::cout << "TAG = " << tag << ", VAL = " << value << std::endl;
if (tag == "ARTIST")
items.insert( std::make_pair(MetaData::Type::Artist, stringTrim( value) ));
else if (tag == "ALBUM")
+1 -1
View File
@@ -34,7 +34,7 @@ class AvFormat : public Parser
AvFormat(const ClusterTypes& clusterTypes = defaultClusterTypes);
boost::optional<Items> parse(const boost::filesystem::path& p);
boost::optional<Items> parse(const boost::filesystem::path& p, bool debug = false);
};
} // namespace MetaData
+5 -2
View File
@@ -23,8 +23,11 @@ namespace MetaData {
const ClusterTypes Parser::defaultClusterTypes =
{
{"GENRE"},
{"ALBUMGROUPING"},
"GENRE",
"ALBUMGROUPING",
"MOOD",
"ALBUMMOOD",
"COMMENT:SONGS-DB_OCCASION",
};
} // namespace MetaData
+1 -1
View File
@@ -73,7 +73,7 @@ namespace MetaData
// Provide a map for tag name -> Cluster name
Parser(const ClusterTypes& clusterTypes) : _clusterTypes(clusterTypes) {}
virtual boost::optional<Items> parse(const boost::filesystem::path& p) = 0;
virtual boost::optional<Items> parse(const boost::filesystem::path& p, bool debug = false) = 0;
void updateClusterTypes(const ClusterTypes& clusterTypes) { _clusterTypes = clusterTypes; }
const ClusterTypes& getClusterTypes() const { return _clusterTypes; }
+6 -6
View File
@@ -38,7 +38,7 @@ TagLibParser::TagLibParser(const ClusterTypes& clusterTypes)
}
boost::optional<Items>
TagLibParser::parse(const boost::filesystem::path& p)
TagLibParser::parse(const boost::filesystem::path& p, bool debug)
{
TagLib::FileRef f(p.string().c_str(),
true, // read audio properties
@@ -89,13 +89,13 @@ TagLibParser::parse(const boost::filesystem::path& p)
// TODO validate MBID format
#if 0
std::cout << "TAG = '" << tag << "'" << std::endl;
for (auto value : values)
if (debug)
{
std::cout << "\t'" << value.to8Bit(true) << "'" << std::endl;
std::cout << "TAG = '" << tag << "', VALUES = ";
for (auto value : values)
std::cout << "'" << value.to8Bit(true) << "',";
std::cout << std::endl;
}
#endif
if (tag == "ARTIST")
items.insert( std::make_pair(MetaData::Type::Artist, stringTrim( values.front().to8Bit(true))));
+1 -1
View File
@@ -34,7 +34,7 @@ class TagLibParser : public Parser
TagLibParser(const ClusterTypes& clusterTypes = defaultClusterTypes);
boost::optional<Items> parse(const boost::filesystem::path& p);
boost::optional<Items> parse(const boost::filesystem::path& p, bool debug = false);
};
} // namespace MetaData