diff options
author | Matt Ranostay <matt.ranostay@konsulko.com> | 2019-02-13 17:44:11 -0800 |
---|---|---|
committer | Matt Ranostay <matt.ranostay@konsulko.com> | 2019-02-14 03:40:52 +0000 |
commit | dab35b40374d4f232b15b67d447639d96e057473 (patch) | |
tree | b3c73f0ad6f4e8725840b842e54d9e26dcf44eaf | |
parent | c01880d78721f29bcb5ab88de6f11496e2a4555e (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.cpp | 20 |
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); |