fix encodings when creating TagLibs items

This commit is contained in:
Thomas Friedel 2023-04-04 17:03:25 +02:00
parent 3471134d52
commit 0c75206ee5
1 changed files with 29 additions and 17 deletions

View File

@ -837,21 +837,29 @@ bool TagReader::SaveFile(const QString& filename,
? QString() ? QString()
: QString::number(song.bpm())), : QString::number(song.bpm())),
true); true);
tag->setItem("composer", tag->setItem(
"composer",
TagLib::APE::Item( TagLib::APE::Item(
"composer", TagLib::StringList(song.composer().c_str()))); "composer",
tag->setItem("grouping", TagLib::StringList(StdStringToTaglibString(song.composer()))));
tag->setItem(
"grouping",
TagLib::APE::Item( TagLib::APE::Item(
"grouping", TagLib::StringList(song.grouping().c_str()))); "grouping",
tag->setItem("performer", TagLib::StringList(StdStringToTaglibString(song.grouping()))));
TagLib::APE::Item("performer", TagLib::StringList( tag->setItem(
song.performer().c_str()))); "performer",
TagLib::APE::Item(
"performer",
TagLib::StringList(StdStringToTaglibString(song.performer()))));
tag->setItem( tag->setItem(
"album artist", "album artist",
TagLib::APE::Item("album artist", TagLib::APE::Item(
TagLib::StringList(song.albumartist().c_str()))); "album artist",
tag->setItem("lyrics", TagLib::StringList(StdStringToTaglibString(song.albumartist()))));
TagLib::APE::Item("lyrics", TagLib::String(song.lyrics()))); tag->setItem(
"lyrics",
TagLib::APE::Item("lyrics", StdStringToTaglibString(song.lyrics())));
tag->addValue("compilation", tag->addValue("compilation",
QStringToTaglibString(song.compilation() ? QString::number(1) QStringToTaglibString(song.compilation() ? QString::number(1)
: QString()), : QString()),
@ -888,10 +896,14 @@ bool TagReader::SaveFile(const QString& filename,
TagLib::StringList(song.bpm() <= 0 - 1 TagLib::StringList(song.bpm() <= 0 - 1
? "0" ? "0"
: TagLib::String::number(song.bpm()))); : TagLib::String::number(song.bpm())));
tag->setItem("\251wrt", TagLib::StringList(song.composer().c_str())); tag->setItem("\251wrt",
tag->setItem("\251grp", TagLib::StringList(song.grouping().c_str())); TagLib::StringList(StdStringToTaglibString(song.composer())));
tag->setItem("\251lyr", TagLib::StringList(song.lyrics().c_str())); tag->setItem("\251grp",
tag->setItem("aART", TagLib::StringList(song.albumartist().c_str())); TagLib::StringList(StdStringToTaglibString(song.grouping())));
tag->setItem("\251lyr",
TagLib::StringList(StdStringToTaglibString(song.lyrics())));
tag->setItem("aART", TagLib::StringList(
StdStringToTaglibString(song.albumartist())));
tag->setItem("cpil", TagLib::StringList(song.compilation() ? "1" : "0")); tag->setItem("cpil", TagLib::StringList(song.compilation() ? "1" : "0"));
} else if (TagLib::APE::File* file = } else if (TagLib::APE::File* file =
dynamic_cast<TagLib::APE::File*>(fileref->file())) { dynamic_cast<TagLib::APE::File*>(fileref->file())) {