From e31eec2d065c4c70d7ca99b41813136be18b26fe Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Sun, 5 Nov 2017 01:30:16 +0100 Subject: [PATCH] - infoviewer: try to get meta data from stream when epg is empty Signed-off-by: Thilo Graf --- src/gui/infoviewer.cpp | 45 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index f7ba901c1..92b920d65 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -994,6 +994,51 @@ bool CInfoViewer::showLivestreamInfo() } return true; } + // FIXME: move this block in the block above + else if (web_mode && cc->getEpgID() == 0) + { + // try to get meta data + std::string livestreamInfo1 = ""; + std::string livestreamInfo2 = ""; + std::string artist = ""; + std::string title = ""; + std::vector keys, values; + cPlayback *playback = CMoviePlayerGui::getInstance().getPlayback(); + if (playback) + playback->GetMetadata(keys, values); + size_t count = keys.size(); + if (count > 0) { + for (size_t i = 0; i < count; i++) { + std::string key = trim(keys[i]); + if (!strcasecmp("artist", key.c_str())) { + artist = isUTF8(values[i]) ? values[i] : convertLatin1UTF8(values[i]); + continue; + } + if (!strcasecmp("title", key.c_str())) { + title = isUTF8(values[i]) ? values[i] : convertLatin1UTF8(values[i]); + continue; + } + } + } + if (!artist.empty()) + { + livestreamInfo1 = artist; + } + if (!title.empty()) + { + if (!livestreamInfo1.empty()) + livestreamInfo1 += " - "; + livestreamInfo1 += title; + } + if (livestreamInfo1 != _livestreamInfo1 || livestreamInfo2 != _livestreamInfo2) { + display_Info(livestreamInfo1.c_str(), livestreamInfo2.c_str(), false); + _livestreamInfo1 = livestreamInfo1; + _livestreamInfo2 = livestreamInfo2; + infoViewerBB->showBBButtons(true /*paintFooter*/); + } + return true; + } + return false; }