mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-03 10:51:05 +02:00
Merge branch 'uncool/dvbsi++' commit c6136d612f
Conflicts:
src/gui/widget/hintboxext.cpp
src/nhttpd/tuxboxapi/coolstream/controlapi.cpp
Origin commit data
------------------
Branch: ni/coolstream
Commit: f8f5467fdb
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2012-12-30 (Sun, 30 Dec 2012)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -34,18 +34,18 @@
|
||||
#include <system/configure_network.h>
|
||||
#include <cs_api.h>
|
||||
#include <global.h>
|
||||
#include "gui/plugins.h"//for relodplugins
|
||||
#include <gui/plugins.h>//for relodplugins
|
||||
#include <neutrino.h>
|
||||
#ifdef SCREENSHOT
|
||||
#include <driver/screenshot.h>
|
||||
#endif
|
||||
#include "gui/rc_lock.h"
|
||||
#include <gui/rc_lock.h>
|
||||
|
||||
// yhttpd
|
||||
#include "yhttpd.h"
|
||||
#include "ytypes_globals.h"
|
||||
#include "ylogging.h"
|
||||
#include "helper.h"
|
||||
#include <yhttpd.h>
|
||||
#include <ytypes_globals.h>
|
||||
#include <ylogging.h>
|
||||
#include <helper.h>
|
||||
// nhttpd
|
||||
#include "neutrinoapi.h"
|
||||
#include "controlapi.h"
|
||||
@@ -165,6 +165,7 @@ const CControlAPI::TyCgiCall CControlAPI::yCgiCallList[]=
|
||||
{"epg", &CControlAPI::EpgCGI, ""},
|
||||
{"zapto", &CControlAPI::ZaptoCGI, "text/plain"},
|
||||
{"getonidsid", &CControlAPI::GetChannel_IDCGI, "text/plain"},
|
||||
{"currenttpchannels", &CControlAPI::GetTPChannel_IDCGI, "text/plain"},
|
||||
// boxcontrol - system
|
||||
{"standby", &CControlAPI::StandbyCGI, "text/plain"},
|
||||
{"shutdown", &CControlAPI::ShutdownCGI, "text/plain"},
|
||||
@@ -224,7 +225,6 @@ const CControlAPI::TyCgiCall CControlAPI::yCgiCallList[]=
|
||||
void CControlAPI::Execute(CyhookHandler *hh)
|
||||
{
|
||||
int index = -1;
|
||||
std::string yresult;
|
||||
std::string filename = hh->UrlData["filename"];
|
||||
|
||||
log_level_printf(4,"ControlAPI.Execute filename:(%s)\n",filename.c_str());
|
||||
@@ -536,6 +536,12 @@ void CControlAPI::GetChannel_IDCGI(CyhookHandler *hh)
|
||||
hh->printf("%x%04x%04x\n",current_pids.tsid, current_pids.onid, current_pids.sid);
|
||||
}
|
||||
|
||||
// get actual channel_id
|
||||
void CControlAPI::GetTPChannel_IDCGI(CyhookHandler *hh)
|
||||
{
|
||||
SendChannelList(hh, true);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void CControlAPI::MessageCGI(CyhookHandler *hh)
|
||||
{
|
||||
@@ -566,7 +572,7 @@ void CControlAPI::MessageCGI(CyhookHandler *hh)
|
||||
|
||||
if (event != 0)
|
||||
{
|
||||
message=decodeString(message);
|
||||
//message=decodeString(message);
|
||||
NeutrinoAPI->EventServer->sendEvent(event, CEventServer::INITID_HTTPD, (void *) message.c_str(), message.length() + 1);
|
||||
hh->SendOk();
|
||||
}
|
||||
@@ -896,7 +902,6 @@ void CControlAPI::ChannellistCGI(CyhookHandler *hh)
|
||||
std::string CControlAPI::_GetBouquetActualEPGItem(CyhookHandler *hh, CZapitChannel * channel) {
|
||||
std::string result, firstEPG, secondEPG = "";
|
||||
t_channel_id current_channel = CZapit::getInstance()->GetCurrentChannelID();
|
||||
int percentage = 100;
|
||||
std::string timestr;
|
||||
|
||||
CSectionsdClient::responseGetCurrentNextInfoChannelID currentNextInfo;
|
||||
@@ -904,6 +909,7 @@ std::string CControlAPI::_GetBouquetActualEPGItem(CyhookHandler *hh, CZapitChann
|
||||
event = NeutrinoAPI->ChannelListEvents[channel->channel_id];
|
||||
|
||||
if (event) {
|
||||
int percentage = 100;
|
||||
if (event->duration > 0)
|
||||
percentage = 100 * (time(NULL) - event->startTime) / event->duration;
|
||||
CEitManager::getInstance()->getCurrentNextServiceKey(channel->channel_id, currentNextInfo);
|
||||
@@ -1370,7 +1376,7 @@ void CControlAPI::EpgCGI(CyhookHandler *hh) {
|
||||
else if (hh->ParamList.empty() || hh->ParamList["1"] == "ext") {
|
||||
hh->SetHeader(HTTP_OK, "text/plain; charset=UTF-8");
|
||||
bool isExt = (hh->ParamList["1"] == "ext");
|
||||
CChannelEvent *event;
|
||||
CChannelEvent *event = NULL;
|
||||
NeutrinoAPI->GetChannelEvents();
|
||||
|
||||
int mode = NeutrinoAPI->Zapit->getMode();
|
||||
@@ -1393,7 +1399,7 @@ void CControlAPI::EpgCGI(CyhookHandler *hh) {
|
||||
// query details for given eventid
|
||||
else if (hh->ParamList["eventid"] != "") {
|
||||
//special epg query
|
||||
uint64_t epgid;
|
||||
uint64_t epgid = 0;
|
||||
sscanf(hh->ParamList["eventid"].c_str(), "%" SCNu64 "", &epgid);
|
||||
CShortEPGData epg;
|
||||
if (CEitManager::getInstance()->getEPGidShort(epgid, &epg)) {
|
||||
@@ -1404,8 +1410,8 @@ void CControlAPI::EpgCGI(CyhookHandler *hh) {
|
||||
}
|
||||
else if (hh->ParamList["eventid2fsk"] != "") {
|
||||
if (hh->ParamList["starttime"] != "") {
|
||||
uint64_t epgid;
|
||||
time_t starttime;
|
||||
uint64_t epgid = 0;
|
||||
time_t starttime = 0;
|
||||
sscanf(hh->ParamList["fskid"].c_str(), "%" SCNu64 "", &epgid);
|
||||
sscanf(hh->ParamList["starttime"].c_str(), "%lu", &starttime);
|
||||
CEPGData longepg;
|
||||
@@ -1418,7 +1424,7 @@ void CControlAPI::EpgCGI(CyhookHandler *hh) {
|
||||
}
|
||||
// list EPG for channel id
|
||||
else if (!(hh->ParamList["id"].empty())) {
|
||||
t_channel_id channel_id;
|
||||
t_channel_id channel_id = 0;
|
||||
sscanf(hh->ParamList["id"].c_str(), SCANF_CHANNEL_ID_TYPE, &channel_id);
|
||||
CEitManager::getInstance()->getEventsServiceKey(channel_id, NeutrinoAPI->eList);
|
||||
CChannelEventList::iterator eventIterator;
|
||||
@@ -1435,7 +1441,7 @@ void CControlAPI::EpgCGI(CyhookHandler *hh) {
|
||||
// list EPG for channelID 64Bit
|
||||
else {
|
||||
//eventlist for a chan
|
||||
t_channel_id channel_id;
|
||||
t_channel_id channel_id = 0;
|
||||
sscanf(hh->ParamList["1"].c_str(), SCANF_CHANNEL_ID_TYPE, &channel_id);
|
||||
SendEventList(hh, channel_id);
|
||||
}
|
||||
@@ -1604,17 +1610,22 @@ void CControlAPI::SendEventList(CyhookHandler *hh, t_channel_id channel_id)
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void CControlAPI::SendChannelList(CyhookHandler *hh)
|
||||
void CControlAPI::SendChannelList(CyhookHandler *hh, bool currentTP)
|
||||
{
|
||||
t_channel_id current_channel = 0;
|
||||
if(currentTP){
|
||||
current_channel = CZapit::getInstance()->GetCurrentChannelID();
|
||||
current_channel=(current_channel>>16);
|
||||
}
|
||||
|
||||
int mode = NeutrinoAPI->Zapit->getMode();
|
||||
hh->SetHeader(HTTP_OK, "text/plain; charset=UTF-8");
|
||||
CBouquetManager::ChannelIterator cit = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->radioChannelsBegin() : g_bouquetManager->tvChannelsBegin();
|
||||
for (; !(cit.EndOfChannels()); cit++) {
|
||||
CZapitChannel * channel = *cit;
|
||||
hh->printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
|
||||
" %s\n",
|
||||
channel->channel_id,
|
||||
channel->getName().c_str());
|
||||
if(!currentTP || (channel->channel_id >>16) == current_channel){
|
||||
hh->printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS " %s\n", channel->channel_id, channel->getName().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2012,10 +2023,9 @@ void CControlAPI::SendTimersXML(CyhookHandler *hh)
|
||||
void CControlAPI::YWebCGI(CyhookHandler *hh)
|
||||
{
|
||||
bool status=true;
|
||||
int para;
|
||||
if (hh->ParamList["video_stream_pids"] != "")
|
||||
{
|
||||
para=0;
|
||||
int para=0;
|
||||
sscanf( hh->ParamList["video_stream_pids"].c_str(), "%d", ¶);
|
||||
YWeb_SendVideoStreamingPids(hh, para);
|
||||
}
|
||||
@@ -2078,7 +2088,7 @@ std::string CControlAPI::YexecuteScript(CyhookHandler *, std::string cmd)
|
||||
// get file
|
||||
std::string fullfilename;
|
||||
script += ".sh"; //add script extention
|
||||
char cwd[255];
|
||||
char cwd[255]={0};
|
||||
getcwd(cwd, 254);
|
||||
|
||||
for (unsigned int i=0; i<PLUGIN_DIR_COUNT && !found; i++)
|
||||
@@ -2146,13 +2156,16 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
tnull = time(NULL);
|
||||
struct tm *alarmTime=localtime(&tnull);
|
||||
alarmTime->tm_sec = 0;
|
||||
strptime(hh->ParamList["alDate"].c_str(), "%d.%m.%Y", alarmTime);
|
||||
if(sscanf(hh->ParamList["alDate"].c_str(),"%2d.%2d.%4d",&(alarmTime->tm_mday), &(alarmTime->tm_mon), &(alarmTime->tm_year)) == 3)
|
||||
{
|
||||
alarmTime->tm_mon -= 1;
|
||||
alarmTime->tm_year -= 1900;
|
||||
}
|
||||
|
||||
// Alarm Time - Format exact! HH:MM
|
||||
if(hh->ParamList["alTime"] != "")
|
||||
strptime(hh->ParamList["alTime"].c_str(), "%H:%M", alarmTime);
|
||||
sscanf(hh->ParamList["alTime"].c_str(),"%2d.%2d",&(alarmTime->tm_hour), &(alarmTime->tm_min));
|
||||
alHour = alarmTime->tm_hour;
|
||||
|
||||
correctTime(alarmTime);
|
||||
alarmTimeT = mktime(alarmTime);
|
||||
announceTimeT = alarmTimeT;
|
||||
@@ -2160,12 +2173,15 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
stopTime->tm_sec = 0;
|
||||
// Stop Time - Format exact! HH:MM
|
||||
if(hh->ParamList["stTime"] != "")
|
||||
strptime(hh->ParamList["stTime"].c_str(), "%H:%M", stopTime);
|
||||
sscanf(hh->ParamList["stTime"].c_str(),"%2d.%2d",&(stopTime->tm_hour), &(stopTime->tm_min));
|
||||
|
||||
// Stop Date - Format exact! DD.MM.YYYY
|
||||
if(hh->ParamList["stDate"] != "")
|
||||
strptime(hh->ParamList["stDate"].c_str(), "%d.%m.%Y", stopTime);
|
||||
stopTime->tm_sec = 0;
|
||||
if(sscanf(hh->ParamList["stDate"].c_str(),"%2d.%2d.%4d",&(stopTime->tm_mday), &(stopTime->tm_mon), &(stopTime->tm_year)) == 3)
|
||||
{
|
||||
stopTime->tm_mon -= 1;
|
||||
stopTime->tm_year -= 1900;
|
||||
}
|
||||
correctTime(stopTime);
|
||||
stopTimeT = mktime(stopTime);
|
||||
if(hh->ParamList["stDate"] == "" && alHour > stopTime->tm_hour)
|
||||
@@ -2227,9 +2243,9 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
rep = (CTimerd::CTimerEventRepeat) atoi(hh->ParamList["rep"].c_str());
|
||||
else // default: no repeat
|
||||
rep = (CTimerd::CTimerEventRepeat)0;
|
||||
|
||||
if(((int)rep) >= ((int)CTimerd::TIMERREPEAT_WEEKDAYS) && hh->ParamList["wd"] != "")
|
||||
NeutrinoAPI->Timerd->getWeekdaysFromStr(&rep, hh->ParamList["wd"].c_str());
|
||||
|
||||
// apids
|
||||
bool changeApids=false;
|
||||
unsigned char apids=0;
|
||||
@@ -2256,6 +2272,7 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
apids |= TIMERD_APIDS_AC3;
|
||||
}
|
||||
}
|
||||
|
||||
CTimerd::RecordingInfo recinfo;
|
||||
CTimerd::EventInfo eventinfo;
|
||||
eventinfo.epgID = 0;
|
||||
@@ -2266,8 +2283,8 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
// channel by Id or name
|
||||
if(hh->ParamList["channel_id"] != "")
|
||||
sscanf(hh->ParamList["channel_id"].c_str(),
|
||||
SCANF_CHANNEL_ID_TYPE,
|
||||
&eventinfo.channel_id);
|
||||
SCANF_CHANNEL_ID_TYPE,
|
||||
&eventinfo.channel_id);
|
||||
else
|
||||
eventinfo.channel_id = NeutrinoAPI->ChannelNameToChannelId(hh->ParamList["channel_name"]);
|
||||
|
||||
@@ -2290,7 +2307,7 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
CConfigFile *Config = new CConfigFile(',');
|
||||
Config->loadConfig(NEUTRINO_CONFIGFILE);
|
||||
_rec_dir = Config->getString("network_nfs_recordingdir", "/mnt/filme");
|
||||
delete Config;//Memory leak: Config
|
||||
delete Config;
|
||||
}
|
||||
if(changeApids)
|
||||
eventinfo.apids = apids;
|
||||
@@ -2318,7 +2335,13 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
if(hh->ParamList["id"] != "")
|
||||
{
|
||||
unsigned modyId = atoi(hh->ParamList["id"].c_str());
|
||||
NeutrinoAPI->Timerd->removeTimerEvent(modyId);
|
||||
if(type == CTimerd::TIMER_RECORD)
|
||||
NeutrinoAPI->Timerd->modifyRecordTimerEvent(modyId, announceTimeT, alarmTimeT, stopTimeT, rep,repCount,_rec_dir.c_str());
|
||||
else
|
||||
NeutrinoAPI->Timerd->modifyTimerEvent(modyId, announceTimeT, alarmTimeT, stopTimeT, rep,repCount);
|
||||
// NeutrinoAPI->Timerd->removeTimerEvent(modyId);
|
||||
if(changeApids)
|
||||
NeutrinoAPI->Timerd->modifyTimerAPid(modyId,apids);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2336,15 +2359,18 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
real_alarmTimeT -= pre;
|
||||
}
|
||||
|
||||
for(; timer != timerlist.end(); ++timer)
|
||||
for(; timer != timerlist.end();++timer)
|
||||
if(timer->alarmTime == real_alarmTimeT)
|
||||
{
|
||||
NeutrinoAPI->Timerd->removeTimerEvent(timer->eventID);
|
||||
break;
|
||||
}
|
||||
NeutrinoAPI->Timerd->addTimerEvent(type,data,announceTimeT,alarmTimeT,stopTimeT,rep,repCount);
|
||||
}
|
||||
}
|
||||
NeutrinoAPI->Timerd->addTimerEvent(type,data,announceTimeT,alarmTimeT,stopTimeT,rep,repCount);
|
||||
else
|
||||
NeutrinoAPI->Timerd->addTimerEvent(type,data,announceTimeT,alarmTimeT,stopTimeT,rep,repCount);
|
||||
|
||||
hh->SendOk();
|
||||
}
|
||||
//-------------------------------------------------------------------------
|
||||
@@ -2395,10 +2421,8 @@ void CControlAPI::moveBouquetCGI(CyhookHandler *hh)
|
||||
//-------------------------------------------------------------------------
|
||||
void CControlAPI::deleteBouquetCGI(CyhookHandler *hh)
|
||||
{
|
||||
int selected = -1;
|
||||
|
||||
if (hh->ParamList["selected"] != "") {
|
||||
selected = atoi(hh->ParamList["selected"].c_str());
|
||||
int selected = atoi(hh->ParamList["selected"].c_str());
|
||||
NeutrinoAPI->Zapit->deleteBouquet(selected - 1);
|
||||
hh->SendOk();
|
||||
}
|
||||
@@ -2485,7 +2509,7 @@ void CControlAPI::updateBouquetCGI(CyhookHandler *hh)
|
||||
// host : (optional) ip of dbox
|
||||
void CControlAPI::build_live_url(CyhookHandler *hh)
|
||||
{
|
||||
std::string xpids,port,yresult;
|
||||
std::string xpids;
|
||||
int mode = NeutrinoAPI->Zapit->getMode();
|
||||
|
||||
if ( mode == CZapitClient::MODE_TV)
|
||||
@@ -2741,18 +2765,13 @@ void CControlAPI::FileCGI(CyhookHandler *hh) {
|
||||
|
||||
if (hh->ParamList["action"] == "list") { // directory list: action=list&path=<path>
|
||||
DIR *dirp;
|
||||
struct dirent*entry;
|
||||
struct stat statbuf;
|
||||
struct passwd *pwd;
|
||||
struct group *grp;
|
||||
struct tm *tm;
|
||||
char datestring[256];
|
||||
|
||||
TOutType outType = hh->outStart();
|
||||
|
||||
std::string path = hh->ParamList["path"];
|
||||
if ((dirp = opendir(path.c_str()))) {
|
||||
bool isFirstLine = true;
|
||||
struct dirent *entry;
|
||||
while ((entry = readdir(dirp))) {
|
||||
std::string item = "";
|
||||
item += hh->outPair("name",
|
||||
@@ -2773,6 +2792,7 @@ void CControlAPI::FileCGI(CyhookHandler *hh) {
|
||||
std::string fullname = path + entry->d_name;
|
||||
item += hh->outPair("fullname", hh->outValue(fullname), true);
|
||||
|
||||
struct stat statbuf;
|
||||
if (stat(fullname.c_str(), &statbuf) != -1) {
|
||||
item
|
||||
+= hh->outPair(
|
||||
@@ -2786,6 +2806,7 @@ void CControlAPI::FileCGI(CyhookHandler *hh) {
|
||||
string_printf("%d", statbuf.st_nlink), true);
|
||||
|
||||
/* Print out owner's name if it is found using getpwuid(). */
|
||||
struct passwd *pwd;
|
||||
if ((pwd = getpwuid(statbuf.st_uid)) != NULL) {
|
||||
item += hh->outPair("user", pwd->pw_name, true);
|
||||
}
|
||||
@@ -2794,6 +2815,7 @@ void CControlAPI::FileCGI(CyhookHandler *hh) {
|
||||
string_printf("%d", statbuf.st_uid), true);
|
||||
}
|
||||
/* Print out group name if it is found using getgrgid(). */
|
||||
struct group *grp;
|
||||
if ((grp = getgrgid(statbuf.st_gid)) != NULL)
|
||||
item += hh->outPair("group", grp->gr_name, true);
|
||||
else {
|
||||
@@ -2804,7 +2826,8 @@ void CControlAPI::FileCGI(CyhookHandler *hh) {
|
||||
item += hh->outPair("size",
|
||||
string_printf("%jd", (intmax_t) statbuf.st_size),
|
||||
true);
|
||||
tm = localtime(&statbuf.st_mtime);
|
||||
struct tm *tm = localtime(&statbuf.st_mtime);
|
||||
char datestring[256] = {0};
|
||||
/* Get localized date string. */
|
||||
strftime(datestring, sizeof(datestring),
|
||||
nl_langinfo(D_T_FMT), tm);
|
||||
|
Reference in New Issue
Block a user