Re: [vdr] [PATCH] Strip parental rating from title in EPG

2012-03-15 Thread Klaus Schmidinger

On 15.03.2012 20:55, Matti Lehtimäki wrote:

Hi

Finnish channels add parental rating to the end of title in EPG separated by parentheses, 
for example "Program title (12)", which in both annoying and also makes 
alphabetical sorting not function properly as different episodes may have different 
parental rating. The attached patch will remove the
parental rating from the title and place it into correct EPG field.

If this is to be integrated into vdr-core it should be decided to which bugfix 
level it belongs. I added it to bugfix level 1 as it basically is misuse of EPG 
fields.


A title might end with some digits enclosed in parentheses for various
reasons, not just as a parental rating. I'm afraid I can't add this
to the core VDR EPG bugfixes.

But you could use the new cEpgHandler API to implement a plugin that
does this for you.

Klaus

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


[vdr] [PATCH] Strip parental rating from title in EPG

2012-03-15 Thread Matti Lehtimäki

Hi

Finnish channels add parental rating to the end of title in EPG 
separated by parentheses, for example "Program title (12)", which in 
both annoying and also makes alphabetical sorting not function properly 
as different episodes may have different parental rating. The attached 
patch will remove the parental rating from the title and place it into 
correct EPG field.


If this is to be integrated into vdr-core it should be decided to which 
bugfix level it belongs. I added it to bugfix level 1 as it basically is 
misuse of EPG fields.


P.S. I have only tested this patch with 1.7.22 because my kernel is not 
supported anymore in most recent developer versions but it should not 
cause problems.


--
Matti
--- vdr-1.7.26/epg.c	2012-03-10 15:14:27.0 +0200
+++ vdr-1.7.26-epg/epg.c	2012-03-15 21:41:40.0 +0200
@@ -712,6 +712,22 @@
 }
  }
 
+  // Some channels put parental rating to the end of title in parentheses.
+  // In that case we move it to parental rating field:
+  if (title) {
+ int l = strlen(title);
+ if (l > 5 && (title[l - 1] == ')' && (title[l - 3] == '(' || title[l - 4] == '('))) {
+int pos = 3;
+if (title[l - 4] == '(')
+   pos = 4;
+SetParentalRating(atoi(&title[l - pos + 1]));
+if (title[l - pos - 1] == ' ')
+   pos++;
+title[l - pos] = '\0';
+EpgBugFixStat(5, ChannelID());
+}
+ }
+
   if (Setup.EPGBugfixLevel <= 1)
  goto Final;
 
___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr