EventName converter: add Pdc and PdcTime support
authorims <ims21@users.sourceforge.net>
Thu, 19 Mar 2015 18:51:55 +0000 (19:51 +0100)
committerpieterg <pieterg@users.sourceforge.net>
Thu, 19 Mar 2015 20:52:34 +0000 (21:52 +0100)
Pdc returns whether or not PDC information is available
PdcTime returns the timestamp parsed from the PDC PIL

Signed-off-by: pieterg <pieterg@users.sourceforge.net>

lib/python/Components/Converter/EventName.py

index adbc1de..e3ec653 100644 (file)
@@ -13,6 +13,8 @@ class EventName(Converter, object):
        GENRE = 7
        RATING = 8
        SRATING = 9
+       PDC = 10
+       PDCTIME = 11
 
        def __init__(self, type):
                Converter.__init__(self, type)
@@ -34,6 +36,10 @@ class EventName(Converter, object):
                        self.type = self.RATING
                elif type == "SmallRating":
                        self.type = self.SRATING
+               elif type == "Pdc":
+                       self.type = self.PDC
+               elif type == "PdcTime":
+                       self.type = self.PDCTIME
                else:
                        self.type = self.NAME
 
@@ -95,5 +101,14 @@ class EventName(Converter, object):
                        return description + extended
                elif self.type == self.ID:
                        return str(event.getEventId())
+               elif self.type == self.PDC:
+                       if event.getPdcPil():
+                               return _("PDC")
+                       return ""
+               elif self.type == self.PDCTIME:
+                       pil = event.getPdcPil()
+                       if pil:
+                               return _("%d.%02d. %d:%02d") % ((pil & 0xF8000) >> 15, (pil & 0x7800) >> 11, (pil & 0x7C0) >> 6, (pil & 0x3F))
+                       return ""
 
        text = property(getText)