From 9ddd8745ecf8a591190bf3a6226523e834020208 Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Wed, 13 Feb 2019 17:44:11 -0800 Subject: 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 --- mediaplayer/mediaplayer.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'mediaplayer') 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); -- cgit 1.2.3-korg