mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-26 15:02:56 +02:00
mode xml epg delete direct into function
This commit is contained in:
@@ -449,7 +449,7 @@ bool readEventsFromFile(std::string &epgname, int &ev_count)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool readEventsFromXMLTV(std::string &epgname, int &ev_count)
|
||||
bool readEventsFromXMLTV(std::string &epgname, int &ev_count, bool delete_after)
|
||||
{
|
||||
xmlDocPtr event_parser = NULL;
|
||||
xmlNodePtr tv;
|
||||
@@ -563,6 +563,14 @@ bool readEventsFromXMLTV(std::string &epgname, int &ev_count)
|
||||
}
|
||||
|
||||
xmlFreeDoc(event_parser);
|
||||
|
||||
if (delete_after)
|
||||
{
|
||||
int ret = unlink(epgname.c_str());
|
||||
if (ret != 0)
|
||||
printf("Failed to delete file: %s\n", epgname.c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -712,10 +720,7 @@ void *insertEventsfromXMLTV(void * data)
|
||||
{
|
||||
if (!access(tmp_name.c_str(), R_OK))
|
||||
{
|
||||
readEventsFromXMLTV(tmp_name, ev_count);
|
||||
int ret = unlink(tmp_name.c_str());
|
||||
if (ret != 0)
|
||||
printf("Failed to delete file: %s\n", tmp_name.c_str());
|
||||
readEventsFromXMLTV(tmp_name, ev_count, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@@ -37,7 +37,7 @@
|
||||
void *insertEventsfromFile(void * data);
|
||||
void *insertEventsfromXMLTV(void * data);
|
||||
bool readEventsFromFile(std::string &epgname, int &ev_count);
|
||||
bool readEventsFromXMLTV(std::string &epgname, int &ev_count);
|
||||
bool readEventsFromXMLTV(std::string &epgname, int &ev_count, bool delete_after = false);
|
||||
bool readEventsFromDir(std::string &epgdir, int &ev_count);
|
||||
void writeEventsToFile(const char *epgdir);
|
||||
t_channel_id getepgid(std::string epg_name);
|
||||
|
Reference in New Issue
Block a user