1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2024-12-17 19:18:36 +01:00

Change QFileInfo::created() to birthTime(), read lyrics from MP3 files

This commit is contained in:
Jonas Kvinge 2019-07-08 22:01:34 +02:00
parent d5ca0ca283
commit c752d28c6a

View File

@ -174,7 +174,7 @@ void TagReader::ReadFile(const QString &filename, pb::tagreader::SongMetadata *s
song->set_url(url.constData(), url.size()); song->set_url(url.constData(), url.size());
song->set_filesize(info.size()); song->set_filesize(info.size());
song->set_mtime(info.lastModified().toTime_t()); song->set_mtime(info.lastModified().toTime_t());
song->set_ctime(info.created().toTime_t()); song->set_ctime(info.birthTime().toTime_t());
std::unique_ptr<TagLib::FileRef> fileref(factory_->GetFileRef(filename)); std::unique_ptr<TagLib::FileRef> fileref(factory_->GetFileRef(filename));
if (fileref->isNull()) { if (fileref->isNull()) {
@ -273,6 +273,12 @@ void TagReader::ReadFile(const QString &filename, pb::tagreader::SongMetadata *s
song->set_originalyear(map["TORY"].front()->toString().substr(0, 4).toInt()); song->set_originalyear(map["TORY"].front()->toString().substr(0, 4).toInt());
} }
if (!map["USLT"].isEmpty()) {
Decode(map["USLT"].front()->toString(), nullptr, song->mutable_lyrics());
}
else if (!map["SYLT"].isEmpty()) {
Decode(map["SYLT"].front()->toString(), nullptr, song->mutable_lyrics());
}
if (!map["APIC"].isEmpty()) song->set_art_automatic(kEmbeddedCover); if (!map["APIC"].isEmpty()) song->set_art_automatic(kEmbeddedCover);