Merge remote-tracking branch 'origin/bug_752_audio_selection_fix'
[enigma2.git] / ServiceReference.py
index 2518186..4907fa2 100644 (file)
@@ -1,23 +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 getStaticServiceInformation(self):
-               return NavigationInstance.instance.ServiceHandler.info(self.ref)
-       
        def __str__(self):
                return self.ref.toString()
-       
+
        def getServiceName(self):
-               info = self.getStaticServiceInformation()
-               if info is None:
-                       return None
-               
-               return info.getName(self.ref)
+               info = self.info()
+               return info and info.getName(self.ref) or ""
+
+       def info(self):
+               return self.serviceHandler.info(self.ref)
+
+       def list(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 isRecordable(self):
+               ref = self.ref
+               return ref.flags & eServiceReference.isGroup or (ref.type == eServiceReference.idDVB and ref.getPath() == "")
\ No newline at end of file