yWeb 2.8.a.3 Alpha-Version

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@406 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
yjogol
2010-02-24 16:16:10 +00:00
parent 24c8d684c9
commit 32c7517141
191 changed files with 8063 additions and 4185 deletions

View File

@@ -1,20 +1,2 @@
AM_CPPFLAGS = -fno-rtti -fno-exceptions
SUBDIRS = coolstream
INCLUDES = \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/src/zapit/include \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/nhttpd \
-I$(top_srcdir)/src/nhttpd/yhttpd_core \
-I$(top_srcdir)/src/nhttpd/yhttpd_mods \
-I$(top_srcdir)/lib/connection \
-I$(top_srcdir)/lib/libeventserver \
-I$(top_srcdir)/lib/libconfigfile \
-I$(top_srcdir)/lib/xmltree \
@FREETYPE_CFLAGS@
noinst_LIBRARIES = libnhttpd_tuxboxapi.a
libnhttpd_tuxboxapi_a_SOURCES = \
neutrinoapi.cpp neutrinoyparser.cpp lcdapi.cpp controlapi.cpp

View File

@@ -0,0 +1,20 @@
AM_CPPFLAGS = -fno-rtti -fno-exceptions
INCLUDES = \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/src/zapit/include \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/nhttpd \
-I$(top_srcdir)/src/nhttpd/yhttpd_core \
-I$(top_srcdir)/src/nhttpd/yhttpd_mods \
-I$(top_srcdir)/lib/connection \
-I$(top_srcdir)/lib/libeventserver \
-I$(top_srcdir)/lib/libconfigfile \
-I$(top_srcdir)/lib/xmltree \
@FREETYPE_CFLAGS@
noinst_LIBRARIES = libnhttpd_tuxboxapi.a
libnhttpd_tuxboxapi_a_SOURCES = \
neutrinoapi.cpp neutrinoyparser.cpp lcdapi.cpp controlapi.cpp

View File

@@ -32,9 +32,7 @@ private:
void SendEventList(CyhookHandler *hh,t_channel_id channel_id);
void SendcurrentVAPid(CyhookHandler *hh);
void SendAllCurrentVAPid(CyhookHandler *hh);
#if 0
void SendSettings(CyhookHandler *hh);
#endif
void SendStreamInfo(CyhookHandler *hh);
void SendBouquets(CyhookHandler *hh);
void SendBouquet(CyhookHandler *hh,int BouquetNr);
@@ -45,7 +43,7 @@ private:
friend class CNeutrinoWebserver; // for timer /fb/ compatibility
void doModifyTimer(CyhookHandler *hh);
void doNewTimer(CyhookHandler *hh);
//yweb
void YWeb_SendVideoStreamingPids(CyhookHandler *hh, int apid_no);
void YWeb_SendRadioStreamingPid(CyhookHandler *hh);
@@ -59,12 +57,11 @@ private:
void ExecCGI(CyhookHandler *hh);
void SystemCGI(CyhookHandler *hh);
void StandbyCGI(CyhookHandler *hh);
void EsoundCGI(CyhookHandler *hh);
void RCCGI(CyhookHandler *hh);
void GetDateCGI(CyhookHandler *hh);
void GetTimeCGI(CyhookHandler *hh);
#if 0
void SettingsCGI(CyhookHandler *hh);
#endif
void GetServicesxmlCGI(CyhookHandler *hh);
void GetBouquetsxmlCGI(CyhookHandler *hh);
void GetChannel_IDCGI(CyhookHandler *hh);
@@ -83,9 +80,7 @@ private:
void YWebCGI(CyhookHandler *hh);
void RebootCGI(CyhookHandler *hh);
void RCEmCGI(CyhookHandler *hh);
#if 0
void AspectRatioCGI(CyhookHandler *hh);
#endif
void VideoFormatCGI(CyhookHandler *hh);
void VideoOutputCGI(CyhookHandler *hh);
void VCROutputCGI(CyhookHandler *hh);
@@ -103,7 +98,7 @@ private:
protected:
static const unsigned int PLUGIN_DIR_COUNT = 5;
static std::string PLUGIN_DIRS[PLUGIN_DIR_COUNT];
CNeutrinoAPI *NeutrinoAPI;
CNeutrinoAPI *NeutrinoAPI;
void init(CyhookHandler *hh);
void Execute(CyhookHandler *hh);
@@ -114,8 +109,9 @@ public:
// virtual functions for HookHandler/Hook
virtual std::string getHookName(void) {return std::string("mod_ControlAPI");}
virtual std::string getHookVersion(void) {return std::string("$Revision: 1.4 $");}
virtual THandleStatus Hook_SendResponse(CyhookHandler *hh);
virtual std::string getHookVersion(void) {return std::string("$Revision: 1.1.2.1 $");}
virtual THandleStatus Hook_SendResponse(CyhookHandler *hh);
virtual THandleStatus Hook_PrepareResponse(CyhookHandler *hh);
};
#endif /* __nhttpd_neutrinocontrolapi_hpp__ */

View File

