TheDreamer Moderator


Joined: 23 Jan 2003 Posts: 1487 Location: Manhattan, KS
|
Posted: Mon Oct 17, 2005 8:04 am Post subject: ReplaySchedule and WiRNS OriginalAirDate&Repeats |
|
|
Now that WiRNS has the option to flag shows with old OriginalAirDate as Repeats....ReplaySchedule needs a little tweak to generate correct todo.html files....
So, here's the hacks I made to make it kind of work....not sure if the days offset is quite right....
| Code: | *** orig/replaySchedule.h Thu Dec 9 20:17:27 2004
--- replaySchedule.h Mon Oct 17 10:56:15 2005
***************
*** 31,36 ****
--- 31,38 ----
extern time_t minstarttime;
extern time_t maxstarttime;
+ extern int RepeatDays, RepeatHasEpTitle;
+
// Structure for IP -> name mappings
struct ipmap_struct {
char ip[256];
***************
*** 67,74 ****
--- 69,78 ----
struct prog {
char start[15];
char stop[15];
+ char origair[15];
time_t ustart;
time_t ustop;
+ time_t uorigair;
int channelNum;
int tmsid;
char channel[15];
***************
*** 84,91 ****
--- 88,97 ----
struct Channel {
char start[15];
char stop[15];
+ char origair[15];
time_t ustart;
time_t ustop;
+ time_t uorigair;
int channelNum;
char channel[15];
char title[512];
|
| Code: | *** orig/replaySchedule.c Fri May 20 16:27:47 2005
--- replaySchedule.c Mon Oct 17 10:55:10 2005
***************
*** 67,72 ****
--- 67,74 ----
char *DayName[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
char *MonthName[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+ int RepeatDays=0, RepeatHasEpTitle=0;
+
int main(int argc, char *argv[])
{
char replayIP[MAX_IP_NUM][256];
***************
*** 157,168 ****
--- 159,177 ----
if (!strcmp(argv[iarg], "--notodo")) {
todo = 0;
}
+ if (!strcmp(argv[iarg], "--repeateptitle")) {
+ RepeatHasEpTitle = 1;
+ }
+
// Arguments that require an additional parameter
// and therefore can't be the last argument in the list
if( iarg < (argc-1) ) {
if (!strcmp(argv[iarg], "--ip")) {
strcpy(replayIP[ipCount++], argv[iarg+1]);
}
+ if (!strcmp(argv[iarg], "--repeatdays")) {
+ RepeatDays = atoi(argv[iarg+1]);
+ }
if ( (xmltvScheduleFileCount < MAX_SCHEDULE_FILES)
&& !strcmp(argv[iarg], "--schedule")) {
strcpy(xmltvScheduleFile[xmltvScheduleFileCount++], argv[iarg+1]);
***************
*** 3164,3171 ****
--- 3173,3182 ----
void resetProgStruct( struct prog *prog ) {
strcpy(prog->start, "");
strcpy(prog->stop, "");
+ strcpy(prog->origair, "");
prog->ustart = 0;
prog->ustop = 0;
+ prog->uorigair = 0;
prog->channelNum = 0;
prog->tmsid = 0;
strcpy(prog->channel, "");
***************
*** 3182,3189 ****
--- 3193,3202 ----
void resetChannelStruct( struct Channel *channel ) {
strcpy(channel->start, "");
strcpy(channel->stop, "");
+ strcpy(channel->origair, "");
channel->ustart = 0;
channel->ustop = 0;
+ channel->uorigair = 0;
channel->channelNum = 0;
channel->tmsid = 0;
strcpy(channel->channel, "");
|
| Code: | *** orig/parseDataDirect.c Fri May 20 14:52:48 2005
--- parseDataDirect.c Mon Oct 17 11:12:15 2005
***************
*** 94,99 ****
--- 94,100 ----
char title[MAXLINE];
char subtitle[MAXLINE];
char desc[MAXLINE];
+ char origair[MAXLINE];
};
htab *progHash;
***************
*** 103,108 ****
--- 104,110 ----
strcpy(p->title, "");
strcpy(p->subtitle, "");
strcpy(p->desc, "");
+ strcpy(p->origair, "");
}
// Add new channel id entry to global progHash hash
***************
*** 230,235 ****
--- 232,263 ----
return(_time_);
}
+ // convert given DataDirect Original Air Date to format: yyyyMMddhhmmss
+ // DataDirect Original Air Date format is: yyyy-MM-dd
+ char *ddOrig(char *origair)
+ {
+ int i=0, dd=0, j, k;
+
+ // Year
+ for(j=0; j<4; ++j)
+ _time_[i++] = origair[dd++];
+ // Month
+ dd++;
+ for(j=0; j<2; ++j)
+ _time_[i++] = origair[dd++];
+ // Day
+ dd++;
+ for(j=0; j<2; ++j)
+ _time_[i++] = origair[dd++];
+ // Rest
+ for(k=0; k<3; ++k)
+ for(j=0; j<2; ++j)
+ _time_[i++] = '0';
+ _time_[i] = '\0';
+
+ return(_time_);
+ }
+
// convert given DataDirect start time + duration to stop time
// start format is: yyyyMMddhhmmss
// duration format is: PThhHmmM
***************
*** 325,330 ****
--- 353,364 ----
sscanf(s1+strlen("<description>"), "%[^<]", s);
strcpy(pinfo->desc, fixApostrophes(fixAmpersans(s)));
}
+
+ // Original Air Date
+ else if( (s1 = strstr(line, "<originalAirDate>")) ) {
+ sscanf(s1+strlen("<originalAirDate>"), "%[^<]", s);
+ strcpy(pinfo->origair, ddOrig(s));
+ }
}
fclose(ifp);
}
***************
*** 456,461 ****
--- 490,506 ----
strcpy(program.title, pinfo->title);
strcpy(program.subtitle, pinfo->subtitle);
strcpy(program.desc, pinfo->desc);
+ strcpy(program.origair, pinfo->origair);
+ if (strcmp(program.origair,""))
+ program.uorigair = guideTimeToUTC(pinfo->origair);
+
+ // RepeatDays && RepeatHasEpTitle
+ if (RepeatDays)
+ {
+ if (program.uorigair + RepeatDays*86400 < program.ustart)
+ if (!RepeatHasEpTitle || strlen(program.subtitle))
+ program.repeat = 1;
+ }
// Remember the earliest and latest start times
// These are used for displaying single recordings within the
|
Additional hacking was needed to get it invoked from PRG with the extra args, but I'll leave that as an exercise for whoever needs it.
The Dreamer _________________ You may be a dreamer, but I'm The Dreamer, the definite article you might say! |
|