From 5c5359cf94bf9de90d6eb10daa2c83db30cfb06e Mon Sep 17 00:00:00 2001 From: Christian Wieninger Date: Mon, 7 May 2012 19:14:03 +0200 Subject: format specifier in epgsearchcats.conf, thanks to Joe_D for a patch --- HISTORY | 2 +- HISTORY.DE | 2 +- doc-src/de/epgsearchcats.conf.5.txt | 4 +++- doc-src/en/epgsearchcats.conf.5.txt | 4 +++- epgsearchcats.c | 24 +++++++++++++++++++++--- epgsearchcats.h | 1 + epgsearchtools.c | 18 ++++++++++++++---- epgsearchtools.h | 2 +- recdone.c | 4 ++-- 9 files changed, 47 insertions(+), 14 deletions(-) diff --git a/HISTORY b/HISTORY index 977649e..471c869 100644 --- a/HISTORY +++ b/HISTORY @@ -1,7 +1,7 @@ VDR Plugin 'epgsearch' Revision History --------------------------------------- -2011-xx-xx; Version 1.0.1 +2012-05-xx; Version 1.0.1 new: - in the menu 'recordings done' you can now toggle the blue key to 'Orphaned' to show recordings with vanished search timers. diff --git a/HISTORY.DE b/HISTORY.DE index 95957d1..4d59f9d 100644 --- a/HISTORY.DE +++ b/HISTORY.DE @@ -1,7 +1,7 @@ VDR Plugin 'epgsearch' Revision History --------------------------------------- -2011-xx-xx: Version 1.0.1 +2012-05-xx: Version 1.0.1 neu: - Im Menu 'Erledigte Aufnahmen' kann nun mit der blauen Taste zu 'Verwaiste' umgeschaltet werden, um Aufnahmen anzuzeigen, zu denen es keine Suchtimer mehr gibt. diff --git a/doc-src/de/epgsearchcats.conf.5.txt b/doc-src/de/epgsearchcats.conf.5.txt index 884dbe1..69a9bb0 100644 --- a/doc-src/de/epgsearchcats.conf.5.txt +++ b/doc-src/de/epgsearchcats.conf.5.txt @@ -34,10 +34,12 @@ Auszug aus einer F: The order of items determines the order listed in epgsearch. It does not depend on the ID, which is used by epgsearch. Format: - ID|category name|name in menu|values separated by ',' (option)|searchmode + ID|category name(,format)|name in menu|values separated by ',' (option)|searchmode - 'ID' should be a unique positive integer (changing the id later on will force you to reedit your search timers!) - 'category name' is the name in your epg.data + you can optinally add a format specifier for numeric values e.g. + Episode,%02i - 'name in menu' is the name displayed in epgsearch. - 'values' is an optional list of possible values if you omit the list, the entry turns to an edit field in epgsearch, diff --git a/doc-src/en/epgsearchcats.conf.5.txt b/doc-src/en/epgsearchcats.conf.5.txt index 149e269..2aae3a5 100644 --- a/doc-src/en/epgsearchcats.conf.5.txt +++ b/doc-src/en/epgsearchcats.conf.5.txt @@ -32,11 +32,13 @@ the category name as also the value. =head1 SYNTAX - ID|category name|name in menu|values separated by ','(option)|searchmode(option) + ID|category name(,format)|name in menu|values separated by ','(option)|searchmode(option) - 'ID' should be a unique positive integer (changing the id later on will force you to re-edit your search timers!) - 'category name' is the name as delivered by the EPG provider, e.g. 'Genre' + you can optionally provide a format specifier for numeric values, e.g. + Episode,%02i - 'name in menu' is the name displayed in epgsearch. - 'values' is an optional list of possible values - 'searchmode' specifies the search mode: diff --git a/epgsearchcats.c b/epgsearchcats.c index 5458369..8428ac2 100644 --- a/epgsearchcats.c +++ b/epgsearchcats.c @@ -34,6 +34,7 @@ cSearchExtCat::cSearchExtCat(void) { id = 0; name = NULL; + format = NULL; menuname = NULL; searchmode = 1; // default: all substrings must exist values = NULL; @@ -82,8 +83,19 @@ bool cSearchExtCat::Parse(const char *s) switch (parameter) { case 1: id = atoi(value); break; - case 2: name = strdup(value); - break; + case 2: + { + name = strdup(value); + format=strchr(name,','); + if (format) + { + *format=0; + format++; + char cset[]="%0123456789di"; + if (strspn(format,cset)!=strlen(format)) format=NULL; + } + break; + } case 3: menuname = strdup(value); break; case 4: @@ -128,8 +140,14 @@ const char *cSearchExtCat::ToText(void) for(int i=0; iDescription(), SearchExtCat->name); + return GetExtEPGValue(e->Description(), SearchExtCat->name, SearchExtCat->format); } -char* GetExtEPGValue(const char* description, const char* catname) +char* GetExtEPGValue(const char* description, const char* catname, const char *format) { if (isempty(description)) return NULL; @@ -247,6 +247,16 @@ char* GetExtEPGValue(const char* description, const char* catname) char* value = NULL; msprintf(&value, "%s", cat + strlen(tmp)-1); + if (format) + { + int ivalue; + if (sscanf(value,"%8i",&ivalue)==1) + { + free(value); + value = NULL; + msprintf(&value, format, ivalue); + } + } free(descr); free(tmp); @@ -659,8 +669,8 @@ bool EventsMatch(const cEvent* event1, const cEvent* event2, bool compareTitle, { if (catvaluesAvoidRepeat & (1<name); - char* CatValue2 = GetExtEPGValue(Descr2, SearchExtCat->name); + char* CatValue1 = GetExtEPGValue(Descr1, SearchExtCat->name, SearchExtCat->format); + char* CatValue2 = GetExtEPGValue(Descr2, SearchExtCat->name, SearchExtCat->format); if ((!CatValue1 && CatValue2) || (!CatValue2 && CatValue1) || (CatValue1 && CatValue2 && strcmp(CatValue1, CatValue2) != 0)) diff --git a/epgsearchtools.h b/epgsearchtools.h index 27ba968..ea70cf8 100644 --- a/epgsearchtools.h +++ b/epgsearchtools.h @@ -117,7 +117,7 @@ class cEvent; char* IndentMenuItem(const char*, int indentions=1); bool MatchesSearchMode(const char* test, const char* values, int searchmode, const char* delim, int tolerance); char* GetExtEPGValue(const cEvent* e, cSearchExtCat* SearchExtCat); -char* GetExtEPGValue(const char* description, const char* catname); +char* GetExtEPGValue(const char* description, const char* catname, const char *format); char* GetAuxValue(const char* aux, const char* name); char* GetAuxValue(const cRecording *recording, const char* name); char* GetAuxValue(const cTimer* timer, const char* name); diff --git a/recdone.c b/recdone.c index 84387e1..c7f8c4d 100644 --- a/recdone.c +++ b/recdone.c @@ -248,8 +248,8 @@ bool CatValuesMatch(unsigned long catvaluesAvoidRepeat, const string& rDescr, co { if (catvaluesAvoidRepeat & (1<name); - char* rCatValue = GetExtEPGValue(rDescr.c_str(), SearchExtCat->name); + char* eCatValue = GetExtEPGValue(eDescr.c_str(), SearchExtCat->name, SearchExtCat->format); + char* rCatValue = GetExtEPGValue(rDescr.c_str(), SearchExtCat->name, SearchExtCat->format); if ((!eCatValue && rCatValue) || (!rCatValue && eCatValue) || (eCatValue && rCatValue && strcmp(eCatValue, rCatValue) != 0)) -- cgit v1.2.3