Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve Taglib/SoundSource logging #13541

Merged
merged 1 commit into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/sources/metadatasourcetaglib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ class AiffFile : public TagLib::RIFF::AIFF::File {
}
};

QString fileTypeToString(taglib::FileType fileType) {
return QVariant::fromValue(fileType).toString();
}

} // anonymous namespace

std::pair<MetadataSourceTagLib::ImportResult, QDateTime>
Expand Down Expand Up @@ -91,7 +95,7 @@ MetadataSourceTagLib::importTrackMetadataAndCoverImage(
kLogger.warning()
<< "Nothing to import"
<< "from file" << m_fileName
<< "of type" << m_fileType;
<< "of type" << fileTypeToString(m_fileType);
return afterImport(ImportResult::Unavailable);
}
if (kLogger.traceEnabled()) {
Expand All @@ -101,7 +105,7 @@ MetadataSourceTagLib::importTrackMetadataAndCoverImage(
: (pTrackMetadata ? "track metadata"
: "cover art"))
<< "from file" << m_fileName
<< "of type" << m_fileType;
<< "of type" << fileTypeToString(m_fileType);
}

// Rationale: If a file contains different types of tags only
Expand Down Expand Up @@ -285,14 +289,14 @@ MetadataSourceTagLib::importTrackMetadataAndCoverImage(
kLogger.warning()
<< "Cannot import track metadata"
<< "from file" << m_fileName
<< "with unknown or unsupported type" << m_fileType;
<< "of unknown or unsupported type" << fileTypeToString(m_fileType);
return afterImport(ImportResult::Failed);
}

kLogger.info()
<< "No track metadata or cover art found"
<< "in file" << m_fileName
<< "with type" << m_fileType;
<< "of type" << fileTypeToString(m_fileType);
return afterImport(ImportResult::Unavailable);
}

Expand Down Expand Up @@ -672,8 +676,8 @@ MetadataSourceTagLib::exportTrackMetadata(
kLogger.debug()
<< "Cannot export track metadata"
<< "into file" << m_fileName
<< "with unknown or unsupported type"
<< m_fileType;
<< "of unknown or unsupported type"
<< fileTypeToString(m_fileType);
return afterExport(ExportResult::Unsupported);
}

Expand Down
24 changes: 12 additions & 12 deletions src/sources/soundsourceproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ void SoundSourceProxy::findProviderAndInitSoundSource() {
if (!getUrl().isEmpty()) {
kLogger.warning()
<< "No SoundSourceProvider for file"
<< getUrl().toString();
<< getUrl().toString(QUrl::PreferLocalFile);
}
}

Expand All @@ -517,15 +517,15 @@ bool SoundSourceProxy::initSoundSourceWithProvider(
kLogger.warning() << "SoundSourceProvider"
<< pProvider->getDisplayName()
<< "failed to create a SoundSource for file"
<< getUrl().toString();
<< getUrl().toString(QUrl::PreferLocalFile);
return false;
}
m_pProvider = pProvider;
if (kLogger.debugEnabled()) {
kLogger.debug() << "SoundSourceProvider"
<< m_pProvider->getDisplayName()
<< "created a SoundSource for file"
<< getUrl().toString()
<< getUrl().toString(QUrl::PreferLocalFile)
<< "of type"
<< m_pSoundSource->getType();
}
Expand Down Expand Up @@ -628,7 +628,7 @@ SoundSourceProxy::UpdateTrackFromSourceResult SoundSourceProxy::updateTrackFromS
if (!m_pSoundSource) {
kLogger.warning()
<< "Unable to update track from unsupported file type"
<< getUrl().toString();
<< getUrl().toString(QUrl::PreferLocalFile);
return UpdateTrackFromSourceResult::NotUpdated;
}

Expand All @@ -644,7 +644,7 @@ SoundSourceProxy::UpdateTrackFromSourceResult SoundSourceProxy::updateTrackFromS
<< "to"
<< newType
<< "for file"
<< getUrl().toString();
<< getUrl().toString(QUrl::PreferLocalFile);
}

// Use the existing track metadata as default values. Otherwise
Expand Down Expand Up @@ -680,7 +680,7 @@ SoundSourceProxy::UpdateTrackFromSourceResult SoundSourceProxy::updateTrackFromS
if (kLogger.debugEnabled()) {
kLogger.debug()
<< "Skip importing of embedded cover art from file"
<< getUrl().toString();
<< getUrl().toString(QUrl::PreferLocalFile);
}
} else {
// Request reimport of embedded cover art
Expand All @@ -706,7 +706,7 @@ SoundSourceProxy::UpdateTrackFromSourceResult SoundSourceProxy::updateTrackFromS
<< "Failed to import track metadata"
<< (pCoverImg ? "and embedded cover art" : "")
<< "from file"
<< getUrl().toString();
<< getUrl().toString(QUrl::PreferLocalFile);
// make sure that the trackMetadata was not messed up due to the failure
mixxx::TrackRecord::SourceSyncStatus sourceSyncStatusNew;
trackMetadata = m_pTrack->getMetadata(&sourceSyncStatusNew);
Expand Down Expand Up @@ -750,15 +750,15 @@ SoundSourceProxy::UpdateTrackFromSourceResult SoundSourceProxy::updateTrackFromS
if (kLogger.debugEnabled()) {
kLogger.debug()
<< "Initializing track metadata and embedded cover art from file"
<< getUrl().toString();
<< getUrl().toString(QUrl::PreferLocalFile);
}
} else {
if (kLogger.debugEnabled()) {
kLogger.debug()
<< "Re-importing track metadata"
<< (pCoverImg ? "and embedded cover art" : "")
<< "from file"
<< getUrl().toString();
<< getUrl().toString(QUrl::PreferLocalFile);
}
}

Expand Down Expand Up @@ -870,14 +870,14 @@ bool SoundSourceProxy::openSoundSource(
}
kLogger.warning()
<< "Failed to read file"
<< getUrl().toString()
<< getUrl().toString(QUrl::PreferLocalFile)
<< "with provider"
<< m_pProvider->getDisplayName();
m_pSoundSource->close(); // cleanup
} else {
kLogger.warning()
<< "Failed to open file"
<< getUrl().toString()
<< getUrl().toString(QUrl::PreferLocalFile)
<< "with provider"
<< m_pProvider->getDisplayName()
<< "using mode"
Expand Down Expand Up @@ -915,7 +915,7 @@ bool SoundSourceProxy::openSoundSource(
// getting here. m_pSoundSource might already be invalid/null!
kLogger.warning()
<< "Giving up to open file"
<< getUrl().toString()
<< getUrl().toString(QUrl::PreferLocalFile)
<< "after"
<< attemptCount
<< "unsuccessful attempts";
Expand Down
1 change: 1 addition & 0 deletions src/track/taglib/trackmetadata_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include <tfile.h>

#include "moc_trackmetadata_file.cpp"
#include "track/taglib/trackmetadata_common.h"
#include "util/logger.h"

Expand Down
2 changes: 2 additions & 0 deletions src/track/taglib/trackmetadata_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace mixxx {
class TrackMetadata;

namespace taglib {
Q_NAMESPACE

enum class FileType {
Unknown,
Expand All @@ -27,6 +28,7 @@ enum class FileType {
WAV,
WV
};
Q_ENUM_NS(FileType);

QDebug operator<<(QDebug debug, FileType fileType);

Expand Down