mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-26 15:02:56 +02:00
- eitd/sectionsdclient: unify new code and call it as it is ... it is XMLTV; ...
fix another compiler warning: the use of `tmpnam' is dangerous Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
@@ -67,7 +67,7 @@ struct sectionsd
|
||||
|
||||
setConfig, // commandSetConfig
|
||||
|
||||
readSIfromIPTVXML, // commandReadSIfromIPTVXML
|
||||
readSIfromXMLTV, // commandReadSIfromXMLTV
|
||||
|
||||
numberOfCommands // <- no actual command, end of command marker
|
||||
};
|
||||
|
@@ -194,9 +194,9 @@ void CSectionsdClient::readSIfromXML(const char * epgxmlname)
|
||||
close_connection();
|
||||
}
|
||||
|
||||
void CSectionsdClient::readSIfromIPTVXML(const char * url)
|
||||
void CSectionsdClient::readSIfromXMLTV(const char * url)
|
||||
{
|
||||
send(sectionsd::readSIfromIPTVXML, (char*) url, strlen(url));
|
||||
send(sectionsd::readSIfromXMLTV, (char*) url, strlen(url));
|
||||
|
||||
readResponse();
|
||||
close_connection();
|
||||
|
@@ -200,7 +200,7 @@ class CSectionsdClient : private CBasicClient
|
||||
|
||||
void readSIfromXML(const char * epgxmlname);
|
||||
|
||||
void readSIfromIPTVXML(const char * url);
|
||||
void readSIfromXMLTV(const char * url);
|
||||
|
||||
void writeSI2XML(const char * epgxmlname);
|
||||
|
||||
|
@@ -1238,9 +1238,9 @@ static void commandReadSIfromXML(int connfd, char *data, const unsigned dataLeng
|
||||
pthread_attr_destroy(&attr);
|
||||
}
|
||||
|
||||
static void commandReadSIfromIPTVXML(int connfd, char *data, const unsigned dataLength)
|
||||
static void commandReadSIfromXMLTV(int connfd, char *data, const unsigned dataLength)
|
||||
{
|
||||
pthread_t thrInsertIPTV;
|
||||
pthread_t thrInsertXMLTV;
|
||||
|
||||
sendEmptyResponse(connfd, NULL, 0);
|
||||
|
||||
@@ -1256,7 +1256,7 @@ static void commandReadSIfromIPTVXML(int connfd, char *data, const unsigned data
|
||||
pthread_attr_init(&attr);
|
||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
||||
|
||||
if (pthread_create (&thrInsertIPTV, &attr, insertEventsfromHttp, (void *)url_tmp.c_str() ))
|
||||
if (pthread_create (&thrInsertXMLTV, &attr, insertEventsfromXMLTV, (void *)url_tmp.c_str() ))
|
||||
{
|
||||
perror("sectionsd: pthread_create()");
|
||||
}
|
||||
@@ -1298,7 +1298,7 @@ static s_cmd_table connectionCommands[sectionsd::numberOfCommands] = {
|
||||
{ commandReadSIfromXML, "commandReadSIfromXML" },
|
||||
{ commandWriteSI2XML, "commandWriteSI2XML" },
|
||||
{ commandSetConfig, "commandSetConfig" },
|
||||
{ commandReadSIfromIPTVXML, "commandReadSIfromIPTVXML" },
|
||||
{ commandReadSIfromXMLTV, "commandReadSIfromXMLTV" },
|
||||
};
|
||||
|
||||
bool sectionsd_parse_command(CBasicMessage::Header &rmsg, int connfd)
|
||||
|
@@ -449,7 +449,7 @@ bool readEventsFromFile(std::string &epgname, int &ev_count)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool readEventsFromHttpFile(std::string &epgname, int &ev_count)
|
||||
bool readEventsFromXMLTV(std::string &epgname, int &ev_count)
|
||||
{
|
||||
xmlDocPtr event_parser = NULL;
|
||||
xmlNodePtr tv;
|
||||
@@ -633,7 +633,7 @@ void *insertEventsfromFile(void * data)
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
void *insertEventsfromHttp(void * data)
|
||||
void *insertEventsfromXMLTV(void * data)
|
||||
{
|
||||
set_threadname(__func__);
|
||||
reader_ready=false;
|
||||
@@ -644,17 +644,18 @@ void *insertEventsfromHttp(void * data)
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
std::string url = (char *) data;
|
||||
std::string tmp_name = tmpnam (NULL);
|
||||
std::string url_ext = getFileExt(url);
|
||||
|
||||
std::string tmp_name = "/tmp/.xmltv";
|
||||
tmp_name = tmp_name + "." + url_ext;
|
||||
|
||||
int64_t now = time_monotonic_ms();
|
||||
|
||||
if (url.compare(0,1,"/") == 0)
|
||||
readEventsFromHttpFile(url, ev_count);
|
||||
else if (::downloadUrl(url,tmp_name))
|
||||
if (url.compare(0, 1, "/") == 0)
|
||||
readEventsFromXMLTV(url, ev_count);
|
||||
else if (::downloadUrl(url, tmp_name))
|
||||
{
|
||||
readEventsFromHttpFile(tmp_name, ev_count);
|
||||
readEventsFromXMLTV(tmp_name, ev_count);
|
||||
remove(tmp_name.c_str());
|
||||
}
|
||||
else
|
||||
|
@@ -35,9 +35,9 @@
|
||||
#include <zapit/types.h>
|
||||
|
||||
void *insertEventsfromFile(void * data);
|
||||
void *insertEventsfromHttp(void * data);
|
||||
void *insertEventsfromXMLTV(void * data);
|
||||
bool readEventsFromFile(std::string &epgname, int &ev_count);
|
||||
bool readEventsFromHttpFile(std::string &epgname, int &ev_count);
|
||||
bool readEventsFromXMLTV(std::string &epgname, int &ev_count);
|
||||
bool readEventsFromDir(std::string &epgdir, int &ev_count);
|
||||
void writeEventsToFile(const char *epgdir);
|
||||
t_channel_id getepgid(std::string epg_name);
|
||||
|
@@ -2584,7 +2584,7 @@ TIMER_STOP("################################## after all #######################
|
||||
}
|
||||
|
||||
for (std::list<std::string>::iterator it = g_settings.webepg_xml.begin(); it != g_settings.webepg_xml.end(); ++it)
|
||||
g_Sectionsd->readSIfromIPTVXML((*it).c_str());
|
||||
g_Sectionsd->readSIfromXMLTV((*it).c_str());
|
||||
|
||||
RealRun();
|
||||
ExitRun(g_info.hw_caps->can_shutdown);
|
||||
|
Reference in New Issue
Block a user