mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2024-12-24 20:01:42 +00:00
add -xmltvonlycurrent option
This commit is contained in:
parent
454024808d
commit
c873ff6a06
@ -62,6 +62,7 @@ void init_options (struct ccx_s_options *options)
|
||||
options->xmltv=0; // 1 = full output. 2 = live output. 3 = both
|
||||
options->xmltvliveinterval=10; // interval in seconds between writting xmltv output files in live mode
|
||||
options->xmltvoutputinterval=0; // interval in seconds between writting xmltv full file output
|
||||
options->xmltvonlycurrent=0; // 0 off 1 on
|
||||
options->teletext_mode=CCX_TXT_AUTO_NOT_YET_FOUND; // 0=Disabled, 1 = Not found, 2=Found
|
||||
|
||||
options->transcript_settings = ccx_encoders_default_transcript_settings;
|
||||
|
@ -56,6 +56,7 @@ struct ccx_s_options // Options from user parameters
|
||||
int xmltv; // 1 = full output. 2 = live output. 3 = both
|
||||
int xmltvliveinterval; // interval in seconds between writting xmltv output files in live mode
|
||||
int xmltvoutputinterval; // interval in seconds between writting xmltv full file output
|
||||
int xmltvonlycurrent; // 0 off 1 on
|
||||
unsigned teletext_mode; // 0=Disabled, 1 = Not found, 2=Found
|
||||
ccx_encoders_transcript_format transcript_settings; // Keeps the settings for generating transcript output files.
|
||||
char millis_separator;
|
||||
|
@ -1513,6 +1513,12 @@ void parse_parameters (struct ccx_s_options *opt, int argc, char *argv[])
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (strcmp (argv[i],"-xmltvonlycurrent")==0)
|
||||
{
|
||||
ccx_options.xmltvonlycurrent=1;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcmp (argv[i],"-unixts")==0 && i<argc-1)
|
||||
{
|
||||
|
@ -227,7 +227,7 @@ void EPG_output_live(struct lib_ccx_ctx *ctx) {
|
||||
void EPG_output(struct lib_ccx_ctx *ctx) {
|
||||
FILE *f;
|
||||
char *filename;
|
||||
int i,j;
|
||||
int i,j, ce;
|
||||
filename = malloc(strlen(ctx->basefilename) + 9);
|
||||
memcpy(filename, ctx->basefilename, strlen(ctx->basefilename)+1);
|
||||
strcat(filename, "_epg.xml");
|
||||
@ -239,14 +239,25 @@ void EPG_output(struct lib_ccx_ctx *ctx) {
|
||||
fprintf(f, " <display-name>%i</display-name>\n", pmt_array[i].program_number);
|
||||
fprintf(f, " </channel>\n");
|
||||
}
|
||||
for(i=0; i<pmt_array_length; i++) {
|
||||
for(j=0; j<ctx->eit_programs[i].array_len; j++)
|
||||
EPG_print_event(&ctx->eit_programs[i].epg_events[j], pmt_array[i].program_number, f);
|
||||
}
|
||||
if(ccx_options.xmltvonlycurrent==0) { // print all events
|
||||
for(i=0; i<pmt_array_length; i++) {
|
||||
for(j=0; j<ctx->eit_programs[i].array_len; j++)
|
||||
EPG_print_event(&ctx->eit_programs[i].epg_events[j], pmt_array[i].program_number, f);
|
||||
}
|
||||
|
||||
if(pmt_array_length==0) //Stream has no PMT, fall back to unordered events
|
||||
for(j=0; j<ctx->eit_programs[TS_PMT_MAP_SIZE].array_len; j++)
|
||||
EPG_print_event(&ctx->eit_programs[TS_PMT_MAP_SIZE].epg_events[j], ctx->eit_programs[TS_PMT_MAP_SIZE].epg_events[j].service_id, f);
|
||||
if(pmt_array_length==0) //Stream has no PMT, fall back to unordered events
|
||||
for(j=0; j<ctx->eit_programs[TS_PMT_MAP_SIZE].array_len; j++)
|
||||
EPG_print_event(&ctx->eit_programs[TS_PMT_MAP_SIZE].epg_events[j], ctx->eit_programs[TS_PMT_MAP_SIZE].epg_events[j].service_id, f);
|
||||
}
|
||||
else { // print current events only
|
||||
for(i=0; i<pmt_array_length; i++) {
|
||||
ce = ctx->eit_current_events[i];
|
||||
for(j=0; j<ctx->eit_programs[i].array_len; j++) {
|
||||
if(ce==ctx->eit_programs[i].epg_events[j].id)
|
||||
EPG_print_event(&ctx->eit_programs[i].epg_events[j], pmt_array[i].program_number, f);
|
||||
}
|
||||
}
|
||||
}
|
||||
fprintf(f, "</tv>");
|
||||
fclose(f);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user