mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 15:32:59 +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;
|
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;
|
xmlDocPtr event_parser = NULL;
|
||||||
xmlNodePtr tv;
|
xmlNodePtr tv;
|
||||||
@@ -563,6 +563,14 @@ bool readEventsFromXMLTV(std::string &epgname, int &ev_count)
|
|||||||
}
|
}
|
||||||
|
|
||||||
xmlFreeDoc(event_parser);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -712,10 +720,7 @@ void *insertEventsfromXMLTV(void * data)
|
|||||||
{
|
{
|
||||||
if (!access(tmp_name.c_str(), R_OK))
|
if (!access(tmp_name.c_str(), R_OK))
|
||||||
{
|
{
|
||||||
readEventsFromXMLTV(tmp_name, ev_count);
|
readEventsFromXMLTV(tmp_name, ev_count, true);
|
||||||
int ret = unlink(tmp_name.c_str());
|
|
||||||
if (ret != 0)
|
|
||||||
printf("Failed to delete file: %s\n", tmp_name.c_str());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -37,7 +37,7 @@
|
|||||||
void *insertEventsfromFile(void * data);
|
void *insertEventsfromFile(void * data);
|
||||||
void *insertEventsfromXMLTV(void * data);
|
void *insertEventsfromXMLTV(void * data);
|
||||||
bool readEventsFromFile(std::string &epgname, int &ev_count);
|
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);
|
bool readEventsFromDir(std::string &epgdir, int &ev_count);
|
||||||
void writeEventsToFile(const char *epgdir);
|
void writeEventsToFile(const char *epgdir);
|
||||||
t_channel_id getepgid(std::string epg_name);
|
t_channel_id getepgid(std::string epg_name);
|
||||||
|
Reference in New Issue
Block a user