Remove erroneous assert() and modified so that existing EPG database and config is left in place.

This commit is contained in:
Adam Sutton 2012-06-16 20:20:46 +01:00
parent db04c900f8
commit dde3d12189
2 changed files with 8 additions and 5 deletions

View file

@ -35,6 +35,10 @@
#include "htsmsg_binary.h"
#include "epggrab.h"
/* EPG database file */
#define EPG_DB_OLD "epgdb"
#define EPG_DB_NEW "epgdb.aps"
/* Broadcast hashing */
#define EPG_HASH_WIDTH 1024
#define EPG_HASH_MASK (EPG_HASH_WIDTH - 1)
@ -159,7 +163,7 @@ static int _epg_write ( int fd, htsmsg_t *m )
if(ret) {
tvhlog(LOG_ERR, "epg", "failed to store epg to disk");
close(fd);
hts_settings_remove("epgdb");
hts_settings_remove(EPG_DB_NEW);
}
return ret;
}
@ -179,7 +183,7 @@ void epg_save ( void )
channel_t *ch;
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));
if ( _epg_write_sect(fd, "brands") ) return;
@ -225,7 +229,8 @@ void epg_init ( void )
int old = 0;
/* 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 ) {
tvhlog(LOG_DEBUG, "epg", "database does not exist");
return;

View file

@ -656,8 +656,6 @@ static void _epggrab_load ( void )
/* Load settings */
if (!(m = hts_settings_load("epggrab/config"))) {
printf("failed to load config\n");
assert(0);
if ((m = hts_settings_load("xmltv/config")))
old = 1;
}