Merge branch 'bug_607_parental_control_fix' into experimental
[enigma2.git] / ServiceReference.py
index 150708d105ef560289be01c84b4a8e3722f90e4d..4907fa280bcf221f9238c53633349e5377e2ff98 100644 (file)
@@ -1,36 +1,35 @@
-
-from enigma import *
-
-import NavigationInstance
+from enigma import eServiceReference, eServiceCenter
 
 class ServiceReference(eServiceReference):
        def __init__(self, ref):
-               if isinstance(ref, str):
-                       ref = eServiceReference(ref)
-               self.ref = ref
+               if not isinstance(ref, eServiceReference):
+                       self.ref = eServiceReference(ref or "")
+               else:
+                       self.ref = ref
                self.serviceHandler = eServiceCenter.getInstance()
 
        def __str__(self):
                return self.ref.toString()
-       
+
        def getServiceName(self):
                info = self.info()
-               if info is None:
-                       return None
-               
-               return info.getName(self.ref)
+               return info and info.getName(self.ref) or ""
 
-       def play(self):
+       def info(self):
                return self.serviceHandler.info(self.ref)
-       
-       def record(self):
-               return self.serviceHandler.record(self.ref)
-       
+
        def list(self):
-               return self.serviceHandler.list(self)
-       
-       def info(self):
-               return self.serviceHandler.info(self)
+               return self.serviceHandler.list(self.ref)
+
+       def getType(self):
+               return self.ref.type
+
+       def getPath(self):
+               return self.ref.getPath()
+
+       def getFlags(self):
+               return self.ref.flags
 
-       def offlineOperations(self):
-               return self.serviceHandler.offlineOperations(self.ref)
+       def isRecordable(self):
+               ref = self.ref
+               return ref.flags & eServiceReference.isGroup or (ref.type == eServiceReference.idDVB and ref.getPath() == "")
\ No newline at end of file