From 6c817880479c968310f91fc0fe2d40396686bf5d Mon Sep 17 00:00:00 2001 From: vanhofen Date: Sun, 26 Mar 2023 22:34:09 +0200 Subject: [PATCH] infoviewer: rework get/showLivestreamInfo() Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/0fa97c893f12056a98900de5d430bad29a2f99a9 Author: vanhofen Date: 2023-03-26 (Sun, 26 Mar 2023) Origin message was: ------------------ - infoviewer: rework get/showLivestreamInfo() ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/infoviewer.cpp | 43 ++++++++++++++++++++++++++---------------- src/gui/infoviewer.h | 2 ++ 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index 27cac6a80..65265b908 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -903,11 +903,11 @@ void CInfoViewer::setInfobarTimeout(int timeout_ext) timeoutEnd = CRCInput::calcTimeoutEnd(timeout + timeout_ext); } -bool CInfoViewer::showLivestreamInfo() +void CInfoViewer::getLivestreamInfo() { - CZapitChannel * cc = CZapit::getInstance()->GetCurrentChannel(); + CZapitChannel *cc = CZapit::getInstance()->GetCurrentChannel(); bool web_mode = (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webtv || CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webradio); - if (web_mode && (info_CurrentNext.current_uniqueKey == 0 && info_CurrentNext.next_uniqueKey == 0)) + if (cc && web_mode) { std::string livestreamInfo1 = ""; std::string livestreamInfo2 = ""; @@ -1027,27 +1027,38 @@ bool CInfoViewer::showLivestreamInfo() livestreamInfo1 += " - "; livestreamInfo1 += title; } - if(livestreamInfo2.empty()) + if (livestreamInfo2.empty()) { - if(!icy_name.empty()) + if (!icy_name.empty()) livestreamInfo2 = icy_name; - if(!icy_genre.empty()) - livestreamInfo2 += icy_genre; - if(!icy_br.empty()) - livestreamInfo2 += icy_br; - if(!icy_description.empty() && livestreamInfo2.empty()) - livestreamInfo2 += icy_description; + if (!icy_genre.empty()) + livestreamInfo2 += " " + icy_genre; + if (!icy_br.empty()) + livestreamInfo2 += " " + icy_br; + if (!icy_description.empty() && livestreamInfo2.empty()) + livestreamInfo2 += " " + icy_description; } } - if (livestreamInfo1 != _livestreamInfo1 || livestreamInfo2 != _livestreamInfo2) - { - display_Info(livestreamInfo1.c_str(), livestreamInfo2.c_str(), false); + if (livestreamInfo1 != _livestreamInfo1) _livestreamInfo1 = livestreamInfo1; + + if (livestreamInfo2 != _livestreamInfo2) _livestreamInfo2 = livestreamInfo2; - infoViewerBB->showBBButtons(true /*paintFooter*/); - } + } +} + +bool CInfoViewer::showLivestreamInfo() +{ + bool web_mode = (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webtv || CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webradio); + if (web_mode && (info_CurrentNext.current_uniqueKey == 0 && info_CurrentNext.next_uniqueKey == 0)) + { + getLivestreamInfo(); + + display_Info(_livestreamInfo1.c_str(), _livestreamInfo2.c_str(), false); + infoViewerBB->showBBButtons(true); + return true; } return false; diff --git a/src/gui/infoviewer.h b/src/gui/infoviewer.h index 121851014..b104726c6 100644 --- a/src/gui/infoviewer.h +++ b/src/gui/infoviewer.h @@ -151,6 +151,7 @@ class CInfoViewer : public sigc::trackable void reset_allScala(); void check_channellogo_ca_SettingsChange(); void sendNoEpg(const t_channel_id channel_id); + void getLivestreamInfo(); bool showLivestreamInfo(); CComponentsWindowMax *ecmInfoBox; //NI @@ -216,6 +217,7 @@ class CInfoViewer : public sigc::trackable int getSwitchMode() {return zap_mode;} void resetSwitchMode() {setSwitchMode(IV_MODE_DEFAULT);} + void get_livestreamInfo() { getLivestreamInfo(); } std::string get_livestreamInfo1() { return _livestreamInfo1; } std::string get_livestreamInfo2() { return _livestreamInfo2; }