1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-16 11:19:18 +01:00

Fix the types of some MPRIS metadata fields.

(cherry picked from commit 1abd9c3821)
This commit is contained in:
John Maguire 2012-10-15 11:40:18 +02:00
parent 8ddc5064dc
commit 3c9c4ab538
2 changed files with 9 additions and 1 deletions

View File

@ -37,6 +37,14 @@ inline void AddMetadata(const QString& key, int metadata, QVariantMap* map) {
if (metadata > 0) (*map)[key] = metadata;
}
inline void AddMetadata(const QString& key, qint64 metadata, QVariantMap* map) {
if (metadata > 0) (*map)[key] = metadata;
}
inline void AddMetadata(const QString& key, double metadata, QVariantMap* map) {
if (metadata != 0.0) (*map)[key] = metadata;
}
inline void AddMetadata(const QString& key, const QDateTime& metadata, QVariantMap* map) {
if (metadata.isValid()) (*map)[key] = metadata;
}

View File

@ -1169,7 +1169,7 @@ void Song::ToXesam(QVariantMap* map) const {
AddMetadataAsList("xesam:comment", comment(), map);
AddMetadata("xesam:contentCreated", AsMPRISDateTimeType(ctime()), map);
AddMetadata("xesam:lastUsed", AsMPRISDateTimeType(lastplayed()), map);
AddMetadata("xesam:audioBPM", bpm(), map);
AddMetadata("xesam:audioBPM", static_cast<int>(bpm()), map);
AddMetadataAsList("xesam:composer", composer(), map);
AddMetadata("xesam:useCount", playcount(), map);
AddMetadata("xesam:autoRating", score(), map);