@@ -4,7 +4,7 @@
Copyright (C) 2001/2002 Dirk Szymanski 'Dirch'
Copyright (C) 2005 SnowHead
$Id: lcdapi.cpp,v 1.1 2006/09/16 14:47:44 yjogol Exp $
$Id: lcdapi.cpp,v 1.1.2.1 2010/02/21 10:10:12 cvs Exp $
License: GPL
@@ -86,7 +86,7 @@ void CLCDAPI::LockDisplay(int plock)
}
}
void CLCDAPI::DrawLine(int /*x1*/, int /*y1*/, int /*x2*/, int /*y2*/, int /*col*/)
void CLCDAPI::DrawLine(int x1, int y1, int x2, int y2, int col)
{
#if HAVE_LCD
int color=(col==0)?(CLCDDisplay::PIXEL_OFF):((col==2)?(CLCDDisplay::PIXEL_INV):(CLCDDisplay::PIXEL_ON));
@@ -94,7 +94,7 @@ void CLCDAPI::DrawLine(int /*x1*/, int /*y1*/, int /*x2*/, int /*y2*/, int /*col
#endif
}
void CLCDAPI::DrawRect(int /*x1*/, int /*y1*/, int /*x2*/, int /*y2*/, int /*coll*/, int /*colf*/)
void CLCDAPI::DrawRect(int x1, int y1, int x2, int y2, int coll, int colf)
{
#if HAVE_LCD
int colorl=(coll==0)?(CLCDDisplay::PIXEL_OFF):((coll==2)?(CLCDDisplay::PIXEL_INV):(CLCDDisplay::PIXEL_ON));
@@ -103,7 +103,7 @@ void CLCDAPI::DrawRect(int /*x1*/, int /*y1*/, int /*x2*/, int /*y2*/, int /*col
#endif
}
void CLCDAPI::DrawText(int /*px*/, int /*py*/, int /*psize*/, int /*pcolor*/, int /*pfont*/, char */*pmsg*/)
void CLCDAPI::DrawText(int px, int py, int psize, int pcolor, int pfont, char *pmsg)
{
#if HAVE_LCD
int color=(pcolor==0)?(CLCDDisplay::PIXEL_OFF):((pcolor==2)?(CLCDDisplay::PIXEL_INV):(CLCDDisplay::PIXEL_ON));
@@ -116,7 +116,7 @@ void CLCDAPI::DrawText(int /*px*/, int /*py*/, int /*psize*/, int /*pcolor*/, in
#endif
}
bool CLCDAPI::ShowPng(char */*filename*/)
bool CLCDAPI::ShowPng(char *filename)
{
#if HAVE_LCD
return display.load_png(filename);
@@ -124,13 +124,13 @@ bool CLCDAPI::ShowPng(char */*filename*/)
return 0;
}
void CLCDAPI::ShowRaw(int /*xpos*/, int /*ypos*/, int /*xsize*/, int /*ysize*/, char */*ascreen*/)
void CLCDAPI::ShowRaw(int xpos, int ypos, int xsize, int ysize, char *ascreen)
{
#if HAVE_LCD
int sbyte,dbit,dxpos,dypos,wasinc=0,gotval;
char *sptr=ascreen;
raw_display_t rscreen;
display.dump_screen(&rscreen);
gotval=sscanf(sptr,"%d",&sbyte);
for(dypos=ypos; gotval && (dypos<(ypos+ysize)); dypos++)
@@ -173,7 +173,7 @@ void CLCDAPI::ShowRaw(int /*xpos*/, int /*ypos*/, int /*xsize*/, int /*ysize*/,
display.load_screen(&rscreen);
#endif
}
//-------------------------------------------------------------------------
// Konstruktor und destruktor
@@ -183,7 +183,7 @@ CLCDAPI::CLCDAPI()
{
#if HAVE_LCD
// int i;
// display = new CLCDDisplay();
fontRenderer = new LcdFontRenderClass(&display);

View File

@@ -4,7 +4,7 @@
Copyright (C) 2001/2002 Dirk Szymanski 'Dirch'
Copyright (C) 2005 SnowHead
$Id: lcdapi.h,v 1.1 2006/09/16 14:47:44 yjogol Exp $
$Id: lcdapi.h,v 1.1.2.1 2010/02/21 10:10:12 cvs Exp $
License: GPL

View File

@@ -39,7 +39,7 @@ void sectionsd_getChannelEvents(CChannelEventList &eList, const bool tv_mode = t
//=============================================================================
static std::map<std::string, std::string> iso639;
#ifndef initialize_iso639_map
bool _initialize_iso639_map(void)
{
std::string s, t, u, v;
@@ -61,7 +61,7 @@ bool _initialize_iso639_map(void)
else
return false;
}
#endif
//-----------------------------------------------------------------------------
const char * _getISO639Description(const char * const iso)
{
@@ -85,7 +85,7 @@ std::string CNeutrinoAPI::audiotype_names[5] = {"none", "single channel","dual
//=============================================================================
CNeutrinoAPI::CNeutrinoAPI()
{
//Controld = new CControldClient();
Controld = new CControldClient();
Sectionsd = new CSectionsdClient();
Zapit = new CZapitClient();
Timerd = new CTimerdClient();
@@ -107,6 +107,8 @@ CNeutrinoAPI::CNeutrinoAPI()
EventServer->registerEvent2( NeutrinoMessages::EVT_START_PLUGIN, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
EventServer->registerEvent2( NeutrinoMessages::LOCK_RC, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
EventServer->registerEvent2( NeutrinoMessages::UNLOCK_RC, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
EventServer->registerEvent2( NeutrinoMessages::ESOUND_ON, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
EventServer->registerEvent2( NeutrinoMessages::ESOUND_OFF, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
}
//-------------------------------------------------------------------------
@@ -118,8 +120,8 @@ CNeutrinoAPI::~CNeutrinoAPI(void)
delete NeutrinoYParser;
if (ControlAPI)
delete ControlAPI;
//if (Controld)
// delete Controld;
if (Controld)
delete Controld;
if (Sectionsd)
delete Sectionsd;
if (Zapit)
@@ -134,15 +136,12 @@ CNeutrinoAPI::~CNeutrinoAPI(void)
void CNeutrinoAPI::UpdateBouquets(void)
{
#if 0
BouquetList.clear();
Zapit->getBouquets(BouquetList, true, true);
Zapit->getBouquets(BouquetList, true);
for (unsigned int i = 1; i <= BouquetList.size(); i++)
UpdateBouquet(i);
UpdateChannelList();
#endif
}
//-------------------------------------------------------------------------
@@ -166,7 +165,7 @@ void CNeutrinoAPI::ZapToChannelId(t_channel_id channel_id)
}
if (Zapit->zapTo_serviceID(channel_id) != CZapitClient::ZAP_INVALID_PARAM)
Sectionsd->setServiceChanged(channel_id&0xFFFFFFFFFFFFULL, false);
Sectionsd->setServiceChanged(channel_id, false);
}
//-------------------------------------------------------------------------
@@ -179,7 +178,7 @@ void CNeutrinoAPI::ZapToSubService(const char * const target)
&channel_id);
if (Zapit->zapTo_subServiceID(channel_id) != CZapitClient::ZAP_INVALID_PARAM)
Sectionsd->setServiceChanged(channel_id&0xFFFFFFFFFFFFULL, false);
Sectionsd->setServiceChanged(channel_id, false);
}
//-------------------------------------------------------------------------
t_channel_id CNeutrinoAPI::ChannelNameToChannelId(std::string search_channel_name)
@@ -188,16 +187,18 @@ t_channel_id CNeutrinoAPI::ChannelNameToChannelId(std::string search_channel_nam
//int mode = Zapit->getMode();
t_channel_id channel_id = (t_channel_id)-1;
CStringArray channel_names = ySplitStringVector(search_channel_name, ",");
for (tallchans_iterator it = allchans.begin(); it != allchans.end(); it++) {
std::string channel_name = it->second.getName();
CZapitClient::BouquetChannelList *channellist = GetChannelList(CZapitClient::MODE_CURRENT);
CZapitClient::BouquetChannelList::iterator channel = channellist->begin();
for(; channel != channellist->end();channel++)
{
std::string channel_name = channel->name;
for(unsigned int j=0;j<channel_names.size();j++)
{
if(channel_names[j].length() == channel_name.length() &&
equal(channel_names[j].begin(), channel_names[j].end(),
channel_name.begin(), nocase_compare)) //case insensitive compare
{
channel_id = it->second.channel_id;
channel_id = channel->channel_id;
break;
}
}
@@ -236,15 +237,10 @@ bool CNeutrinoAPI::GetStreamInfo(int bitInfo[10])
value=strtoul(tmpptr,NULL,0);
bitInfo[pos]= value;
pos++;
#if !HAVE_DB0X2
if(pos > 4) break;
#endif
}
}
#if !HAVE_DB0X2
bitInfo[4] = 37500;
bitInfo[6] = 3;
#endif
fclose(fd);
return true;
@@ -254,8 +250,7 @@ bool CNeutrinoAPI::GetStreamInfo(int bitInfo[10])
bool CNeutrinoAPI::GetChannelEvents(void)
{
//eList = Sectionsd->getChannelEvents();
sectionsd_getChannelEvents(eList);
eList = Sectionsd->getChannelEvents();
CChannelEventList::iterator eventIterator;
ChannelListEvents.clear();
@@ -273,29 +268,21 @@ bool CNeutrinoAPI::GetChannelEvents(void)
std::string CNeutrinoAPI::GetServiceName(t_channel_id channel_id)
{
tallchans_iterator it = allchans.find(channel_id);
if (it != allchans.end())
it->second.getName();
#if 0
unsigned int i;
for (i = 0; i < TVChannelList.size(); i++)
if (TVChannelList[i].channel_id == channel_id)
return TVChannelList[i].name;
for (i = 0; i < RadioChannelList.size(); i++)
if (RadioChannelList[i].channel_id == channel_id)
return RadioChannelList[i].name;
#endif
return "";
}
//-------------------------------------------------------------------------
CZapitClient::BouquetChannelList *CNeutrinoAPI::GetBouquet(unsigned int /*BouquetNr*/, int /*Mode*/)
CZapitClient::BouquetChannelList *CNeutrinoAPI::GetBouquet(unsigned int BouquetNr, int Mode)
{
//FIXME
printf("CNeutrinoAPI::GetChannelList still used !\n");
return NULL;
#if 0
int mode;
if (Mode == CZapitClient::MODE_CURRENT)
@@ -307,17 +294,12 @@ CZapitClient::BouquetChannelList *CNeutrinoAPI::GetBouquet(unsigned int /*Bouque
return &TVBouquetsList[BouquetNr];
else
return &RadioBouquetsList[BouquetNr];
#endif
}
//-------------------------------------------------------------------------
CZapitClient::BouquetChannelList *CNeutrinoAPI::GetChannelList(int /*Mode*/)
CZapitClient::BouquetChannelList *CNeutrinoAPI::GetChannelList(int Mode)
{
//FIXME
printf("CNeutrinoAPI::GetChannelList still used !\n");
return NULL;
#if 0
int mode;
if (Mode == CZapitClient::MODE_CURRENT)
@@ -329,31 +311,24 @@ CZapitClient::BouquetChannelList *CNeutrinoAPI::GetChannelList(int /*Mode*/)
return &TVChannelList;
else
return &RadioChannelList;
#endif
}
//-------------------------------------------------------------------------
void CNeutrinoAPI::UpdateBouquet(unsigned int /*BouquetNr*/)
void CNeutrinoAPI::UpdateBouquet(unsigned int BouquetNr)
{
#if 0 //FIXME
TVBouquetsList[BouquetNr].clear();
RadioBouquetsList[BouquetNr].clear();
Zapit->getBouquetChannels(BouquetNr - 1, TVBouquetsList[BouquetNr], CZapitClient::MODE_TV, true);
Zapit->getBouquetChannels(BouquetNr - 1, RadioBouquetsList[BouquetNr], CZapitClient::MODE_RADIO, true);
#endif
Zapit->getBouquetChannels(BouquetNr - 1, TVBouquetsList[BouquetNr], CZapitClient::MODE_TV);
Zapit->getBouquetChannels(BouquetNr - 1, RadioBouquetsList[BouquetNr], CZapitClient::MODE_RADIO);
}
//-------------------------------------------------------------------------
void CNeutrinoAPI::UpdateChannelList(void)
{
#if 0
TVChannelList.clear();
RadioChannelList.clear();
Zapit->getChannels(RadioChannelList, CZapitClient::MODE_RADIO, CZapitClient::SORT_BOUQUET, true);
Zapit->getChannels(TVChannelList, CZapitClient::MODE_TV, CZapitClient::SORT_BOUQUET, true);
#endif
Zapit->getChannels(RadioChannelList, CZapitClient::MODE_RADIO);
Zapit->getChannels(TVChannelList, CZapitClient::MODE_TV);
}
//-------------------------------------------------------------------------

View File

@@ -6,7 +6,7 @@
#include <string>
// tuxbox
//#include <controldclient/controldclient.h>
#include <controldclient/controldclient.h>
#include <eventserver.h>
#include <sectionsdclient/sectionsdclient.h>
#include <timerdclient/timerdclient.h>
@@ -28,7 +28,7 @@ bool _initialize_iso639_map(void);
class CNeutrinoAPI
{
// Clientlibs
//CControldClient *Controld;
CControldClient *Controld;
CSectionsdClient *Sectionsd;
CZapitClient *Zapit;
CTimerdClient *Timerd;
@@ -83,6 +83,7 @@ public:
CControlAPI *ControlAPI;
friend class CNeutrinoYParser; // Backreference
friend class CNeutrinoYParserCoolstream; // Backreference
friend class CControlAPI;
};

View File

@@ -7,6 +7,7 @@
#include <iostream>
#include <fstream>
#include <limits>
#include <algorithm>
// system
#include <sys/types.h> //ntohs
#include <netinet/in.h> //ntohs
@@ -21,22 +22,6 @@
#include "neutrinoyparser.h"
#include "neutrinoapi.h"
#include <global.h>
#include <neutrino.h>
#include <system/settings.h>
#include <zapit/channel.h>
#include <zapit/bouquets.h>
extern tallchans allchans;
extern CBouquetManager *g_bouquetManager;
extern t_channel_id live_channel_id;
bool sectionsd_getNVODTimesServiceKey(const t_channel_id uniqueServiceKey, CSectionsdClient::NVODTimesList& nvod_list);
void sectionsd_getCurrentNextServiceKey(t_channel_id uniqueServiceKey, CSectionsdClient::responseGetCurrentNextInfoChannelID& current_next );
bool sectionsd_getComponentTagsUniqueKey(const event_id_t uniqueKey, CSectionsdClient::ComponentTagList& tags);
bool sectionsd_getActualEPGServiceKey(const t_channel_id uniqueServiceKey, CEPGData * epgdata);
//=============================================================================
// Constructor & Destructor & Initialization
//=============================================================================
@@ -59,7 +44,7 @@ THandleStatus CNeutrinoYParser::Hook_SendResponse(CyhookHandler *hh)
{
hh->status = HANDLED_NONE;
// log_level_printf(4,"Neutrinoparser Hook Start url:%s\n",hh->UrlData["url"].c_str());
log_level_printf(4,"Neutrinoparser Hook Start url:%s\n",hh->UrlData["url"].c_str());
init(hh);
CNeutrinoYParser *yP = new CNeutrinoYParser(NeutrinoAPI); // create a Session
@@ -74,7 +59,7 @@ THandleStatus CNeutrinoYParser::Hook_SendResponse(CyhookHandler *hh)
delete yP;
// log_level_printf(4,"Neutrinoparser Hook Ende status:%d\n",(int)hh->status);
log_level_printf(4,"Neutrinoparser Hook Ende status:%d\n",(int)hh->status);
// log_level_printf(5,"Neutrinoparser Hook Result:%s\n",hh->yresult.c_str());
return hh->status;
@@ -89,6 +74,15 @@ THandleStatus CNeutrinoYParser::Hook_ReadConfig(CConfigFile *Config, CStringList
ConfigList["ExtrasDocumentURL"] = Config->getString("ExtrasDocURL", EXTRASDOCUMENTURL);
// ConfigList["NewGui"] = Config->getString("NewGui", "true");
ConfigList["Zapit_XML_Path"] = Config->getString("Zapit_XML_Path", ZAPITXMLPATH);
ConfigList["TUXBOX_LOGOS_URL"]= Config->getString("Tuxbox.LogosURL", TUXBOX_LOGOS_URL);
if (Config->getInt32("configfile.version") < 3)
{
Config->setString("Tuxbox.LogosURL", Config->getString("ExtrasDocURL", EXTRASDOCUMENTURL) +"/logos");
Config->setInt32("configfile.version", CONF_VERSION);
Config->saveConfig(HTTPD_CONFIGFILE);
}
return HANDLED_CONTINUE;
}
@@ -147,7 +141,7 @@ std::string CNeutrinoYParser::YWeb_cgi_func(CyhookHandler *hh, std::string ycmd
//-------------------------------------------------------------------------
// y-func : mount_get_list
//-------------------------------------------------------------------------
std::string CNeutrinoYParser::func_mount_get_list(CyhookHandler */*hh*/, std::string /*para*/)
std::string CNeutrinoYParser::func_mount_get_list(CyhookHandler *, std::string)
{
CConfigFile *Config = new CConfigFile(',');
std::string ysel, ytype, yip, ylocal_dir, ydir, ynr, yresult;
@@ -176,7 +170,7 @@ std::string CNeutrinoYParser::func_mount_get_list(CyhookHandler */*hh*/, std::s
//-------------------------------------------------------------------------
// y-func : mount_set_values
//-------------------------------------------------------------------------
std::string CNeutrinoYParser::func_mount_set_values(CyhookHandler *hh, std::string /*para*/)
std::string CNeutrinoYParser::func_mount_set_values(CyhookHandler *hh, std::string)
{
CConfigFile *Config = new CConfigFile(',');
std::string ynr, yresult;
@@ -201,32 +195,20 @@ std::string CNeutrinoYParser::func_mount_set_values(CyhookHandler *hh, std::str
//-------------------------------------------------------------------------
// y-func : get_bouquets_as_dropdown [<bouquet>] <doshowhidden>
//-------------------------------------------------------------------------
std::string CNeutrinoYParser::func_get_bouquets_as_dropdown(CyhookHandler */*hh*/, std::string para)
std::string CNeutrinoYParser::func_get_bouquets_as_dropdown(CyhookHandler *, std::string para)
{
std::string ynr, yresult, sel, nr_str, do_show_hidden;
int nr=1;
unsigned int nr=1;
ySplitString(para," ",nr_str, do_show_hidden);
if(nr_str != "")
nr = atoi(nr_str.c_str());
int mode = NeutrinoAPI->Zapit->getMode();
for (int i = 0; i < (int) g_bouquetManager->Bouquets.size(); i++) {
ZapitChannelList * channels = mode == CZapitClient::MODE_RADIO ? &g_bouquetManager->Bouquets[i]->radioChannels : &g_bouquetManager->Bouquets[i]->tvChannels;
sel=(nr==(i+1)) ? "selected=\"selected\"" : "";
if(!channels->empty() && (!g_bouquetManager->Bouquets[i]->bHidden || do_show_hidden == "true"))
yresult += string_printf("<option value=%u %s>%s</option>\n", i + 1, sel.c_str(),
(encodeString(std::string(g_bouquetManager->Bouquets[i]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) :g_bouquetManager->Bouquets[i]->Name.c_str()))).c_str());
//yresult += string_printf("<option value=%u %s>%s</option>\n", i + 1, sel.c_str(), (encodeString(std::string(g_bouquetManager->Bouquets[i]->Name.c_str()))).c_str());
}
#if 0
for (unsigned int i = 0; i < NeutrinoAPI->BouquetList.size();i++)
{
sel=(nr==(i+1)) ? "selected=\"selected\"" : "";
if(!NeutrinoAPI->BouquetList[i].hidden || do_show_hidden == "true")
yresult += string_printf("<option value=%u %s>%s</option>\n", (NeutrinoAPI->BouquetList[i].bouquet_nr) + 1, sel.c_str(), (encodeString(std::string(NeutrinoAPI->BouquetList[i].name))).c_str());
}
#endif
return yresult;
}
@@ -234,19 +216,13 @@ std::string CNeutrinoYParser::func_get_bouquets_as_dropdown(CyhookHandler */*hh
// y-func : get_bouquets_as_templatelist <tempalte> [~<do_show_hidden>]
// TODO: select actual Bouquet
//-------------------------------------------------------------------------
std::string CNeutrinoYParser::func_get_bouquets_as_templatelist(CyhookHandler */*hh*/, std::string para)
std::string CNeutrinoYParser::func_get_bouquets_as_templatelist(CyhookHandler *, std::string para)
{
std::string yresult, ytemplate, do_show_hidden;
log_level_printf(4,"func_get_bouquets_as_templatelist STARt\n");
ySplitString(para,"~",ytemplate, do_show_hidden);
//ytemplate += "\n"; //FIXME add newline to printf
for (int i = 0; i < (int) g_bouquetManager->Bouquets.size(); i++) {
if(!g_bouquetManager->Bouquets[i]->bHidden || do_show_hidden == "true") {
yresult += string_printf(ytemplate.c_str(), i + 1, g_bouquetManager->Bouquets[i]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : g_bouquetManager->Bouquets[i]->Name.c_str());
yresult += "\r\n";
}
}
#if 0
for (unsigned int i = 0; i < NeutrinoAPI->BouquetList.size();i++)
{
if(!NeutrinoAPI->BouquetList[i].hidden || do_show_hidden == "true")
@@ -255,22 +231,27 @@ std::string CNeutrinoYParser::func_get_bouquets_as_templatelist(CyhookHandler *
yresult += "\r\n";
}
}
#endif
log_level_printf(4,"func_get_bouquets_as_templatelist END\n");
return yresult;
}
//-------------------------------------------------------------------------
// y-func : get_actual_bouquet_number
//-------------------------------------------------------------------------
std::string CNeutrinoYParser::func_get_actual_bouquet_number(CyhookHandler */*hh*/, std::string /*para*/)
std::string CNeutrinoYParser::func_get_actual_bouquet_number(CyhookHandler *, std::string)
{
//CZapitClient::BouquetChannelList *bouquet;
//int mode = CZapitClient::MODE_CURRENT;
int actual=0;
CZapitClient::BouquetChannelList *bouquet;
int mode = CZapitClient::MODE_CURRENT;
for (int i = 0; i < (int) g_bouquetManager->Bouquets.size(); i++) {
if(g_bouquetManager->existsChannelInBouquet(i, live_channel_id)) {
actual=i+1;
break;
for (unsigned int i = 0; i < NeutrinoAPI->BouquetList.size() && actual == 0;i++)
{
bouquet = NeutrinoAPI->GetBouquet((NeutrinoAPI->BouquetList[i].bouquet_nr) + 1, mode);
CZapitClient::BouquetChannelList::iterator channel = bouquet->begin();
for (unsigned int j = 0; channel != bouquet->end() && actual == 0; channel++,j++)
{
if(channel->channel_id == NeutrinoAPI->Zapit->getCurrentServiceID())
actual=i+1;
}
}
return std::string(itoa(actual));
@@ -279,32 +260,32 @@ std::string CNeutrinoYParser::func_get_actual_bouquet_number(CyhookHandler */*h
//-------------------------------------------------------------------------
// y-func : get_channel_dropdown [<bouquet_nr> [<channel_id>]]
//-------------------------------------------------------------------------
std::string CNeutrinoYParser::func_get_channels_as_dropdown(CyhookHandler */*hh*/, std::string para)
std::string CNeutrinoYParser::func_get_channels_as_dropdown(CyhookHandler *, std::string para)
{
CZapitClient::BouquetChannelList *bouquet;
CZapitClient::BouquetList blist;
std::string abouquet, achannel_id, yresult, sel, sid;
int bnumber = 1;
//int mode = CZapitClient::MODE_CURRENT;
int mode = NeutrinoAPI->Zapit->getMode();
int mode = CZapitClient::MODE_CURRENT;
ySplitString(para," ",abouquet, achannel_id);
if(abouquet != "")
bnumber = atoi(abouquet.c_str());
if(bnumber != 0) //Bouquet View
{
bouquet = NeutrinoAPI->GetBouquet(bnumber, mode);
CZapitClient::BouquetChannelList::iterator channel = bouquet->begin();
CEPGData epg;
if(bnumber > 0) {
bnumber--;
ZapitChannelList channels;
channels = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->Bouquets[bnumber]->radioChannels : g_bouquetManager->Bouquets[bnumber]->tvChannels;
for(int j = 0; j < (int) channels.size(); j++) {
CEPGData epg;
CZapitChannel * channel = channels[j];
char buf[100],id[20];
sprintf(id,PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS,channel->channel_id);
std::string _sid = std::string(id);
sel = (_sid == achannel_id) ? "selected=\"selected\"" : "";
sectionsd_getActualEPGServiceKey(channel->channel_id&0xFFFFFFFFFFFFULL, &epg);
sprintf(buf,"<option value="PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS" %s>%.20s - %.30s</option>\n", channel->channel_id, sel.c_str(), channel->getName().c_str(),epg.title.c_str());
yresult += buf;
for (unsigned int i = 0; channel != bouquet->end(); channel++,i++)
{
sid = string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS,channel->channel_id);
sel = (sid == achannel_id) ? "selected=\"selected\"" : "";
NeutrinoAPI->Sectionsd->getActualEPGServiceKey(channel->channel_id, &epg);
std::string encoded_channel_name = encodeString(std::string(channel->name).substr(0,19));
std::string encoded_title = encodeString((epg.title).substr(0,29));
yresult += string_printf("<option value="PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS" %s>%s - %s</option>\n", channel->channel_id, sel.c_str(), encoded_channel_name.c_str(),encoded_title.c_str());
}
}
return yresult;
@@ -317,45 +298,31 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std:
{
int BouquetNr = 0;
std::string abnumber, tmp,yresult;
//CZapitClient::BouquetChannelList *channellist;
ZapitChannelList channels;
int num;
int mode = NeutrinoAPI->Zapit->getMode();
CZapitClient::BouquetChannelList *channellist;
ySplitString(para," ",abnumber, tmp);
if(abnumber != "")
BouquetNr = atoi(abnumber.c_str());
if (BouquetNr > 0) {
BouquetNr--;
channels = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->Bouquets[BouquetNr]->radioChannels : g_bouquetManager->Bouquets[BouquetNr]->tvChannels;
num = 1 + (mode == CZapitClient::MODE_RADIO ? g_bouquetManager->radioChannelsBegin().getNrofFirstChannelofBouquet(BouquetNr) : g_bouquetManager->tvChannelsBegin().getNrofFirstChannelofBouquet(BouquetNr)) ;
} else {
CBouquetManager::ChannelIterator cit = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->radioChannelsBegin() : g_bouquetManager->tvChannelsBegin();
for (; !(cit.EndOfChannels()); cit++)
channels.push_back(*cit);
num = 1;
}
if (BouquetNr > 0)
channellist = NeutrinoAPI->GetBouquet(BouquetNr, CZapitClient::MODE_CURRENT);
else
channellist = NeutrinoAPI->GetChannelList(CZapitClient::MODE_CURRENT);
NeutrinoAPI->GetChannelEvents();
int i = 1;
char classname;
t_channel_id current_channel = live_channel_id; //NeutrinoAPI->Zapit->getCurrentServiceID();
t_channel_id current_channel = NeutrinoAPI->Zapit->getCurrentServiceID();
int prozent;
CSectionsdClient::responseGetCurrentNextInfoChannelID currentNextInfo;
std::string timestr;
bool have_logos = false;
if(hh->WebserverConfigList["ExtrasDocumentRoot"] == "web" || (access((hh->WebserverConfigList["ExtrasDocumentRoot"]+"/logos").c_str(),4)==0) )
if(hh->WebserverConfigList["TUXBOX_LOGOS_URL"] != "" ||hh->WebserverConfigList["ExtrasDocumentRoot"] == "web" || (access((hh->WebserverConfigList["ExtrasDocumentRoot"]+"/logos").c_str(),4)==0) )
have_logos = true;
//CZapitClient::BouquetChannelList::iterator channel = channellist->begin();
//for (; channel != channellist->end();channel++)
for(int j = 0; j < (int) channels.size(); j++)
CZapitClient::BouquetChannelList::iterator channel = channellist->begin();
for (; channel != channellist->end();channel++)
{
CZapitChannel * channel = channels[j];
#if 1
CChannelEvent *event;
event = NeutrinoAPI->ChannelListEvents[channel->channel_id];
@@ -368,12 +335,11 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std:
if(have_logos)
yresult += string_printf("<td class=\"%c\" width=\"44\" rowspan=\"2\"><a href=\"javascript:do_zap('"
PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
"')\"><img class=\"channel_logo\" src=\"%s/logos/"
"')\"><img class=\"channel_logo\" src=\"%s/"
PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
".jpg\"/></a></td>", classname, channel->channel_id,
(hh->WebserverConfigList["ExtrasDocumentURL"]).c_str(),
channel->channel_id & 0xFFFFFFFFFFFFULL);
".gif\" alt=\"%s\"/></a></td>", classname, channel->channel_id,
(hh->WebserverConfigList["TUXBOX_LOGOS_URL"]).c_str(),
channel->channel_id, channel->name);
/* timer slider */
if(event && event->duration > 0)
prozent = 100 * (time(NULL) - event->startTime) / event->duration;
@@ -399,9 +365,9 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std:
"')\">%s</a>\n",
((channel->channel_id == current_channel) ? "<a name=\"akt\"></a>" : " "),
channel->channel_id,
num + j /*channel->nr*/,
channel->getName().c_str(),
(channel->getServiceType() == ST_NVOD_REFERENCE_SERVICE) ? " (NVOD)" : "",
channel->nr,
channel->name,
(channel->service_type == ST_NVOD_REFERENCE_SERVICE) ? " (NVOD)" : "",
channel->channel_id,
((NeutrinoAPI->ChannelListEvents[channel->channel_id]) ? "<img src=\"/images/elist.gif\" alt=\"Programmvorschau\" style=\"border: 0px\" />" : ""));
@@ -410,13 +376,10 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std:
yresult += string_printf("</td></tr></table>\n</td>\n</tr>\n");
if (channel->getServiceType() == ST_NVOD_REFERENCE_SERVICE)
if (channel->service_type == ST_NVOD_REFERENCE_SERVICE)
{
CSectionsdClient::NVODTimesList nvod_list;
//if (NeutrinoAPI->Sectionsd->getNVODTimesServiceKey(channel->channel_id&0xFFFFFFFFFFFFULL, nvod_list))
if (sectionsd_getNVODTimesServiceKey(channel->channel_id&0xFFFFFFFFFFFFULL, nvod_list))
if (NeutrinoAPI->Sectionsd->getNVODTimesServiceKey(channel->channel_id, nvod_list))
{
CZapitClient::subServiceList subServiceList;
@@ -433,10 +396,7 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std:
t_channel_id channel_id = CREATE_CHANNEL_ID_FROM_SERVICE_ORIGINALNETWORK_TRANSPORTSTREAM_ID(cmd.service_id, cmd.original_network_id, cmd.transport_stream_id);
timestr = timeString(ni->zeit.startzeit); // FIXME: time is wrong (at least on little endian)!
//NeutrinoAPI->Sectionsd->getActualEPGServiceKey(channel_id&0xFFFFFFFFFFFFULL, &epg); // FIXME: der scheissendreck geht nit!!!
sectionsd_getActualEPGServiceKey(channel_id&0xFFFFFFFFFFFFULL, &epg); // FIXME: der scheissendreck geht nit!!!
NeutrinoAPI->Sectionsd->getActualEPGServiceKey(channel_id, &epg); // FIXME: der scheissendreck geht nit!!!
yresult += string_printf("<tr>\n<td align=\"left\" style=\"width: 31px\" class=\"%cepg\">&nbsp;</td>", classname);
yresult += string_printf("<td class=\"%cepg\">%s&nbsp;", classname, timestr.c_str());
yresult += string_printf("%s<a href=\"javascript:do_zap('"
@@ -461,9 +421,7 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std:
else if ((event = NeutrinoAPI->ChannelListEvents[channel->channel_id]))
{
//bool has_current_next = NeutrinoAPI->Sectionsd->getCurrentNextServiceKey(channel->channel_id&0xFFFFFFFFFFFFULL, currentNextInfo);
bool has_current_next = true;
sectionsd_getCurrentNextServiceKey(channel->channel_id&0xFFFFFFFFFFFFULL, currentNextInfo);
bool has_current_next = NeutrinoAPI->Sectionsd->getCurrentNextServiceKey(channel->channel_id, currentNextInfo);
timestr = timeString(event->startTime);
yresult += string_printf("<tr><td class=\"%cepg\">",classname);
@@ -483,7 +441,6 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std:
}
else
yresult += string_printf("<tr style=\"height: 2px\"><td></td></tr>\n");
#endif
}
return yresult;
}
@@ -491,14 +448,14 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std:
//-------------------------------------------------------------------------
// y-func : get_actual_channel_id
//-------------------------------------------------------------------------
std::string CNeutrinoYParser::func_get_actual_channel_id(CyhookHandler */*hh*/, std::string /*para*/)
std::string CNeutrinoYParser::func_get_actual_channel_id(CyhookHandler *, std::string)
{
return string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, live_channel_id /*NeutrinoAPI->Zapit->getCurrentServiceID()*/);
return string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS,NeutrinoAPI->Zapit->getCurrentServiceID());
}
//-------------------------------------------------------------------------
// y-func : get_mode (returns tv|radio|unknown)
//-------------------------------------------------------------------------
std::string CNeutrinoYParser::func_get_mode(CyhookHandler */*hh*/, std::string /*para*/)
std::string CNeutrinoYParser::func_get_mode(CyhookHandler *, std::string)
{
std::string yresult;
int mode = NeutrinoAPI->Zapit->getMode();
@@ -515,7 +472,7 @@ std::string CNeutrinoYParser::func_get_mode(CyhookHandler */*hh*/, std::string
//-------------------------------------------------------------------------
// y-func : get_video_pids (para=audio channel, returns: 0x0000,0x0000,0x0000)
//-------------------------------------------------------------------------
std::string CNeutrinoYParser::func_get_video_pids(CyhookHandler */*hh*/, std::string para)
std::string CNeutrinoYParser::func_get_video_pids(CyhookHandler *, std::string para)
{
CZapitClient::responseGetPIDs pids;
int apid=0,apid_no=0,apid_idx=0;
@@ -534,7 +491,7 @@ std::string CNeutrinoYParser::func_get_video_pids(CyhookHandler */*hh*/, std::s
//-------------------------------------------------------------------------
// y-func : get_radio_pids (returns: 0x0000)
//-------------------------------------------------------------------------
std::string CNeutrinoYParser::func_get_radio_pid(CyhookHandler */*hh*/, std::string /*para*/)
std::string CNeutrinoYParser::func_get_radio_pid(CyhookHandler *, std::string)
{
CZapitClient::responseGetPIDs pids;
int apid=0;
@@ -550,7 +507,7 @@ std::string CNeutrinoYParser::func_get_radio_pid(CyhookHandler */*hh*/, std::st
// y-func : get_audio_pids_as_dropdown (from controlapi)
// prara: [apid] option value = apid-Value. Default apid-Index
//-------------------------------------------------------------------------
std::string CNeutrinoYParser::func_get_audio_pids_as_dropdown(CyhookHandler */*hh*/, std::string para)
std::string CNeutrinoYParser::func_get_audio_pids_as_dropdown(CyhookHandler *, std::string para)
{
std::string yresult;
static bool init_iso=true;
@@ -570,12 +527,10 @@ std::string CNeutrinoYParser::func_get_audio_pids_as_dropdown(CyhookHandler */*
pids.PIDs.vpid=0;
NeutrinoAPI->Zapit->getPIDS(pids);
t_channel_id current_channel = live_channel_id; //NeutrinoAPI->Zapit->getCurrentServiceID();
t_channel_id current_channel = NeutrinoAPI->Zapit->getCurrentServiceID();
CSectionsdClient::responseGetCurrentNextInfoChannelID currentNextInfo;
//NeutrinoAPI->Sectionsd->getCurrentNextServiceKey(current_channel&0xFFFFFFFFFFFFULL, currentNextInfo);
sectionsd_getCurrentNextServiceKey(current_channel&0xFFFFFFFFFFFFULL, currentNextInfo);
//if (NeutrinoAPI->Sectionsd->getComponentTagsUniqueKey(currentNextInfo.current_uniqueKey,tags))
if (sectionsd_getComponentTagsUniqueKey(currentNextInfo.current_uniqueKey,tags))
NeutrinoAPI->Sectionsd->getCurrentNextServiceKey(current_channel, currentNextInfo);
if (NeutrinoAPI->Sectionsd->getComponentTagsUniqueKey(currentNextInfo.current_uniqueKey,tags))
{
for (unsigned int i=0; i< tags.size(); i++)
{
@@ -625,7 +580,7 @@ std::string CNeutrinoYParser::func_get_audio_pids_as_dropdown(CyhookHandler */*
//-------------------------------------------------------------------------
// y-func : build umount list
//-------------------------------------------------------------------------
std::string CNeutrinoYParser::func_unmount_get_list(CyhookHandler */*hh*/, std::string /*para*/)
std::string CNeutrinoYParser::func_unmount_get_list(CyhookHandler *, std::string)
{
std::string ysel, ymount, ylocal_dir, yfstype, ynr, yresult, mounts;
@@ -653,7 +608,7 @@ std::string CNeutrinoYParser::func_unmount_get_list(CyhookHandler */*hh*/, std:
//-------------------------------------------------------------------------
// y-func : build partition list
//-------------------------------------------------------------------------
std::string CNeutrinoYParser::func_get_partition_list(CyhookHandler */*hh*/, std::string /*para*/)
std::string CNeutrinoYParser::func_get_partition_list(CyhookHandler *, std::string)
{
std::string ysel, ymtd, yname, dummy, yresult;
char ytmp[200];
@@ -680,15 +635,14 @@ std::string CNeutrinoYParser::func_get_partition_list(CyhookHandler */*hh*/, st
//-------------------------------------------------------------------------
// y-func : get boxtypetext (Nokia, Philips, Sagem)
//-------------------------------------------------------------------------
std::string CNeutrinoYParser::func_get_boxtype(CyhookHandler * /*hh*/, std::string /*para*/)
std::string CNeutrinoYParser::func_get_boxtype(CyhookHandler *, std::string)
{
return "Coolstream";//FIXME
//return NeutrinoAPI->Dbox_Hersteller[NeutrinoAPI->Controld->getBoxType()];
return NeutrinoAPI->Dbox_Hersteller[NeutrinoAPI->Controld->getBoxType()];
}
//-------------------------------------------------------------------------
// y-func : get stream info
//-------------------------------------------------------------------------
std::string CNeutrinoYParser::func_get_current_stream_info(CyhookHandler *hh, std::string /*para*/)
std::string CNeutrinoYParser::func_get_current_stream_info(CyhookHandler *hh, std::string)
{
int bitInfo[10];
CZapitClient::CCurrentServiceInfo serviceinfo;
@@ -703,7 +657,7 @@ std::string CNeutrinoYParser::func_get_current_stream_info(CyhookHandler *hh, s
hh->ParamList["pmtpid"] = (serviceinfo.pmtpid != 0)?itoh(serviceinfo.pmtpid):"nicht verf&uuml;gbar";
hh->ParamList["tsfrequency"] = string_printf("%d.%d MHz", serviceinfo.tsfrequency/1000, serviceinfo.tsfrequency%1000);
hh->ParamList["polarisation"] = serviceinfo.polarisation==1?"h":"v";
hh->ParamList["ServiceName"] = NeutrinoAPI->GetServiceName(live_channel_id);//NeutrinoAPI->Zapit->getCurrentServiceID());
hh->ParamList["ServiceName"] = NeutrinoAPI->GetServiceName(NeutrinoAPI->Zapit->getCurrentServiceID());
NeutrinoAPI->GetStreamInfo(bitInfo);
hh->ParamList["VideoFormat"] = string_printf("%d x %d", bitInfo[0], bitInfo[1] );
@@ -747,7 +701,7 @@ std::string CNeutrinoYParser::func_get_current_stream_info(CyhookHandler *hh, s
// Template 1:classname, 2:zAlarmTime, 3: zStopTime, 4:zRep, 5:zRepCouunt
// 6:zType, 7:sAddData, 8:timer->eventID, 9:timer->eventID
//-------------------------------------------------------------------------
std::string CNeutrinoYParser::func_get_timer_list(CyhookHandler */*hh*/, std::string para)
std::string CNeutrinoYParser::func_get_timer_list(CyhookHandler *, std::string para)
{
std::string yresult;
CTimerd::TimerList timerlist; // List of bouquets
@@ -800,8 +754,7 @@ std::string CNeutrinoYParser::func_get_timer_list(CyhookHandler */*hh*/, std::s
case CTimerd::TIMER_ZAPTO :
case CTimerd::TIMER_RECORD :
{
//sAddData = NeutrinoAPI->Zapit->getChannelName(timer->channel_id);
sAddData = NeutrinoAPI->GetServiceName(timer->channel_id);
sAddData = ZapitTools::UTF8_to_Latin1(NeutrinoAPI->Zapit->getChannelName(timer->channel_id).c_str());
if (sAddData.empty())
sAddData = NeutrinoAPI->Zapit->isChannelTVChannel(timer->channel_id) ? "Unbekannter TV-Kanal" : "Unbekannter Radiokanal";
@@ -932,12 +885,11 @@ std::string CNeutrinoYParser::func_set_timer_form(CyhookHandler *hh, std::strin
{
if(i!=(int)CTimerd::TIMER_NEXTPROGRAM)
{
std::string _sel;
std::string zType = NeutrinoAPI->timerEventType2Str((CTimerd::CTimerEventTypes) i);
if(cmd != "new")
_sel = (i==(int)timer.eventType) ? "selected=\"selected\"" : "";
sel = (i==(int)timer.eventType) ? "selected=\"selected\"" : "";
else
_sel = (i==(int)CTimerd::TIMER_RECORD) ? "selected=\"selected\"" : "";
sel = (i==(int)CTimerd::TIMER_RECORD) ? "selected=\"selected\"" : "";
hh->ParamList["timertype"] +=
string_printf("<option value=\"%d\" %s>%s\n",i,sel.c_str(),zType.c_str());
}
@@ -976,53 +928,32 @@ std::string CNeutrinoYParser::func_set_timer_form(CyhookHandler *hh, std::strin
hh->ParamList["TIMERREPEAT_ONCE"] = "y";
hh->ParamList["timer_repeatCount"] = itoa(timer.repeatCount);
t_channel_id current_channel = (cmd == "new") ? live_channel_id /*NeutrinoAPI->Zapit->getCurrentServiceID()*/ : timer.channel_id;
CBouquetManager::ChannelIterator cit = g_bouquetManager->tvChannelsBegin();
for (; !(cit.EndOfChannels()); cit++) {
std::string _sel = ((*cit)->channel_id == current_channel) ? "selected=\"selected\"" : "";
hh->ParamList["program_row"] +=
string_printf("<option value=\""
PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
"\" %s>%s</option>\n",
(*cit)->channel_id, _sel.c_str(), (*cit)->getName().c_str());
}
cit = g_bouquetManager->radioChannelsBegin();
for (; !(cit.EndOfChannels()); cit++) {
std::string _sel = ((*cit)->channel_id == current_channel) ? "selected=\"selected\"" : "";
hh->ParamList["program_row"] +=
string_printf("<option value=\""
PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
"\" %s>%s</option>\n",
(*cit)->channel_id, _sel.c_str(), (*cit)->getName().c_str());
}
#if 0
// program row
CZapitClient::BouquetChannelList channellist;
channellist.clear();
NeutrinoAPI->Zapit->getChannels(channellist,CZapitClient::MODE_TV, CZapitClient::SORT_BOUQUET, true);
NeutrinoAPI->Zapit->getChannels(channellist,CZapitClient::MODE_TV);
t_channel_id current_channel = (cmd == "new") ? NeutrinoAPI->Zapit->getCurrentServiceID() : timer.channel_id;
CZapitClient::BouquetChannelList::iterator channel = channellist.begin();
for(; channel != channellist.end();channel++)
{
std::string sel = (channel->channel_id == current_channel) ? "selected=\"selected\"" : "";
sel = (channel->channel_id == current_channel) ? "selected=\"selected\"" : "";
hh->ParamList["program_row"] +=
string_printf("<option value=\""
PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
"\" %s>%s</option>\n",
channel->channel_id, sel.c_str(), channel->getName());
channel->channel_id, sel.c_str(), channel->name);
}
channellist.clear();
NeutrinoAPI->Zapit->getChannels(channellist,CZapitClient::MODE_RADIO, CZapitClient::SORT_BOUQUET, true);
NeutrinoAPI->Zapit->getChannels(channellist,CZapitClient::MODE_RADIO);
for (channel = channellist.begin(); channel != channellist.end(); channel++)
{
std::string sel = (channel->channel_id == current_channel) ? "selected=\"selected\"" : "";
sel = (channel->channel_id == current_channel) ? "selected=\"selected\"" : "";
hh->ParamList["program_row"] +=
string_printf("<option value=\""
PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
"\" %s>%s</option>\n",
channel->channel_id, sel.c_str(), channel->getName());
channel->channel_id, sel.c_str(), channel->name);
}
#endif
// recordingDir
hh->ParamList["RECORD_DIR_MAXLEN"] = itoa(RECORD_DIR_MAXLEN-1);
if(cmd != "new") {
@@ -1035,7 +966,7 @@ std::string CNeutrinoYParser::func_set_timer_form(CyhookHandler *hh, std::strin
CConfigFile *Config = new CConfigFile(',');
Config->loadConfig(NEUTRINO_CONFIGFILE);
hh->ParamList["timer_recordingDir"] = Config->getString("network_nfs_recordingdir", "/mnt/filme");
delete Config;//Memory leak: Config
delete Config;
}
hh->ParamList["standby"] = (cmd == "new")? "0" : ((timer.standby_on)?"1":"0");
hh->ParamList["message"] = (cmd == "new")? "" : timer.message;
@@ -1057,36 +988,41 @@ std::string CNeutrinoYParser::func_bouquet_editor_main(CyhookHandler *hh, std::
if (hh->ParamList["selected"] != "")
selected = atoi(hh->ParamList["selected"].c_str());
int bouquetSize = (int) g_bouquetManager->Bouquets.size();
for (int i = 0; i < (int) g_bouquetManager->Bouquets.size(); i++) {
// List of all bouquets
CZapitClient::BouquetList AllBouquetList;
CZapitBouquet * bouquet = g_bouquetManager->Bouquets[i];
NeutrinoAPI->Zapit->getBouquets(AllBouquetList, true, true); // UTF-8
CZapitClient::BouquetList::iterator bouquet = AllBouquetList.begin();
char classname = ((i & 1) == 0) ? 'a' : 'b';
classname = (selected == (int) i + 1)?'c':classname;
unsigned int bouquetSize = AllBouquetList.size();
std::string akt = (selected == (int) (i + 1)) ? "<a name=\"akt\"></a>" : "";
for(; bouquet != AllBouquetList.end();bouquet++)
{
char classname = ((bouquet->bouquet_nr & 1) == 0) ? 'a' : 'b';
classname = (selected == (int) bouquet->bouquet_nr + 1)?'c':classname;
std::string akt = (selected == (int) (bouquet->bouquet_nr + 1)) ? "<a name=\"akt\"></a>" : "";
// lock/unlock
std::string lock_action = (bouquet->bLocked) ? "unlock" : "lock";
std::string lock_img = (bouquet->bLocked) ? "lock" : "unlock";
std::string lock_alt = (bouquet->bLocked) ? "entsperren" : "sperren";
std::string lock_action = (bouquet->locked) ? "unlock" : "lock";
std::string lock_img = (bouquet->locked) ? "lock" : "unlock";
std::string lock_alt = (bouquet->locked) ? "entsperren" : "sperren";
// hide/show
std::string hidden_action= (bouquet->bHidden) ? "show" : "hide";
std::string hidden_img = (bouquet->bHidden) ? "hidden" : "visible";
std::string hidden_alt = (bouquet->bHidden) ? "verstecken" : "anzeigen";
std::string hidden_action= (bouquet->hidden) ? "show" : "hide";
std::string hidden_img = (bouquet->hidden) ? "hidden" : "visible";
std::string hidden_alt = (bouquet->hidden) ? "verstecken" : "anzeigen";
// move down
std::string down_show = (i + 1 < bouquetSize) ? "visible" : "hidden";
std::string down_show = (bouquet->bouquet_nr + 1 < bouquetSize) ? "visible" : "hidden";
//move up
std::string up_show = (i > 0) ? "visible" : "hidden";
std::string up_show = (bouquet->bouquet_nr > 0) ? "visible" : "hidden";
// build from template
yresult += string_printf(para.c_str(), classname, akt.c_str(),
i + 1, lock_action.c_str(), lock_img.c_str(), lock_alt.c_str(), //lock
i + 1, hidden_action.c_str(), hidden_img.c_str(), hidden_alt.c_str(), //hhidden
i + 1, bouquet->Name.c_str(), bouquet->Name.c_str(), //link
i + 1, bouquet->Name.c_str(), //rename
i + 1, bouquet->Name.c_str(), //delete
down_show.c_str(), i + 1, //down arrow
up_show.c_str(), i + 1); //up arrow
bouquet->bouquet_nr + 1, lock_action.c_str(), lock_img.c_str(), lock_alt.c_str(), //lock
bouquet->bouquet_nr + 1, hidden_action.c_str(), hidden_img.c_str(), hidden_alt.c_str(), //hhidden
bouquet->bouquet_nr + 1, bouquet->name, bouquet->name, //link
bouquet->bouquet_nr + 1, bouquet->name, //rename
bouquet->bouquet_nr + 1, bouquet->name, //delete
down_show.c_str(), bouquet->bouquet_nr + 1, //down arrow
up_show.c_str(), bouquet->bouquet_nr + 1); //up arrow
}
return yresult;
}
@@ -1094,45 +1030,10 @@ std::string CNeutrinoYParser::func_bouquet_editor_main(CyhookHandler *hh, std::
//-------------------------------------------------------------------------
// func: Bouquet Edit
//-------------------------------------------------------------------------
std::string CNeutrinoYParser::func_set_bouquet_edit_form(CyhookHandler *hh, std::string /*para*/)
std::string CNeutrinoYParser::func_set_bouquet_edit_form(CyhookHandler *hh, std::string)
{
if (!(hh->ParamList["selected"].empty()))
{
int selected = atoi(hh->ParamList["selected"].c_str()) - 1;
int mode = NeutrinoAPI->Zapit->getMode();
ZapitChannelList* channels = mode == CZapitClient::MODE_TV ? &(g_bouquetManager->Bouquets[selected]->tvChannels) : &(g_bouquetManager->Bouquets[selected]->radioChannels);
for(int j = 0; j < (int) channels->size(); j++) {
hh->ParamList["bouquet_channels"] +=
string_printf("<option value=\""
PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
"\">%s</option>\n",
(*channels)[j]->channel_id,
(*channels)[j]->getName().c_str());
}
ZapitChannelList Channels;
Channels.clear();
if (mode == CZapitClient::MODE_RADIO) {
for (tallchans_iterator it = allchans.begin(); it != allchans.end(); it++)
if (it->second.getServiceType() == ST_DIGITAL_RADIO_SOUND_SERVICE)
Channels.push_back(&(it->second));
} else {
for (tallchans_iterator it = allchans.begin(); it != allchans.end(); it++)
if (it->second.getServiceType() != ST_DIGITAL_RADIO_SOUND_SERVICE)
Channels.push_back(&(it->second));
}
sort(Channels.begin(), Channels.end(), CmpChannelByChName());
for (int i = 0; i < (int) Channels.size(); i++) {
if (!g_bouquetManager->existsChannelInBouquet(selected, Channels[i]->channel_id)){
hh->ParamList["all_channels"] +=
string_printf("<option value=\""
PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
"\">%s</option>\n",
Channels[i]->channel_id,
Channels[i]->getName().c_str());
}
}
#if 0
CZapitClient::BouquetChannelList BChannelList;
CZapitClient::BouquetChannelList::iterator channels;
@@ -1162,7 +1063,6 @@ std::string CNeutrinoYParser::func_set_bouquet_edit_form(CyhookHandler *hh, std
channels->name);
}
}
#endif
return "";
}
else

View File

@@ -62,7 +62,7 @@ public:
virtual std::string YWeb_cgi_func(CyhookHandler *hh, std::string ycmd);
// virtual functions for HookHandler/Hook
virtual std::string getHookName(void) {return std::string("mod_NeutrinoYParser");}
virtual std::string getHookVersion(void) {return std::string("$Revision: 1.2 $");}
virtual std::string getHookVersion(void) {return std::string("$Revision: 1.1.2.1 $");}
virtual THandleStatus Hook_SendResponse(CyhookHandler *hh);
virtual THandleStatus Hook_ReadConfig(CConfigFile *Config, CStringList &ConfigList);
};