Fix album artist for FLAC/OGG files (with vorbis comments)

This commit is contained in:
Chocobozzz 2015-01-16 18:30:11 +01:00
parent a61eac109c
commit c61d866caf
1 changed files with 12 additions and 11 deletions

View File

@ -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",
@ -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(
@ -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())));
}
@ -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")) {
@ -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" ||
@ -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;