Handle empty warning descriptors
This commit is contained in:
parent
b3ea751561
commit
b55c134eed
128
main.c
128
main.c
|
@ -21,7 +21,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
int debug = 0;
|
||||
const char *version = "1.8";
|
||||
const char *version = "1.9";
|
||||
unsigned long sysopts = 0;
|
||||
unsigned long filterflags = 0;
|
||||
|
||||
|
@ -75,6 +75,47 @@ syntax()
|
|||
#define DECOMPRESS(str, len) \
|
||||
if (str && *(str) == 0x1f) uncompress_epg(&(str), &(len))
|
||||
|
||||
int
|
||||
copy_freesat_to_non_freesat(sqlite3 * db)
|
||||
{
|
||||
int rc;
|
||||
|
||||
ExecSQLStatement(
|
||||
"attach database '/opt/webif/plugin/epg/epgsettings.db' as epgsettings",
|
||||
db
|
||||
);
|
||||
|
||||
ExecSQLStatement("BEGIN;", db);
|
||||
|
||||
rc = ExecSQLStatementRowCount(
|
||||
"insert into epg "
|
||||
"select epgmappings.nonfreesatserviceid, "
|
||||
"eventid, "
|
||||
"starttime, "
|
||||
"duration, "
|
||||
"encrypted, "
|
||||
"name, "
|
||||
"descr, "
|
||||
"warning, "
|
||||
"contentcode, "
|
||||
"contenttype, "
|
||||
"ECRID, "
|
||||
"SCRID, "
|
||||
"RCRID "
|
||||
"from epgsettings.epgmappings join epg on epg.serviceid = epgsettings.epgmappings.freesatserviceid "
|
||||
"except "
|
||||
"select epg.* "
|
||||
"from epgsettings.epgmappings join epg on epg.serviceid = epgsettings.epgmappings.freesatserviceid",
|
||||
db
|
||||
);
|
||||
|
||||
ExecSQLStatement("COMMIT;", db);
|
||||
|
||||
printf("%d EPG event(s) copied from Freesat to non-Freesat\n", rc);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
unsigned int NeedToProcess (char * epgFile)
|
||||
{
|
||||
struct stat epgstat;
|
||||
|
@ -196,28 +237,36 @@ void EscapeChars(char ** InString, unsigned int *Len)
|
|||
unsigned int i,j;
|
||||
int charcount=0;
|
||||
char * originalstring;
|
||||
|
||||
originalstring=*InString;
|
||||
if (strchr(*InString, '\'')!=NULL) {
|
||||
/* at least one ' character - process string */
|
||||
/* count them so we know how much space to allocate */
|
||||
for (i=0; i<*Len; i++) {
|
||||
if (originalstring[i]==0x27) {
|
||||
charcount++;
|
||||
|
||||
if (*Len != 0)
|
||||
{
|
||||
originalstring=*InString;
|
||||
if (strchr(*InString, '\'')!=NULL) {
|
||||
/* at least one ' character - process string */
|
||||
/* count them so we know how much space to allocate */
|
||||
for (i=0; i<*Len; i++) {
|
||||
if (originalstring[i]==0x27) {
|
||||
charcount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
new = (char *) malloc(sizeof(char) * (*Len + charcount + 1));
|
||||
j=0;
|
||||
for (i=0; i<*Len; i++) {
|
||||
new[j++]=originalstring[i];
|
||||
if (originalstring[i]==0x27)
|
||||
new[j++]=0x27;
|
||||
}
|
||||
new[j]='\0';
|
||||
new = (char *) malloc(sizeof(char) * (*Len + charcount + 1));
|
||||
j=0;
|
||||
for (i=0; i<*Len; i++) {
|
||||
new[j++]=originalstring[i];
|
||||
if (originalstring[i]==0x27)
|
||||
new[j++]=0x27;
|
||||
}
|
||||
new[j]='\0';
|
||||
|
||||
free(*InString);
|
||||
*InString = new;
|
||||
*Len = strlen(new);
|
||||
}
|
||||
} else {
|
||||
new = (char *) malloc(1);
|
||||
new[0] = '\0';
|
||||
free(*InString);
|
||||
*InString = new;
|
||||
*Len = strlen(new);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -572,47 +621,6 @@ dump(struct epg *epg __attribute__((unused)),
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
copy_freesat_to_non_freesat(sqlite3 * db)
|
||||
{
|
||||
int rc;
|
||||
|
||||
ExecSQLStatement(
|
||||
"attach database '/opt/webif/plugin/epg/epgsettings.db' as epgsettings",
|
||||
db
|
||||
);
|
||||
|
||||
ExecSQLStatement("BEGIN;", db);
|
||||
|
||||
rc = ExecSQLStatementRowCount(
|
||||
"insert into epg "
|
||||
"select epgmappings.nonfreesatserviceid, "
|
||||
"eventid, "
|
||||
"starttime, "
|
||||
"duration, "
|
||||
"encrypted, "
|
||||
"name, "
|
||||
"descr, "
|
||||
"warning, "
|
||||
"contentcode, "
|
||||
"contenttype, "
|
||||
"ECRID, "
|
||||
"SCRID, "
|
||||
"RCRID "
|
||||
"from epgsettings.epgmappings join epg on epg.serviceid = epgsettings.epgmappings.freesatserviceid "
|
||||
"except "
|
||||
"select epg.* "
|
||||
"from epgsettings.epgmappings join epg on epg.serviceid = epgsettings.epgmappings.freesatserviceid",
|
||||
db
|
||||
);
|
||||
|
||||
ExecSQLStatement("COMMIT;", db);
|
||||
|
||||
printf("%d EPG event(s) copied from Freesat to non-Freesat\n", rc);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
void
|
||||
search(struct epg *epg __attribute__((unused)),
|
||||
struct section *s, struct data *d, struct descriptor **ds,
|
||||
|
|
Loading…
Reference in New Issue