Paste P177

Fix rating for D10972
ActivePublic

Authored by rkflx on Mar 14 2018, 12:04 PM.
diff --git a/lib/mpris2/mprismediaplayer2player.cpp b/lib/mpris2/mprismediaplayer2player.cpp
index bd2d668f..9d360e69 100644
--- a/lib/mpris2/mprismediaplayer2player.cpp
+++ b/lib/mpris2/mprismediaplayer2player.cpp
@@ -22,6 +22,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <config-gwenview.h>
// lib
+#include <semanticinfo/semanticinfodirmodel.h>
+#include <semanticinfo/sorteddirmodel.h>
#include <slideshow.h>
#include <mimetypeutils.h>
#include <contextmanager.h>
@@ -298,9 +300,9 @@ void MprisMediaPlayer2Player::onMetaInfoUpdated()
#ifndef GWENVIEW_SEMANTICINFO_BACKEND_NONE
const QModelIndex index = mContextManager->dirModel()->indexForUrl(url);
- if (!index.isValid()) {
- const float rating = index.data(SemanticInfoDirModel::RatingRole).toInt() / 10.0;
- updatedMetaData.insert(QStringLiteral("xesam:userRating", rating);
+ if (index.isValid()) {
+ const qreal rating = index.data(SemanticInfoDirModel::RatingRole).toInt() / 10.0;
+ updatedMetaData.insert(QStringLiteral("xesam:userRating"), rating);
}
#endif
// consider export of other metadata where mapping works
rkflx edited the content of this paste. (Show Details)Mar 14 2018, 12:04 PM
rkflx changed the title of this paste from untitled to Fix rating for D10972.
rkflx updated the paste's language from autodetect to autodetect.