From c3415790b18e3fffd2be94d115c06bb61117b3d4 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Sun, 5 Nov 2017 01:30:16 +0100 Subject: [PATCH] infoviewer: try to get meta data from stream when epg is empty Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/9b340752244980a59d57d3d318f70339a7f8d2e1 Author: vanhofen Date: 2017-11-05 (Sun, 05 Nov 2017) Origin message was: ------------------ - infoviewer: try to get meta data from stream when epg is empty ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/infoviewer.cpp | 45 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index f11d3239f..a950f89ac 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -1037,6 +1037,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; }