Skip to content

Commit

Permalink
Fix album artist for FLAC/OGG files (with vorbis comments)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocobozzz committed Jan 16, 2015
1 parent a61eac1 commit c61d866
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions ext/libclementine-tagreader/tagreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -502,10 +502,9 @@ void TagReader::ParseOggTag(const TagLib::Ogg::FieldListMap& map,
100);
}

void TagReader::SetVorbisComments(TagLib::Ogg::XiphComment* vorbis_comments,
const pb::tagreader::SongMetadata& song)
const {

void TagReader::SetVorbisComments(
TagLib::Ogg::XiphComment* vorbis_comments,
const pb::tagreader::SongMetadata& song) const {
vorbis_comments->addField("COMPOSER",
StdStringToTaglibString(song.composer()), true);
vorbis_comments->addField("PERFORMER",
Expand All @@ -524,6 +523,9 @@ void TagReader::SetVorbisComments(TagLib::Ogg::XiphComment* vorbis_comments,
vorbis_comments->addField(
"COMPILATION", StdStringToTaglibString(song.compilation() ? "1" : "0"),
true);

vorbis_comments->addField("ALBUM ARTIST",
StdStringToTaglibString(song.albumartist()), true);
}

void TagReader::SetFMPSStatisticsVorbisComments(
Expand All @@ -540,7 +542,6 @@ void TagReader::SetFMPSStatisticsVorbisComments(
void TagReader::SetFMPSRatingVorbisComments(
TagLib::Ogg::XiphComment* vorbis_comments,
const pb::tagreader::SongMetadata& song) const {

vorbis_comments->addField(
"FMPS_RATING", QStringToTaglibString(QString::number(song.rating())));
}
Expand Down Expand Up @@ -953,8 +954,8 @@ bool TagReader::ReadCloudFile(const QUrl& download_url, const QString& title,
pb::tagreader::SongMetadata* song) const {
qLog(Debug) << "Loading tags from" << title;

std::unique_ptr<CloudStream> stream(
new CloudStream(download_url, title, size, authorisation_header, network_));
std::unique_ptr<CloudStream> stream(new CloudStream(
download_url, title, size, authorisation_header, network_));
stream->Precache();
std::unique_ptr<TagLib::File> tag;
if (mime_type == "audio/mpeg" && title.endsWith(".mp3")) {
Expand All @@ -963,8 +964,8 @@ bool TagReader::ReadCloudFile(const QUrl& download_url, const QString& title,
TagLib::AudioProperties::Accurate));
} else if (mime_type == "audio/mp4" ||
(mime_type == "audio/mpeg" && title.endsWith(".m4a"))) {
tag.reset(
new TagLib::MP4::File(stream.get(), true, TagLib::AudioProperties::Accurate));
tag.reset(new TagLib::MP4::File(stream.get(), true,
TagLib::AudioProperties::Accurate));
}
#ifdef TAGLIB_HAS_OPUS
else if ((mime_type == "application/opus" || mime_type == "audio/opus" ||
Expand All @@ -983,8 +984,8 @@ bool TagReader::ReadCloudFile(const QUrl& download_url, const QString& title,
TagLib::ID3v2::FrameFactory::instance(),
true, TagLib::AudioProperties::Accurate));
} else if (mime_type == "audio/x-ms-wma") {
tag.reset(
new TagLib::ASF::File(stream.get(), true, TagLib::AudioProperties::Accurate));
tag.reset(new TagLib::ASF::File(stream.get(), true,
TagLib::AudioProperties::Accurate));
} else {
qLog(Debug) << "Unknown mime type for tagging:" << mime_type;
return false;
Expand Down

0 comments on commit c61d866

Please sign in to comment.