From 6b64c4385186ce7e40a7a4e362a06522d1d0f962 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Tue, 26 Oct 2021 01:10:01 +0200 Subject: [PATCH] TagReaderTagLib: Read FMPS_Rating for MPEG ID3v2 tag --- ext/libstrawberry-tagreader/tagreadertaglib.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ext/libstrawberry-tagreader/tagreadertaglib.cpp b/ext/libstrawberry-tagreader/tagreadertaglib.cpp index ccf62fc42..be41082b6 100644 --- a/ext/libstrawberry-tagreader/tagreadertaglib.cpp +++ b/ext/libstrawberry-tagreader/tagreadertaglib.cpp @@ -318,6 +318,16 @@ void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMeta } } + if (TagLib::ID3v2::UserTextIdentificationFrame *frame_fmps_rating = TagLib::ID3v2::UserTextIdentificationFrame::find(file_mpeg->ID3v2Tag(), "FMPS_Rating")) { + TagLib::StringList frame_field_list = frame_fmps_rating->fieldList(); + if (frame_field_list.size() > 1) { + double rating = TStringToQString(frame_field_list[1]).toDouble(); + if (song->rating() <= 0 && rating > 0 && rating <= 1.0) { + song->set_rating(rating); + } + } + } + if (!map["POPM"].isEmpty()) { const TagLib::ID3v2::PopularimeterFrame *frame = dynamic_cast(map["POPM"].front()); if (frame) {