musikr: parse APE tags on mpeg files, log ReplayGain values in debug

This commit is contained in:
jay
2026-11-12 19:27:33 -05:00
parent 208e48a97b
commit 66947b80bc
3 changed files with 25 additions and 0 deletions
@@ -23,6 +23,7 @@ import dagger.hilt.android.qualifiers.ApplicationContext
import java.util.UUID
import javax.inject.Inject
import kotlinx.coroutines.CancellationException
import org.oxycblt.auxio.BuildConfig
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.withContext
@@ -411,6 +412,15 @@ constructor(
val start = System.currentTimeMillis()
val result = Musikr.new(context, config).run(::emitIndexingProgress)
L.d("Index finished in ${System.currentTimeMillis() - start}ms")
if (BuildConfig.DEBUG) {
// Surface parsed ReplayGain values for logcat verification.
for (song in result.library.songs) {
val rg = song.replayGainAdjustment
if (rg.track != null || rg.album != null) {
L.d("RG: ${song.name.raw} track=${rg.track} album=${rg.album}")
}
}
}
// Music loading completed, update the revision right now so we re-use this work
// later.
L.d("Revisioning from $currentRevision -> $newRevision")
+7
View File
@@ -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();
+8
View File
@@ -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;
}