- infoviewer: rework get/showLivestreamInfo()

This commit is contained in:
vanhofen
2023-03-26 22:34:09 +02:00
committed by Thilo Graf
parent 59e6d462d7
commit 430d2c07ed
2 changed files with 29 additions and 16 deletions

View File

@@ -862,11 +862,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 = "";
@@ -986,27 +986,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

@@ -147,6 +147,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();
public: public:
@@ -205,6 +206,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; }