Fix the types of some MPRIS metadata fields.

This commit is contained in:
John Maguire 2012-10-15 11:40:18 +02:00
parent 1cec34b1f6
commit 1abd9c3821
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);