Merge remote-tracking branch 'tuxbox/master'

* needs compile fixes
* needs additional tests, of course :-)


Origin commit data
------------------
Commit: 13ab1ebc8a
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2016-10-22 (Sat, 22 Oct 2016)
This commit is contained in:
Stefan Seyfried
2016-10-22 11:37:40 +02:00
346 changed files with 13372 additions and 6088 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -19,6 +19,7 @@ class CControlAPI : public Cyhook
private:
// Dispatcher Array
typedef void (CControlAPI::*TyFunc)(CyhookHandler *hh);
std::string func_req;
typedef struct
{
const char *func_name;
@@ -27,28 +28,41 @@ private:
} TyCgiCall;
const static TyCgiCall yCgiCallList[];
struct FileCGI_List
{
std::string name;
std::string type_str;
unsigned char type;
std::string fullname;
bool operator() (FileCGI_List a, FileCGI_List b)
{
return (a.name < b.name);
}
} fsort;
int rc_send(int ev, unsigned int code, unsigned int value);
// send functions for ExecuteCGI (controld api)
void SendEventList(CyhookHandler *hh,t_channel_id channel_id);
void SendFoundEvents(CyhookHandler *hh, bool xml_format = false);
void SendcurrentVAPid(CyhookHandler *hh);
void SendAllCurrentVAPid(CyhookHandler *hh);
void SendStreamInfo(CyhookHandler *hh);
void SendBouquets(CyhookHandler *hh);
void SendBouquet(CyhookHandler *hh,int BouquetNr);
void SendChannelList(CyhookHandler *hh, bool currentTP = false);
void SendTimersPlain(CyhookHandler *hh);
void SendTimers(CyhookHandler *hh);
void SendTimersXML(CyhookHandler *hh);
void epgDetailList(CyhookHandler *hh);
void EpgSearchXMLCGI(CyhookHandler *hh);
void EpgSearchTXTCGI(CyhookHandler *hh);
void EpgSearchCGI(CyhookHandler *hh, bool xml_format = false);
void EpgSearchCGI(CyhookHandler *hh);
// subs
friend class CNeutrinoWebserver; // for timer /fb/ compatibility
void doModifyTimer(CyhookHandler *hh);
void doNewTimer(CyhookHandler *hh);
void _SendTime(CyhookHandler *hh, struct tm *Time, int digits);
std::string _GetBouquetWriteItem(CyhookHandler *hh, CZapitChannel * channel, int bouquetNr, int nr);
std::string _SendTime(CyhookHandler *hh, struct tm *Time, int digits);
std::string _GetBouquetWriteItem(CyhookHandler *hh, CZapitChannel * channel, int bouquetNr, int channelNr);
std::string channelEPGformated(CyhookHandler *hh, int bouquetnr, t_channel_id channel_id, int max, long stoptime);
std::string _GetBouquetActualEPGItem(CyhookHandler *hh, CZapitChannel * channel);
@@ -56,7 +70,6 @@ private:
void YWeb_SendVideoStreamingPids(CyhookHandler *hh, int apid_no);
void YWeb_SendRadioStreamingPid(CyhookHandler *hh);
void compatibility_Timer(CyhookHandler *hh);
std::string YexecuteScript(CyhookHandler *hh, std::string cmd);
// CGI functions for ExecuteCGI
void TimerCGI(CyhookHandler *hh);
@@ -71,7 +84,7 @@ private:
void GetServicesxmlCGI(CyhookHandler *hh);
void GetBouquetsxmlCGI(CyhookHandler *hh);
void GetUBouquetsxmlCGI(CyhookHandler *hh);
void GetChannel_IDCGI(CyhookHandler *hh);
void GetChannelIDCGI(CyhookHandler *hh);
void GetTPChannel_IDCGI(CyhookHandler *hh);
void MessageCGI(CyhookHandler *hh);
void InfoCGI(CyhookHandler *hh);
@@ -81,6 +94,7 @@ private:
void ChannellistCGI(CyhookHandler *hh);
void LogolistCGI(CyhookHandler *hh);
void GetBouquetCGI(CyhookHandler *hh);
void GetChannelCGI(CyhookHandler *hh);
void GetBouquetsCGI(CyhookHandler *hh);
void EpgCGI(CyhookHandler *hh);
void VersionCGI(CyhookHandler *hh);
@@ -109,22 +123,30 @@ private:
void renameBouquetCGI(CyhookHandler *hh);
void changeBouquetCGI(CyhookHandler *hh);
void updateBouquetCGI(CyhookHandler *hh);
void xmltvepgCGI(CyhookHandler *hh);
void xmltvm3uCGI(CyhookHandler *hh);
void build_live_url(CyhookHandler *hh);
void logoCGI(CyhookHandler *hh);
void ConfigCGI(CyhookHandler *hh);
void FileCGI(CyhookHandler *hh);
void StatfsCGI(CyhookHandler *hh);
void SignalInfoCGI(CyhookHandler *hh);
void getDirCGI(CyhookHandler *hh);
void getMoviesCGI(CyhookHandler *hh);
std::string readMovies(CyhookHandler *hh, std::string path, std::string result, bool subdirs);
std::string getSubdirectories(CyhookHandler *hh, std::string path, std::string result);
protected:
static const unsigned int PLUGIN_DIR_COUNT = 9;
static std::string PLUGIN_DIRS[PLUGIN_DIR_COUNT];
CNeutrinoAPI *NeutrinoAPI;
void init(CyhookHandler *hh);
void Execute(CyhookHandler *hh);
public:
static const unsigned int PLUGIN_DIR_COUNT = 9;
static std::string PLUGIN_DIRS[PLUGIN_DIR_COUNT];
// constructor & deconstructor
CControlAPI(CNeutrinoAPI *_NeutrinoAPI);

