Remove erroneous assert() and modified so that existing EPG database and config is left in place.
This commit is contained in:
parent
8e1c6ab141
commit
68f4bfabdb
2 changed files with 8 additions and 5 deletions
11
src/epg.c
11
src/epg.c
|
@ -35,6 +35,10 @@
|
||||||
#include "htsmsg_binary.h"
|
#include "htsmsg_binary.h"
|
||||||
#include "epggrab.h"
|
#include "epggrab.h"
|
||||||
|
|
||||||
|
/* EPG database file */
|
||||||
|
#define EPG_DB_OLD "epgdb"
|
||||||
|
#define EPG_DB_NEW "epgdb.aps"
|
||||||
|
|
||||||
/* Broadcast hashing */
|
/* Broadcast hashing */
|
||||||
#define EPG_HASH_WIDTH 1024
|
#define EPG_HASH_WIDTH 1024
|
||||||
#define EPG_HASH_MASK (EPG_HASH_WIDTH - 1)
|
#define EPG_HASH_MASK (EPG_HASH_WIDTH - 1)
|
||||||
|
@ -159,7 +163,7 @@ static int _epg_write ( int fd, htsmsg_t *m )
|
||||||
if(ret) {
|
if(ret) {
|
||||||
tvhlog(LOG_ERR, "epg", "failed to store epg to disk");
|
tvhlog(LOG_ERR, "epg", "failed to store epg to disk");
|
||||||
close(fd);
|
close(fd);
|
||||||
hts_settings_remove("epgdb");
|
hts_settings_remove(EPG_DB_NEW);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -179,7 +183,7 @@ void epg_save ( void )
|
||||||
channel_t *ch;
|
channel_t *ch;
|
||||||
epggrab_stats_t stats;
|
epggrab_stats_t stats;
|
||||||
|
|
||||||
fd = hts_settings_open_file(1, "epgdb");
|
fd = hts_settings_open_file(1, EPG_DB_NEW);
|
||||||
|
|
||||||
memset(&stats, 0, sizeof(stats));
|
memset(&stats, 0, sizeof(stats));
|
||||||
if ( _epg_write_sect(fd, "brands") ) return;
|
if ( _epg_write_sect(fd, "brands") ) return;
|
||||||
|
@ -225,7 +229,8 @@ void epg_init ( void )
|
||||||
int old = 0;
|
int old = 0;
|
||||||
|
|
||||||
/* Map file to memory */
|
/* Map file to memory */
|
||||||
fd = hts_settings_open_file(0, "epgdb");
|
fd = hts_settings_open_file(0, EPG_DB_NEW);
|
||||||
|
if (fd < 0) fd = hts_settings_open_file(0, EPG_DB_OLD);
|
||||||
if ( fd < 0 ) {
|
if ( fd < 0 ) {
|
||||||
tvhlog(LOG_DEBUG, "epg", "database does not exist");
|
tvhlog(LOG_DEBUG, "epg", "database does not exist");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -656,8 +656,6 @@ static void _epggrab_load ( void )
|
||||||
|
|
||||||
/* Load settings */
|
/* Load settings */
|
||||||
if (!(m = hts_settings_load("epggrab/config"))) {
|
if (!(m = hts_settings_load("epggrab/config"))) {
|
||||||
printf("failed to load config\n");
|
|
||||||
assert(0);
|
|
||||||
if ((m = hts_settings_load("xmltv/config")))
|
if ((m = hts_settings_load("xmltv/config")))
|
||||||
old = 1;
|
old = 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue