diff options
author | Jochen Dolze <vdr@dolze.de> | 2012-05-12 17:14:17 +0200 |
---|---|---|
committer | Jochen Dolze <vdr@dolze.de> | 2012-05-12 17:14:17 +0200 |
commit | 364a698b0ec11d993f7960f65a8bbe8adca8b148 (patch) | |
tree | 6dc924c75bd44209cae926bacdf7cc56357fb2bb | |
parent | 3ab137c54bd6afce85546ef34e30a59f0d3382b3 (diff) | |
download | vdr-plugin-xmltv2vdr-364a698b0ec11d993f7960f65a8bbe8adca8b148.tar.gz vdr-plugin-xmltv2vdr-364a698b0ec11d993f7960f65a8bbe8adca8b148.tar.bz2 |
Changed title- and shorttext-handler
Added epgsearch config examples
-rw-r--r-- | dist/epgsearch.conf/README | 12 | ||||
-rw-r--r-- | dist/epgsearch.conf/epgsearchcats.conf | 6 | ||||
-rw-r--r-- | dist/epgsearch.conf/epgsearchuservars.conf | 6 | ||||
-rw-r--r-- | import.cpp | 8 | ||||
-rw-r--r-- | xmltv2vdr.cpp | 72 | ||||
-rw-r--r-- | xmltv2vdr.h | 2 |
6 files changed, 59 insertions, 47 deletions
diff --git a/dist/epgsearch.conf/README b/dist/epgsearch.conf/README new file mode 100644 index 0000000..ad311fb --- /dev/null +++ b/dist/epgsearch.conf/README @@ -0,0 +1,12 @@ +Here you will find example epgsearch conf files. +All timers with outputdirectory %Serien% will be +formatted in this way: + +If you want to record "Mamis Liebling" from the +series "The Bang Theory" and your EPG-Source +provides season- and episode-info then you will +get: + +Serien~The_Big_Bang_Theory~S05E06_-_093._Mamis_Liebling + +You need at least epgsearch version 1.0.1beta! diff --git a/dist/epgsearch.conf/epgsearchcats.conf b/dist/epgsearch.conf/epgsearchcats.conf new file mode 100644 index 0000000..a5a3173 --- /dev/null +++ b/dist/epgsearch.conf/epgsearchcats.conf @@ -0,0 +1,6 @@ +# ----------------------------------------------------------------------------- +# this is an example for a german epgsearchcats.conf +# ----------------------------------------------------------------------------- +1|Staffel,%02i|Staffel||4 +2|Episode,%02i|Episode||4 +3|Folge,%03i|Folge||4 diff --git a/dist/epgsearch.conf/epgsearchuservars.conf b/dist/epgsearch.conf/epgsearchuservars.conf new file mode 100644 index 0000000..0b37cbc --- /dev/null +++ b/dist/epgsearch.conf/epgsearchuservars.conf @@ -0,0 +1,6 @@ +%Pfad%=Serien~%Title% +%SeasonEpisode%=%Pfad%~S%Staffel%E%Episode%_-_%Folge%._%Subtitle% +%Shorttext%=%Pfad%~%Subtitle% +%DateTime%=%Pfad%~%time_w%_%date%_%time% +%STorDT%=%Subtitle% ? %Shorttext% : %DateTime% +%Serien%=%Staffel% ? %SeasonEpisode% : %STorDT% @@ -858,7 +858,7 @@ bool cImport::PutEvent(cEPGSource *Source, sqlite3 *Db, cSchedule* Schedule, if (description) { description=AddEOT2Description(description,true); - tsyslogs(Source,"{%i} adding EOT to '%s'",Event->EventID(),Event->Title()); + tsyslogs(Source,"{%5i} adding EOT to '%s'",Event->EventID(),Event->Title()); Event->SetDescription(description); free(description); } @@ -880,7 +880,7 @@ bool cImport::PutEvent(cEPGSource *Source, sqlite3 *Db, cSchedule* Schedule, int len=strlen(buf); if (len>0) buf[len-1]=0; - tsyslogs(Source,"{%i} changing %s of '%s'/'%s'@%s-%s",Event->EventID(), + tsyslogs(Source,"{%5i} changing %s of '%s'/'%s'@%s-%s",Event->EventID(), buf,Event->Title(),Event->ShortText() ? Event->ShortText() : "", from,till); } @@ -1073,7 +1073,7 @@ cXMLTVEvent *cImport::AddXMLTVEvent(cEPGSource *Source,sqlite3 *Db, const char * } else { - tsyslogs(Source,"{%i} adding '%s'/'%s' to db",xevent->EventID(),xevent->Title(),xevent->ShortText()); + tsyslogs(Source,"{%5i} adding '%s'/'%s' to db",xevent->EventID(),xevent->Title(),xevent->ShortText()); } return xevent; } @@ -1156,7 +1156,7 @@ bool cImport::UpdateXMLTVEvent(cEPGSource *Source, sqlite3 *Db, const cEvent *Ev strcat(buf,"eiteventid"); } - tsyslogs(Source,"{%i} updating %s of '%s' in db",Event->EventID(),buf, + tsyslogs(Source,"{%5i} updating %s of '%s' in db",Event->EventID(),buf, Event->Title()); } diff --git a/xmltv2vdr.cpp b/xmltv2vdr.cpp index 957c693..4c3ce8c 100644 --- a/xmltv2vdr.cpp +++ b/xmltv2vdr.cpp @@ -282,45 +282,24 @@ bool cEPGHandler::check4proc(cEvent *event, bool &spth, cEPGMapping **map) bool cEPGHandler::SetTitle(cEvent* Event, const char* UNUSED(Title)) { if (!Event->Title()) return false; // no title? new event! let VDR handle this.. - bool seth; - if (!check4proc(Event,seth,NULL)) return false; - - if (import.WasChanged(Event)) - { -#ifdef VDRDEBUG - // ok we already changed this event! - tsyslog("{%i} %salready seen title '%s'",Event->EventID(),seth ? "*" : "", - Event->Title()); -#endif - return true; - } - return false; + return true; } - bool cEPGHandler::SetShortText(cEvent* Event, const char* ShortText) { - bool seth; - if (!check4proc(Event,seth,NULL)) return false; - - if (import.WasChanged(Event)) - { -#ifdef VDRDEBUG - // ok we already changed this event! - tsyslog("{%i} %salready seen stext '%s'",Event->EventID(),seth ? "*" : "", - Event->Title()); -#endif - return true; - } // prevent setting empty shorttext if (!ShortText) return true; // prevent setting empty shorttext if (!strlen(ShortText)) return true; // prevent setting shorttext equal to title if (Event->Title() && !strcasecmp(Event->Title(),ShortText)) return true; - tsyslog("{%i} %ssetting stext (%s) of '%s'",Event->EventID(),seth ? "*" : "", - ShortText,Event->Title()); - return false; + if (!Event->ShortText()) + { + tsyslog("{%5i} setting stext (%s) of '%s'",Event->EventID(), + ShortText,Event->Title()); + return false; // no shorttext? new event! let VDR handle this.. + } + return true; } bool cEPGHandler::SetDescription(cEvent* Event, const char* Description) @@ -337,17 +316,17 @@ bool cEPGHandler::SetDescription(cEvent* Event, const char* Description) if (strncasecmp(Event->Description(),Description,len)) { // eit description changed -> set it - tsyslog("{%i} %schanging descr of '%s'",Event->EventID(),seth ? "*" : "", + tsyslog("{%5i} %schanging descr of '%s'",Event->EventID(),seth ? "*" : "", Event->Title()); return false; } #ifdef VDRDEBUG - tsyslog("{%i} %salready seen descr '%s'",Event->EventID(),seth ? "*" : "", + tsyslog("{%5i} %salready seen descr '%s'",Event->EventID(),seth ? "*" : "", Event->Title()); #endif return true; } - tsyslog("{%i} %ssetting descr of '%s'",Event->EventID(),seth ? "*" : "", + tsyslog("{%5i} %ssetting descr of '%s'",Event->EventID(),seth ? "*" : "", Event->Title()); return false; } @@ -502,15 +481,15 @@ cHouseKeeping::cHouseKeeping(cGlobals *Global): cThread("xmltv2vdr housekeeping" global=Global; } -int cHouseKeeping::checkdir(const char* imgdir, int age) +void cHouseKeeping::checkdir(const char* imgdir, int age, int &cnt, int &lcnt) { - if (age<=0) return 0; + if (age<=0) return; DIR *dir=opendir(imgdir); - if (!dir) return 0; + if (!dir) return; time_t tmin=time(NULL); tmin-=(age*86400); struct dirent dirent_buf,*dirent; - int cnt=0; + while (readdir_r(dir,&dirent_buf,&dirent)==0) { if (!dirent) break; @@ -525,7 +504,11 @@ int cHouseKeeping::checkdir(const char* imgdir, int age) { if (statbuf.st_mtime<tmin) { - if (unlink(fpath)!=-1) cnt++; + if (unlink(fpath)!=-1) + { + if (dirent->d_type==DT_LNK) lcnt++; + if (dirent->d_type==DT_REG) cnt++; + } } } free(fpath); @@ -533,7 +516,7 @@ int cHouseKeeping::checkdir(const char* imgdir, int age) } } closedir(dir); - return cnt; + return; } int sd_select(const dirent* dirent) @@ -548,9 +531,10 @@ int sd_select(const dirent* dirent) void cHouseKeeping::Action() { - if (global->ImgDelAfter()) + if (global->ImgDelAfter() && global->ImgDir()) { - int cnt=checkdir(global->ImgDir(),global->ImgDelAfter()); + int cnt=0,lcnt=0; + checkdir(global->ImgDir(),global->ImgDelAfter(),cnt,lcnt); struct dirent **names; int ret=scandir("/var/lib/epgsources",&names,sd_select,alphasort); if (ret>0) @@ -560,15 +544,19 @@ void cHouseKeeping::Action() char *newdir; if (asprintf(&newdir,"/var/lib/epgsources/%s",names[i]->d_name)!=-1) { - cnt+=checkdir(newdir,global->ImgDelAfter()); + checkdir(newdir,global->ImgDelAfter(),cnt,lcnt); free(newdir); } } free(names); } + if (lcnt) + { + isyslog("removed %i links",lcnt); + } if (cnt) { - isyslog("removed %i pics/links",cnt); + isyslog("removed %i pics",cnt); } } diff --git a/xmltv2vdr.h b/xmltv2vdr.h index 9e71dd3..a26c009 100644 --- a/xmltv2vdr.h +++ b/xmltv2vdr.h @@ -190,7 +190,7 @@ class cHouseKeeping : public cThread { private: cGlobals *global; - int checkdir(const char *imgdir, int age); + void checkdir(const char *imgdir, int age, int &cnt, int &lcnt); public: cHouseKeeping(cGlobals *Global); void Stop() |