musikr: add temp logging

To debug metadata issues.
This commit is contained in:
Alexander Capehart 2025-01-06 11:41:01 -07:00
parent 298a30da6d
commit b328a6ea03
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
2 changed files with 11 additions and 1 deletions

View file

@ -38,6 +38,7 @@ Java_org_oxycblt_musikr_metadata_TagLibJNI_openNative(JNIEnv *env,
JVMInputStream stream {env, inputStream}; JVMInputStream stream {env, inputStream};
TagLib::FileRef fileRef {&stream}; TagLib::FileRef fileRef {&stream};
if (fileRef.isNull()) { if (fileRef.isNull()) {
LOGE("Error opening file");
return nullptr; return nullptr;
} }
TagLib::File *file = fileRef.file(); TagLib::File *file = fileRef.file();
@ -65,6 +66,7 @@ Java_org_oxycblt_musikr_metadata_TagLibJNI_openNative(JNIEnv *env,
builder.setId3v2(*wavFile->ID3v2Tag()); builder.setId3v2(*wavFile->ID3v2Tag());
} else { } else {
// While taglib supports other formats, ExoPlayer does not. Ignore them. // While taglib supports other formats, ExoPlayer does not. Ignore them.
LOGE("Unsupported file format");
return nullptr; return nullptr;
} }

View file

@ -19,6 +19,7 @@
package org.oxycblt.musikr.pipeline package org.oxycblt.musikr.pipeline
import android.content.Context import android.content.Context
import android.util.Log
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.Channel
@ -119,7 +120,14 @@ private class ExtractStepImpl(
metadataExtractor metadataExtractor
.extract(fileWith.with) .extract(fileWith.with)
?.let { FileWith(fileWith.file, it) } ?.let { FileWith(fileWith.file, it) }
.also { withContext(Dispatchers.IO) { fileWith.with.close() } } .also {
if (it == null) {
Log.d(
"ExtractStep",
"Failed to extract metadata for ${fileWith.file.path}")
}
withContext(Dispatchers.IO) { fileWith.with.close() }
}
} }
} }
.flowOn(Dispatchers.IO) .flowOn(Dispatchers.IO)