infoviewer: rework get/showLivestreamInfo()

Origin commit data
------------------
Branch: ni/coolstream
Commit: 0fa97c893f
Author: vanhofen <vanhofen@gmx.de>
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
This commit is contained in:
vanhofen
2023-03-26 22:34:09 +02:00
parent 6e25596e76
commit 6c81788047
2 changed files with 29 additions and 16 deletions

View File

@@ -903,11 +903,11 @@ void CInfoViewer::setInfobarTimeout(int timeout_ext)
timeoutEnd = CRCInput::calcTimeoutEnd(timeout + 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); 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 livestreamInfo1 = "";
std::string livestreamInfo2 = ""; std::string livestreamInfo2 = "";
@@ -1027,27 +1027,38 @@ bool CInfoViewer::showLivestreamInfo()
livestreamInfo1 += " - "; livestreamInfo1 += " - ";
livestreamInfo1 += title; livestreamInfo1 += title;
} }
if(livestreamInfo2.empty()) if (livestreamInfo2.empty())
{ {
if(!icy_name.empty()) if (!icy_name.empty())
livestreamInfo2 = icy_name; livestreamInfo2 = icy_name;
if(!icy_genre.empty()) if (!icy_genre.empty())
livestreamInfo2 += icy_genre; livestreamInfo2 += " " + icy_genre;
if(!icy_br.empty()) if (!icy_br.empty())
livestreamInfo2 += icy_br; livestreamInfo2 += " " + icy_br;
if(!icy_description.empty() && livestreamInfo2.empty()) if (!icy_description.empty() && livestreamInfo2.empty())
livestreamInfo2 += icy_description; livestreamInfo2 += " " + icy_description;
} }
} }
if (livestreamInfo1 != _livestreamInfo1 || livestreamInfo2 != _livestreamInfo2) if (livestreamInfo1 != _livestreamInfo1)
{
display_Info(livestreamInfo1.c_str(), livestreamInfo2.c_str(), false);
_livestreamInfo1 = livestreamInfo1; _livestreamInfo1 = livestreamInfo1;
if (livestreamInfo2 != _livestreamInfo2)
_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 true;
} }
return false; return false;

View File

@@ -151,6 +151,7 @@ class CInfoViewer : public sigc::trackable
void reset_allScala(); void reset_allScala();
void check_channellogo_ca_SettingsChange(); void check_channellogo_ca_SettingsChange();
void sendNoEpg(const t_channel_id channel_id); void sendNoEpg(const t_channel_id channel_id);
void getLivestreamInfo();
bool showLivestreamInfo(); bool showLivestreamInfo();
CComponentsWindowMax *ecmInfoBox; //NI CComponentsWindowMax *ecmInfoBox; //NI
@@ -216,6 +217,7 @@ class CInfoViewer : public sigc::trackable
int getSwitchMode() {return zap_mode;} int getSwitchMode() {return zap_mode;}
void resetSwitchMode() {setSwitchMode(IV_MODE_DEFAULT);} void resetSwitchMode() {setSwitchMode(IV_MODE_DEFAULT);}
void get_livestreamInfo() { getLivestreamInfo(); }
std::string get_livestreamInfo1() { return _livestreamInfo1; } std::string get_livestreamInfo1() { return _livestreamInfo1; }
std::string get_livestreamInfo2() { return _livestreamInfo2; } std::string get_livestreamInfo2() { return _livestreamInfo2; }