mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2025-01-31 09:44:50 +01:00
Fix reading and saving MP4 lyrics tag
This commit is contained in:
parent
789ff9df5c
commit
f9d45f7657
@ -342,6 +342,9 @@ void TagReader::ReadFile(const QString &filename, pb::tagreader::SongMetadata *s
|
||||
if (mp4_tag->item("\251grp").isValid()) {
|
||||
Decode(mp4_tag->item("\251grp").toStringList().toString(" "), nullptr, song->mutable_grouping());
|
||||
}
|
||||
if (mp4_tag->item("\251lyr").isValid()) {
|
||||
Decode(mp4_tag->item("\251lyr").toStringList().toString(" "), nullptr, song->mutable_lyrics());
|
||||
}
|
||||
|
||||
if (mp4_tag->item(kMP4_OriginalYear_ID).isValid()) {
|
||||
song->set_originalyear(TStringToQString(mp4_tag->item(kMP4_OriginalYear_ID).toStringList().toString('\n')).left(4).toInt());
|
||||
@ -617,6 +620,7 @@ bool TagReader::SaveFile(const QString &filename, const pb::tagreader::SongMetad
|
||||
tag->setItem("disk", TagLib::MP4::Item(song.disc() <= 0 -1 ? 0 : song.disc(), 0));
|
||||
tag->setItem("\251wrt", TagLib::StringList(song.composer().c_str()));
|
||||
tag->setItem("\251grp", TagLib::StringList(song.grouping().c_str()));
|
||||
tag->setItem("\251lyr", TagLib::StringList(song.lyrics().c_str()));
|
||||
tag->setItem("aART", TagLib::StringList(song.albumartist().c_str()));
|
||||
tag->setItem("cpil", TagLib::StringList(song.compilation() ? "1" : "0"));
|
||||
}
|
||||
|
@ -1581,7 +1581,7 @@ TEST_F(TagReaderTest, TestM4AAudioFileTagging) {
|
||||
EXPECT_EQ("strawberry grouping", song.grouping());
|
||||
EXPECT_EQ("strawberry genre", song.genre());
|
||||
EXPECT_EQ("strawberry comment", song.comment());
|
||||
//EXPECT_EQ("strawberry lyrics", song.lyrics());
|
||||
EXPECT_EQ("strawberry lyrics", song.lyrics());
|
||||
EXPECT_EQ(12, song.track());
|
||||
EXPECT_EQ(1234, song.disc());
|
||||
EXPECT_EQ(2019, song.year());
|
||||
@ -1617,7 +1617,7 @@ TEST_F(TagReaderTest, TestM4AAudioFileTagging) {
|
||||
EXPECT_EQ("new grouping", song.grouping());
|
||||
EXPECT_EQ("new genre", song.genre());
|
||||
EXPECT_EQ("new comment", song.comment());
|
||||
//EXPECT_EQ("new lyrics", song.lyrics());
|
||||
EXPECT_EQ("new lyrics", song.lyrics());
|
||||
EXPECT_EQ(21, song.track());
|
||||
EXPECT_EQ(4321, song.disc());
|
||||
EXPECT_EQ(9102, song.year());
|
||||
@ -1652,7 +1652,7 @@ TEST_F(TagReaderTest, TestM4AAudioFileTagging) {
|
||||
EXPECT_EQ("strawberry grouping", song.grouping());
|
||||
EXPECT_EQ("strawberry genre", song.genre());
|
||||
EXPECT_EQ("strawberry comment", song.comment());
|
||||
//EXPECT_EQ("strawberry lyrics", song.lyrics());
|
||||
EXPECT_EQ("strawberry lyrics", song.lyrics());
|
||||
EXPECT_EQ(12, song.track());
|
||||
EXPECT_EQ(1234, song.disc());
|
||||
EXPECT_EQ(2019, song.year());
|
||||
|
Loading…
x
Reference in New Issue
Block a user