musikr: parse APE tags on mpeg files, log ReplayGain values in debug
This commit is contained in:
@@ -94,6 +94,13 @@ void JMetadataBuilder::setId3v2(TagLib::ID3v2::Tag &tag) {
|
||||
}
|
||||
}
|
||||
|
||||
void JMetadataBuilder::setApe(TagLib::APE::Tag &tag) {
|
||||
for (auto item : tag.itemListMap()) {
|
||||
auto key = item.first.upper();
|
||||
ape.add_custom(key, item.second.values());
|
||||
}
|
||||
}
|
||||
|
||||
void JMetadataBuilder::setXiph(TagLib::Ogg::XiphComment &tag) {
|
||||
for (auto field : tag.fieldListMap()) {
|
||||
auto key = field.first.upper();
|
||||
|
||||
@@ -51,6 +51,14 @@ bool parseMpeg(const std::string &name, TagLib::MPEG::File *mpegFile,
|
||||
LOGE("Unable to parse ID3v2 tag in %s: %s", name.c_str(), e.what());
|
||||
}
|
||||
}
|
||||
auto apeTag = mpegFile->APETag();
|
||||
if (apeTag != nullptr) {
|
||||
try {
|
||||
jBuilder.setApe(*apeTag);
|
||||
} catch (std::exception &e) {
|
||||
LOGE("Unable to parse APE tag in %s: %s", name.c_str(), e.what());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user