View File

@@ -26,9 +26,9 @@
#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>
#include <gui/movieplayer.h>
#include <daemonc/remotecontrol.h>
#include <zapit/frontend_c.h>
@@ -41,7 +41,9 @@
#include <zapit/bouquets.h>
#include <zapit/getservices.h>
#include <eitd/sectionsd.h>
#include <OpenThreads/ScopedLock>
extern CPictureViewer *g_PicViewer;
extern CBouquetManager *g_bouquetManager;
extern CFrontend * frontend;
extern cVideo * videoDecoder;
@@ -135,6 +137,10 @@ CNeutrinoAPI::CNeutrinoAPI()
EventServer->registerEvent2( NeutrinoMessages::EVT_HDMI_CEC_STANDBY, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
EventServer->registerEvent2( NeutrinoMessages::EVT_SET_MUTE, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
EventServer->registerEvent2( NeutrinoMessages::EVT_SET_VOLUME, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
EventServer->registerEvent2( NeutrinoMessages::RECORD_START, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
EventServer->registerEvent2( NeutrinoMessages::RECORD_STOP, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
pmutex = new OpenThreads::Mutex(OpenThreads::Mutex::MUTEX_RECURSIVE);
}
//-------------------------------------------------------------------------
@@ -152,6 +158,8 @@ CNeutrinoAPI::~CNeutrinoAPI(void)
delete Timerd;
if (EventServer)
delete EventServer;
delete pmutex;
}
//-------------------------------------------------------------------------
@@ -171,6 +179,7 @@ void CNeutrinoAPI::UpdateBouquets(void)
//-------------------------------------------------------------------------
void CNeutrinoAPI::ZapTo(const char * const target)
{
OpenThreads::ScopedPointerLock<OpenThreads::Mutex> lock(pmutex);
t_channel_id channel_id;
sscanf(target,
@@ -182,6 +191,7 @@ void CNeutrinoAPI::ZapTo(const char * const target)
//-------------------------------------------------------------------------
void CNeutrinoAPI::ZapToChannelId(t_channel_id channel_id)
{
OpenThreads::ScopedPointerLock<OpenThreads::Mutex> lock(pmutex);
if (channel_id == Zapit->getCurrentServiceID())
{
//printf("Kanal ist aktuell\n");
@@ -195,6 +205,7 @@ void CNeutrinoAPI::ZapToChannelId(t_channel_id channel_id)
void CNeutrinoAPI::ZapToSubService(const char * const target)
{
OpenThreads::ScopedPointerLock<OpenThreads::Mutex> lock(pmutex);
t_channel_id channel_id;
sscanf(target,
@@ -207,6 +218,7 @@ void CNeutrinoAPI::ZapToSubService(const char * const target)
//-------------------------------------------------------------------------
t_channel_id CNeutrinoAPI::ChannelNameToChannelId(std::string search_channel_name)
{
OpenThreads::ScopedPointerLock<OpenThreads::Mutex> lock(pmutex);
//FIXME depending on mode missing
//int mode = Zapit->getMode();
t_channel_id channel_id = (t_channel_id)-1;
@@ -264,6 +276,7 @@ bool CNeutrinoAPI::GetStreamInfo(int bitInfo[10])
bool CNeutrinoAPI::GetChannelEvents(void)
{
OpenThreads::ScopedPointerLock<OpenThreads::Mutex> lock(pmutex);
eList.clear();
CEitManager::getInstance()->getChannelEvents(eList);
CChannelEventList::iterator eventIterator;
@@ -279,15 +292,31 @@ bool CNeutrinoAPI::GetChannelEvents(void)
return true;
}
//-------------------------------------------------------------------------
std::string CNeutrinoAPI::GetServiceName(t_channel_id channel_id)
void CNeutrinoAPI::GetChannelEvent(t_channel_id channel_id, CChannelEvent &event)
{
return CServiceManager::getInstance()->GetServiceName(channel_id);
OpenThreads::ScopedPointerLock<OpenThreads::Mutex> lock(pmutex);
event.eventID = 0;
t_channel_id epg_id = channel_id;
CZapitChannel * ch = CServiceManager::getInstance()->FindChannel(channel_id);
if (ch)
epg_id = ch->getEpgID();
CChannelEvent * evt = ChannelListEvents[epg_id];
if (evt)
event = *evt;
}
//-------------------------------------------------------------------------
std::string CNeutrinoAPI::GetServiceName(t_channel_id channel_id)
{
OpenThreads::ScopedPointerLock<OpenThreads::Mutex> lock(pmutex);
return CServiceManager::getInstance()->GetServiceName(channel_id);
}
//-------------------------------------------------------------------------
#if 0 //never used
CZapitClient::BouquetChannelList *CNeutrinoAPI::GetBouquet(unsigned int, int)
{
//FIXME
@@ -315,7 +344,7 @@ void CNeutrinoAPI::UpdateChannelList(void)
{
//FIXME
}
#endif
//-------------------------------------------------------------------------
std::string CNeutrinoAPI::timerEventType2Str(CTimerd::CTimerEventTypes type)
@@ -323,33 +352,33 @@ std::string CNeutrinoAPI::timerEventType2Str(CTimerd::CTimerEventTypes type)
std::string result;
switch (type) {
case CTimerd::TIMER_SHUTDOWN:
result = "Shutdown";
result = "{=L:timerlist.type.shutdown=}";
break;
#if 0
case CTimerd::TIMER_NEXTPROGRAM:
result = "Next program";
result = "{=L:timerlist.type.nextprogram=}";
break;
#endif
case CTimerd::TIMER_ZAPTO:
result = "Zap to";
result = "{=L:timerlist.type.zapto=}";
break;
case CTimerd::TIMER_STANDBY:
result = "Standby";
result = "{=L:timerlist.type.standby=}";
break;
case CTimerd::TIMER_RECORD:
result = "Record";
result = "{=L:timerlist.type.record=}";
break;
case CTimerd::TIMER_REMIND:
result = "Reminder";
result = "{=L:timerlist.type.remind=}";
break;
case CTimerd::TIMER_EXEC_PLUGIN:
result = "Execute plugin";
result = "{=L:timerlist.type.execplugin=}";
break;
case CTimerd::TIMER_SLEEPTIMER:
result = "Sleeptimer";
result = "{=L:timerlist.type.sleeptimer=}";
break;
default:
result = "Unknown";
result = "{=L:timerlist.type.unknown=}";
break;
}
return result;
@@ -362,63 +391,66 @@ std::string CNeutrinoAPI::timerEventRepeat2Str(CTimerd::CTimerEventRepeat rep)
std::string result;
switch (rep) {
case CTimerd::TIMERREPEAT_ONCE:
result = "once";
result = "{=L:timerlist.repeat.once=}";
break;
case CTimerd::TIMERREPEAT_DAILY:
result = "daily";
result = "{=L:timerlist.repeat.daily=}";
break;
case CTimerd::TIMERREPEAT_WEEKLY:
result = "weekly";
result = "{=L:timerlist.repeat.weekly=}";
break;
case CTimerd::TIMERREPEAT_BIWEEKLY:
result = "2-weekly";
result = "{=L:timerlist.repeat.biweekly=}";
break;
case CTimerd::TIMERREPEAT_FOURWEEKLY:
result = "4-weekly";
result = "{=L:timerlist.repeat.fourweekly=}";
break;
case CTimerd::TIMERREPEAT_MONTHLY:
result = "monthly";
result = "{=L:timerlist.repeat.monthly=}";
break;
case CTimerd::TIMERREPEAT_BYEVENTDESCRIPTION:
result = "event";
result = "{=L:timerlist.repeat.byeventdescription=}";
break;
case CTimerd::TIMERREPEAT_WEEKDAYS:
result = "weekdays";
result = "{=L:timerlist.repeat.weekdays=}";
break;
default:
if (rep > CTimerd::TIMERREPEAT_WEEKDAYS)
{
if (rep & 0x0200)
result += "Mo ";
result += "{=L:date.mo=} ";
if (rep & 0x0400)
result += "Tu ";
result += "{=L:date.tu=} ";
if (rep & 0x0800)
result += "We ";
result += "{=L:date.we=} ";
if (rep & 0x1000)
result += "Th ";
result += "{=L:date.th=} ";
if (rep & 0x2000)
result += "Fr ";
result += "{=L:date.fr=} ";
if (rep & 0x4000)
result += "Sa ";
result += "{=L:date.sa=} ";
if (rep & 0x8000)
result += "Su ";
result += "{=L:date.su=} ";
}
else
result = "Unknown";
result = "{=L:timerlist.type.unknown=}";
}
return result;
}
//-------------------------------------------------------------------------
std::string CNeutrinoAPI::getVideoAspectRatioAsString(void) {
std::string CNeutrinoAPI::getVideoAspectRatioAsString(void)
{
int aspectRatio = videoDecoder->getAspectRatio();
if (aspectRatio >= 0 && aspectRatio <= 4)
return videoformat_names[aspectRatio];
else
return "unknown";
return "{=L:unknown=}";
}
//-------------------------------------------------------------------------
int CNeutrinoAPI::setVideoAspectRatioAsString(std::string newRatioString) {
int CNeutrinoAPI::setVideoAspectRatioAsString(std::string newRatioString)
{
OpenThreads::ScopedPointerLock<OpenThreads::Mutex> lock(pmutex);
int newRatioInt = -1;
for(int i=0;i<(int)sizeof(videoformat_names);i++)
if( videoformat_names[i] == newRatioString){
@@ -430,7 +462,8 @@ int CNeutrinoAPI::setVideoAspectRatioAsString(std::string newRatioString) {
return newRatioInt;
}
//-------------------------------------------------------------------------
std::string CNeutrinoAPI::getVideoResolutionAsString(void) {
std::string CNeutrinoAPI::getVideoResolutionAsString(void)
{
int xres, yres, framerate;
videoDecoder->getPictureInfo(xres, yres, framerate);
std::stringstream out;
@@ -439,9 +472,10 @@ std::string CNeutrinoAPI::getVideoResolutionAsString(void) {
}
//-------------------------------------------------------------------------
std::string CNeutrinoAPI::getVideoFramerateAsString(void) {
std::string CNeutrinoAPI::getVideoFramerateAsString(void)
{
int xres, yres, framerate;
std::string sframerate="unknown";
std::string sframerate = "{=L:unknown=}";
videoDecoder->getPictureInfo(xres, yres, framerate);
switch(framerate){
case 2:
@@ -453,7 +487,8 @@ std::string CNeutrinoAPI::getVideoFramerateAsString(void) {
}
//-------------------------------------------------------------------------
std::string CNeutrinoAPI::getAudioInfoAsString(void) {
std::string CNeutrinoAPI::getAudioInfoAsString(void)
{
int type, layer, freq, mode, lbitrate;
audioDecoder->getAudioInfo(type, layer, freq, lbitrate, mode);
std::stringstream out;
@@ -465,11 +500,13 @@ std::string CNeutrinoAPI::getAudioInfoAsString(void) {
}
//-------------------------------------------------------------------------
std::string CNeutrinoAPI::getCryptInfoAsString(void) {
std::string CNeutrinoAPI::getCryptInfoAsString(void)
{
std::stringstream out;
std::string casys[11]= {"Irdeto:","Betacrypt:","Seca:","Viaccess:","Nagra:","Conax: ","Cryptoworks:","Videoguard:","EBU:","XCrypt:","PowerVU:"};
int caids[] = { 0x600, 0x1700, 0x0100, 0x0500, 0x1800, 0xB00, 0xD00, 0x900, 0x2600, 0x4a00, 0x0E00 };
OpenThreads::ScopedPointerLock<OpenThreads::Mutex> lock(pmutex);
CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel();
if(channel) {
for (unsigned short i = 0; i < 11; i++) {
@@ -485,24 +522,11 @@ std::string CNeutrinoAPI::getCryptInfoAsString(void) {
}
//-------------------------------------------------------------------------
std::string CNeutrinoAPI::getLogoFile(std::string _logoURL, t_channel_id channelId) {
std::string channelIdAsString = string_printf( PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS , channelId & 0xFFFFFFFFFFFFULL);
std::string CNeutrinoAPI::getLogoFile(t_channel_id channelId)
{
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 "";
}

View File

@@ -15,6 +15,7 @@
#include <helper.h>
#include "neutrinoyparser.h"
#include "controlapi.h"
#include <OpenThreads/ScopedLock>
//-------------------------------------------------------------------------
// No Class Helpers
@@ -24,22 +25,27 @@ bool _initialize_iso639_map(void);
//-------------------------------------------------------------------------
class CNeutrinoAPI
{
private:
CChannelEventList eList;
OpenThreads::Mutex *pmutex;
std::map<unsigned, CChannelEvent *> ChannelListEvents;
// complete channellists
//CZapitClient::BouquetChannelList RadioChannelList,TVChannelList;
// events of actual channel
// List of available tv bouquets
//std::map<int, CZapitClient::BouquetChannelList> TVBouquetsList;
// List of available radio bouquets
//std::map<int, CZapitClient::BouquetChannelList> RadioBouquetsList;
// List of bouquets
CZapitClient::BouquetList BouquetList;
public:
// Clientlibs
CSectionsdClient *Sectionsd;
CZapitClient *Zapit;
CTimerdClient *Timerd;
CEventServer *EventServer;
// complete channellists
CZapitClient::BouquetChannelList RadioChannelList,TVChannelList;
// events of actual channel
std::map<unsigned, CChannelEvent *> ChannelListEvents;
// List of available tv bouquets
std::map<int, CZapitClient::BouquetChannelList> TVBouquetsList;
// List of available radio bouquets
std::map<int, CZapitClient::BouquetChannelList> RadioBouquetsList;
// List of bouquets
CZapitClient::BouquetList BouquetList;
//bool standby_mode;
@@ -55,10 +61,12 @@ class CNeutrinoAPI
bool GetChannelEvents(void);
#if 0 /* unused funktion*/
bool GetStreamInfo(int bitinfo[10]);
#endif
std::string GetServiceName(t_channel_id channel_id);
CZapitClient::BouquetChannelList *GetBouquet(unsigned int BouquetNr, int Mode);
CZapitClient::BouquetChannelList *GetChannelList(int Mode);
void UpdateBouquet(unsigned int BouquetNr);
void UpdateChannelList(void);
#endif
std::string GetServiceName(t_channel_id channel_id);
// support functions
void ZapTo (const char * const target);
@@ -66,8 +74,6 @@ class CNeutrinoAPI
void ZapToChannelId (t_channel_id channel_id);
t_channel_id ChannelNameToChannelId(std::string search_channel_name);
void UpdateBouquet(unsigned int BouquetNr);
void UpdateChannelList(void);
void UpdateBouquets(void);
std::string timerEventType2Str(CTimerd::CTimerEventTypes type);
@@ -78,17 +84,19 @@ class CNeutrinoAPI
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);
CChannelEventList eList;
CNeutrinoYParser *NeutrinoYParser;
CControlAPI *ControlAPI;
void Lock() { pmutex->lock(); }
void Unlock() { pmutex->unlock(); }
void GetChannelEvent(t_channel_id channel_id, CChannelEvent &event);
friend class CNeutrinoYParser; // Backreference
friend class CControlAPI;
//friend class CNeutrinoYParser; // Backreference
//friend class CControlAPI;
};
#endif /*__nhttpd_neutrinoapi_h__*/

View File

@@ -126,7 +126,6 @@ const CNeutrinoYParser::TyFuncCall CNeutrinoYParser::yFuncCallList[]=
{"set_timer_form", &CNeutrinoYParser::func_set_timer_form},
{"bouquet_editor_main", &CNeutrinoYParser::func_bouquet_editor_main},
{"set_bouquet_edit_form", &CNeutrinoYParser::func_set_bouquet_edit_form},
};
//-------------------------------------------------------------------------
// y-func : dispatching and executing
@@ -358,8 +357,8 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std:
for(int j = 0; j < (int) channels.size(); j++)
{
CZapitChannel * channel = channels[j];
CChannelEvent *event;
event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()];
CChannelEvent event;
NeutrinoAPI->GetChannelEvent(channel->getChannelID(), event);
classname = (i++ & 1) ? 'a' : 'b';
if (channel->getChannelID() == current_channel)
@@ -369,7 +368,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();
@@ -397,10 +396,10 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std:
}
/* timer slider */
if(event && event->duration > 0)
if(event.eventID && event.duration > 0)
{
prozent = 100 * (time(NULL) - event->startTime) / event->duration;
yresult += string_printf("<td class=\"%c\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"3\"><tr><td>\n"
prozent = 100 * (time(NULL) - event.startTime) / event.duration;
yresult += string_printf("<td class=\"%c title_cell\"><table class=\"title_table\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\"><tr><td class=\"cslider_cell\">\n"
"\t<table border=\"0\" rules=\"none\" class=\"cslider cslider_table\">"
"<tr>"
"<td class=\"cslider cslider_used\" width=\"%d\"></td>"
@@ -414,7 +413,7 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std:
}
else
{
yresult += string_printf("<td class=\"%c\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"3\"><tr><td>\n"
yresult += string_printf("<td class=\"%c title_cell\"><table class=\"title_table\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\"><tr><td class=\"cslider_cell\">\n"
"\t<table border=\"0\" rules=\"none\" class=\"cslider cslider_table\">"
"<tr>"
"<td class=\"cslider cslider_noepg\"></td>"
@@ -424,27 +423,60 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std:
);
}
/* channel name and buttons */
yresult += string_printf("<td>\n%s<a class=\"clist\" href=\"javascript:do_zap('"
PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
"')\">&nbsp;%d. %s%s</a>&nbsp;<a href=\"javascript:do_epg('"
PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
"','"
PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
"')\">%s</a>\n",
((channel->getChannelID() == current_channel) ? "<a name=\"akt\"></a>" : " "),
channel->getChannelID(),
channel->number /* num + j */,
channel->getName().c_str(),
(channel->getServiceType() == ST_NVOD_REFERENCE_SERVICE) ? " (NVOD)" : "",
channel->getChannelID(),
channel->getChannelID() & 0xFFFFFFFFFFFFULL,
((NeutrinoAPI->ChannelListEvents[channel->getChannelID()]) ? "<img src=\"/images/elist.png\" alt=\"Program preview\" style=\"border: 0px\" />" : ""));
/* channel name */
yresult += "<td>\n";
if (channel->getChannelID() == current_channel)
yresult += string_printf("\n&nbsp;&nbsp;<a href=\"javascript:do_streaminfo()\"><img src=\"/images/streaminfo.png\" alt=\"Streaminfo\" style=\"border: 0px\" /></a>");
yresult += "<a name=\"akt\"></a>\n";
yresult += string_printf("</td></tr></table>\n</td>\n</tr>\n");
yresult += string_printf("<a class=\"clist\" href=\"javascript:do_zap('"PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS"')\">"
"%d. %s%s"
"</a>\n"
, channel->getChannelID()
, channel->number
, channel->getName().c_str()
, (channel->getServiceType() == ST_NVOD_REFERENCE_SERVICE) ? " (NVOD)" : ""
);
yresult += "</td>\n";
/* buttons */
yresult += "<td align=\"right\" >\n";
if (channel->getChannelID() == current_channel)
{
yresult += "<a href=\"javascript:do_streaminfo()\">";
yresult += "<img src=\"/images/streaminfo.png\" alt=\"Streaminfo\" title=\"Streaminfo\" />";
yresult += "</a>\n";
}
if (!channel->getUrl().empty())
{
yresult += "<img src=\"/images/webtv.png\" alt=\"WebTV\" title=\"WebTV\" />\n";
}
if (channel->scrambled)
{
yresult += "<img src=\"/images/key.png\" alt=\"Scrambled\" title=\"Scrambled\" />\n";
}
if (event.eventID)
{
yresult += string_printf("<a href=\"javascript:do_epg('"PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS"','"PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS"')\">"
"<img src=\"/images/elist.png\" alt=\"Program preview\" title=\"EPG\" />"
"</a>\n"
, channel->getChannelID()
, channel->getChannelID() & 0xFFFFFFFFFFFFULL
);
}
yresult += string_printf("<a href=\"javascript:do_stream('"PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS"','%s')\">"
"<img src=\"/images/stream.png\" alt=\"Stream\" title=\"Stream\" />"
"</a>\n"
, channel->getChannelID()
, channel->getName().c_str()
);
yresult += "</td></tr></table>\n</td>\n</tr>\n";
if (channel->getServiceType() == ST_NVOD_REFERENCE_SERVICE)
{
@@ -489,23 +521,41 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std:
}
}
else if ((event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()]))
else if (event.eventID)
{
bool has_current_next = true;
CEitManager::getInstance()->getCurrentNextServiceKey(channel->getChannelID(), currentNextInfo);
timestr = timeString(event->startTime);
CEitManager::getInstance()->getCurrentNextServiceKey(channel->getEpgID(), currentNextInfo);
timestr = timeString(event.startTime);
CShortEPGData epg;
std::string EPGInfoC = "";
if (CEitManager::getInstance()->getEPGidShort(currentNextInfo.current_uniqueKey, &epg))
{
EPGInfoC += epg.info1;
EPGInfoC += epg.info2;
}
yresult += string_printf("<tr><td class=\"%cepg\">",classname);
yresult += string_printf("%s&nbsp;%s&nbsp;"
yresult += string_printf("%s&nbsp;<span class='pointer' title='%s'>%s</span>&nbsp;"
"<span style=\"font-size: 8pt; white-space: nowrap\">(%ld {=L:from=} %d {=L:unit.short.minute=}, %d%%)</span>"
, timestr.c_str()
, event->description.c_str()
, (time(NULL) - event->startTime)/60
, event->duration / 60,prozent);
, EPGInfoC.c_str()
, event.description.c_str()
, (time(NULL) - event.startTime)/60
, event.duration / 60,prozent);
if ((has_current_next) && (currentNextInfo.flags & CSectionsdClient::epgflags::has_next)) {
std::string EPGInfoN = "";
if (CEitManager::getInstance()->getEPGidShort(currentNextInfo.next_uniqueKey, &epg))
{
EPGInfoN += epg.info1;
EPGInfoN += epg.info2;
}
timestr = timeString(currentNextInfo.next_zeit.startzeit);
yresult += string_printf("<br />%s&nbsp;%s", timestr.c_str(), currentNextInfo.next_name.c_str());
yresult += string_printf("<br />%s&nbsp;<span class='pointer' title='%s'>%s</span>"
, timestr.c_str()
, EPGInfoN.c_str()
, currentNextInfo.next_name.c_str());
}
yresult += string_printf("</td></tr>\n");
@@ -525,14 +575,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 "";
}
@@ -676,7 +745,8 @@ std::string CNeutrinoYParser::func_get_audio_pids_as_dropdown(CyhookHandler *,
{
if(!(init_iso))
{
strcpy( pids.APIDs[j].desc, _getISO639Description( pids.APIDs[j].desc ) );
std::string tmp_desc = _getISO639Description( pids.APIDs[j].desc);
strncpy(pids.APIDs[j].desc, tmp_desc.c_str(), DESC_MAX_LEN -1);
}
yresult += string_printf("<option value=%05u %s>%s %s</option>\r\n",idx_as_id ? j : pids.APIDs[j].pid,(j==selected_apid) ? "selected=\"selected\"" : "",std::string(pids.APIDs[j].desc).c_str(),pids.APIDs[j].is_ac3 ? " (AC3)": pids.APIDs[j].is_aac ? "(AAC)" : pids.APIDs[j].is_eac3 ? "(EAC3)" : " ");
}
@@ -693,7 +763,8 @@ std::string CNeutrinoYParser::func_get_audio_pids_as_dropdown(CyhookHandler *,
{
if(!(init_iso))
{
strcpy( pids.APIDs[i].desc, _getISO639Description( pids.APIDs[i].desc ) );
std::string tmp_desc = _getISO639Description( pids.APIDs[i].desc);
strncpy(pids.APIDs[i].desc, tmp_desc.c_str(), DESC_MAX_LEN -1);
}
yresult += string_printf("<option value=%05u %s>%s %s</option>\r\n",
idx_as_id ? i : it->pid, (i==selected_apid) ? "selected=\"selected\"" : "",pids.APIDs[i].desc,
@@ -781,6 +852,7 @@ std::string CNeutrinoYParser::func_get_boxtype(CyhookHandler *, std::string)
if( boxname == "Armas ")
boxname += "TripleDragon";
break;
#ifdef BOXMODEL_NEVIS
case 6:
boxname += "HD1";
break;
@@ -792,19 +864,29 @@ std::string CNeutrinoYParser::func_get_boxtype(CyhookHandler *, std::string)
if (CFEManager::getInstance()->getFrontendCount() > 1)
boxname += " Twin";
break;
case 9:
boxname += "Tank";
break;
case 10:
boxname += "Zee";
break;
#endif
#ifdef BOXMODEL_APOLLO
case 9:
boxname += "Tank";
break;
case 11:
boxname += "Trinity";
if (cs_get_chip_type() != 33904 /*0x8470*/)
boxname += " V2";
break;
case 12:
boxname += "Zee2";
break;
case 13:
boxname += "Link";
break;
case 14:
boxname += "Trinity Duo";
break;
#endif
default:
char buffer[10];
snprintf(buffer, sizeof(buffer), "%u\n", system_rev);
@@ -834,21 +916,30 @@ std::string CNeutrinoYParser::func_get_boxmodel(CyhookHandler *, std::string)
switch(system_rev)
{
#ifdef BOXMODEL_NEVIS
case 6:
case 7:
case 8:
case 10:
boxmodel = "Nevis";
break;
#endif
#ifdef BOXMODEL_APOLLO
case 9:
boxmodel = "Apollo";
break;
case 11:
boxmodel = "Shiner";
if (cs_get_chip_type() == 33904 /*0x8470*/)
boxmodel = "Shiner";
else
boxmodel = "Kronos";
break;
case 12:
case 13:
case 14:
boxmodel = "Kronos";
break;
#endif
default:
break;
}