mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-16 09:53:36 +02:00
Merge branch 'cst-next' of git://coolstreamtech.de/cst-public-gui-neutrino into ni/cst-next
Origin commit data
------------------
Commit: 29009126df
Author: vanhofen <vanhofen@gmx.de>
Date: 2016-08-26 (Fri, 26 Aug 2016)
This commit is contained in:
@@ -1121,7 +1121,7 @@ std::string CControlAPI::_GetBouquetWriteItem(CyhookHandler *hh, CZapitChannel *
|
||||
result += hh->outPair("id", string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel->getChannelID()), true);
|
||||
result += hh->outPair("short_id", string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel->getChannelID()&0xFFFFFFFFFFFFULL), true);
|
||||
result += hh->outPair("name", hh->outValue(channel->getName()), true);
|
||||
result += hh->outPair("logo", hh->outValue(NeutrinoAPI->getLogoFile(hh->WebserverConfigList["Tuxbox.LogosURL"], channel->getChannelID())), false);
|
||||
result += hh->outPair("logo", hh->outValue(NeutrinoAPI->getLogoFile(channel->getChannelID())), false);
|
||||
if (bouquetNr > -1)
|
||||
{
|
||||
result += hh->outNext();
|
||||
@@ -3155,7 +3155,7 @@ void CControlAPI::xmltvm3uCGI(CyhookHandler *hh)
|
||||
CZapitChannel * channel = chanlist[j];
|
||||
std::string bouq_name = g_bouquetManager->Bouquets[i]->Name;
|
||||
std::string chan_id_short = string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel->getChannelID() & 0xFFFFFFFFFFFFULL);
|
||||
result += "#EXTINF:-1 tvg-id=\""+chan_id_short+"\" tvg-logo=\""+chan_id_short+".png\" group-title=\""+bouq_name+"\", [COLOR gold]"+channel->getName()+"[/COLOR]\n";
|
||||
result += "#EXTINF:-1 tvg-id=\""+chan_id_short+"\" tvg-logo=\""+NeutrinoAPI->getLogoFile(channel->getChannelID())+"\" group-title=\""+bouq_name+"\", [COLOR gold]"+channel->getName()+"[/COLOR]\n";
|
||||
result += url+string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel->getChannelID())+"\n";
|
||||
}
|
||||
}
|
||||
@@ -3236,7 +3236,7 @@ void CControlAPI::logoCGI(CyhookHandler *hh)
|
||||
sscanf(hh->ParamList["1"].c_str(),
|
||||
SCANF_CHANNEL_ID_TYPE,
|
||||
&channel_id);
|
||||
hh->Write(NeutrinoAPI->getLogoFile(hh->WebserverConfigList["Tuxbox.LogosURL"], channel_id));
|
||||
hh->Write(NeutrinoAPI->getLogoFile(channel_id));
|
||||
}
|
||||
//-------------------------------------------------------------------------
|
||||
/** Get Config File or save values to given config file
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#include <driver/fontrenderer.h>
|
||||
#include <driver/rcinput.h>
|
||||
#include <driver/screen_max.h>
|
||||
#include <driver/pictureviewer/pictureviewer.h>
|
||||
#include <gui/color.h>
|
||||
#include <gui/widget/icons.h>
|
||||
#include <gui/customcolor.h>
|
||||
@@ -43,6 +44,7 @@
|
||||
#include <eitd/sectionsd.h>
|
||||
#include <OpenThreads/ScopedLock>
|
||||
|
||||
extern CPictureViewer *g_PicViewer;
|
||||
extern CBouquetManager *g_bouquetManager;
|
||||
extern CFrontend * frontend;
|
||||
extern cVideo * videoDecoder;
|
||||
@@ -521,24 +523,11 @@ std::string CNeutrinoAPI::getCryptInfoAsString(void)
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
std::string CNeutrinoAPI::getLogoFile(std::string _logoURL, t_channel_id channelId)
|
||||
std::string CNeutrinoAPI::getLogoFile(t_channel_id channelId)
|
||||
{
|
||||
std::string channelIdAsString = string_printf( PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS , channelId & 0xFFFFFFFFFFFFULL);
|
||||
std::string channelName = GetServiceName(channelId);
|
||||
// replace(channelName, " ", "_");
|
||||
_logoURL+="/";
|
||||
if (access((_logoURL + channelName + ".png").c_str(), 4) == 0)
|
||||
return _logoURL + channelName + ".png";
|
||||
else if (access((_logoURL + channelName + ".jpg").c_str(), 4) == 0)
|
||||
return _logoURL + channelName + ".jpg";
|
||||
else if (access((_logoURL + channelName + ".gif").c_str(), 4) == 0)
|
||||
return _logoURL + channelName + ".gif";
|
||||
else if(access((_logoURL + channelIdAsString + ".png").c_str(), 4) == 0)
|
||||
return _logoURL + channelIdAsString + ".png";
|
||||
else if (access((_logoURL + channelIdAsString + ".jpg").c_str(), 4) == 0)
|
||||
return _logoURL + channelIdAsString + ".jpg";
|
||||
else if (access((_logoURL + channelIdAsString + ".gif").c_str(), 4) == 0)
|
||||
return _logoURL + channelIdAsString + ".gif";
|
||||
else
|
||||
return "";
|
||||
std::string logoString;
|
||||
if (g_PicViewer->GetLogoName(channelId, channelName, logoString, NULL, NULL))
|
||||
return logoString;
|
||||
return "";
|
||||
}
|
||||
|
@@ -84,7 +84,7 @@ public:
|
||||
std::string getVideoFramerateAsString(void);
|
||||
std::string getAudioInfoAsString(void);
|
||||
std::string getCryptInfoAsString(void);
|
||||
std::string getLogoFile(std::string _logoURL, t_channel_id channelId);
|
||||
std::string getLogoFile(t_channel_id channelId);
|
||||
public:
|
||||
CNeutrinoAPI();
|
||||
~CNeutrinoAPI(void);
|
||||
|
@@ -380,7 +380,7 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std:
|
||||
yresult += "<tr>";
|
||||
|
||||
if (have_logos) {
|
||||
std::string channel_logo = NeutrinoAPI->getLogoFile(hh->WebserverConfigList["Tuxbox.LogosURL"], channel->getChannelID());
|
||||
std::string channel_logo = func_get_logo_name(hh, string_printf(PRINTF_CHANNEL_ID_TYPE, channel->getChannelID()));
|
||||
std::string zaplink;
|
||||
if (channel_logo.empty())
|
||||
zaplink = channel->getName().c_str();
|
||||
@@ -587,14 +587,33 @@ std::string CNeutrinoYParser::func_get_actual_channel_id(CyhookHandler *, std::
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// func: Get Logo Name
|
||||
// func: Get logo name for Webif
|
||||
//-------------------------------------------------------------------------
|
||||
std::string CNeutrinoYParser::func_get_logo_name(CyhookHandler *hh, std::string channelId)
|
||||
{
|
||||
if (hh->WebserverConfigList["Tuxbox.DisplayLogos"] == "true") {
|
||||
t_channel_id cid;
|
||||
if (1 == sscanf(channelId.c_str(), "%" PRIx64, &cid))
|
||||
return NeutrinoAPI->getLogoFile(hh->WebserverConfigList["Tuxbox.LogosURL"], cid);
|
||||
std::string LogosURL = hh->WebserverConfigList["Tuxbox.LogosURL"];
|
||||
if (hh->WebserverConfigList["Tuxbox.DisplayLogos"] == "true" && !LogosURL.empty())
|
||||
{
|
||||
std::string fileType[] = { ".png", ".jpg" , ".gif" };
|
||||
|
||||
std::string channelIdShort = channelId.substr(channelId.length() - 12);
|
||||
channelIdShort = channelIdShort.erase(0, min(channelIdShort.find_first_not_of('0'), channelIdShort.size()-1));
|
||||
|
||||
std::string channelName = "";
|
||||
t_channel_id chId = 0;
|
||||
if (sscanf(channelId.c_str(), "%" PRIx64, &chId) == 1)
|
||||
channelName = NeutrinoAPI->GetServiceName(chId);
|
||||
|
||||
for (size_t i = 0; i < (sizeof(fileType) / sizeof(fileType[0])); i++)
|
||||
{
|
||||
// first check Tuxbox.LogosURL from nhttpd.conf
|
||||
if (access((LogosURL + "/" + channelName + fileType[i]).c_str(), R_OK) == 0)
|
||||
return LogosURL + "/" + channelName + fileType[i];
|
||||
else if (access((LogosURL + "/" + channelIdShort + fileType[i]).c_str(), R_OK) == 0)
|
||||
return LogosURL + "/" + channelIdShort + fileType[i];
|
||||
else // fallback to default logos
|
||||
return NeutrinoAPI->getLogoFile(chId);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
Reference in New Issue
Block a user