summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2019-02-13 17:44:11 -0800
committerMatt Ranostay <matt.ranostay@konsulko.com>2019-02-14 03:40:52 +0000
commitdab35b40374d4f232b15b67d447639d96e057473 (patch)
treeb3c73f0ad6f4e8725840b842e54d9e26dcf44eaf
parentc01880d78721f29bcb5ab88de6f11496e2a4555e (diff)
libqtappfw: mediaplayer: send empty artist + album data if none
Avoid isues with clients always assuming there is an artist + album data by sending blank strings. Bug-AGL: SPEC-2180 Change-Id: Ifc1aab9f4a64bc2a142f56e1b3ffc40b1db1f5bd Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
-rw-r--r--mediaplayer/mediaplayer.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/mediaplayer/mediaplayer.cpp b/mediaplayer/mediaplayer.cpp
index 7efbb7d..2a24464 100644
--- a/mediaplayer/mediaplayer.cpp
+++ b/mediaplayer/mediaplayer.cpp
@@ -205,9 +205,23 @@ void Mediaplayer::onMessageReceived(MessageType type, Message *message)
} else if (tmsg->isMetadataEvent()) {
QVariantMap map = tmsg->eventData().toVariantMap();
- if (map.contains("track") && map.value("track").toMap().contains("image")) {
- m_context->setContextProperty("AlbumArt",
- QVariant::fromValue(map.value("track").toMap().value("image")));
+ if (map.contains("track")) {
+ QVariantMap track = map.value("track").toMap();
+
+ if (track.contains("image")) {
+ m_context->setContextProperty("AlbumArt",
+ QVariant::fromValue(track.value("image")));
+ }
+
+ if (!track.contains("artist")) {
+ track.insert("artist", "");
+ map["track"] = track;
+ }
+
+ if (!track.contains("album")) {
+ track.insert("album", "");
+ map["track"] = track;
+ }
}
emit metadataChanged(map);