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-13 19:39:08 -0800
commit9ddd8745ecf8a591190bf3a6226523e834020208 (patch)
treeca403b4bd2cd75e64dc5589c3dde8ec749f1d8a7
parentc101de36ef524ea322ca50ac7daa3d432ed4c47d (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);