add orBottomToTop, orRightToLeft, orLeftToRight(orHorizontal), orTopToBottom(OrVertic...
[enigma2.git] / lib / python / Components / Playlist.py
index 2279969275f0117bb882c222d226db92ebb6ecc0..c9ebe479d852aa1f319d5210ad0a027901e8465f 100644 (file)
@@ -58,6 +58,7 @@ class PlaylistIOM3U(PlaylistIO):
        
        def open(self, filename):
                self.clear()
+               self.displayname = None
                try:
                        file = open(filename, "r")
                except IOError:
@@ -66,12 +67,22 @@ class PlaylistIOM3U(PlaylistIO):
                        entry = file.readline().strip()
                        if entry == "":
                                break
-                       if entry[0] != "#":
+                       if entry.startswith("#EXTINF:"):
+                               extinf = entry.split(',',1)
+                               if len(extinf) > 1:
+                                       self.displayname = extinf[1]
                                # TODO: use e2 facilities to create a service ref from file
+                       elif entry[0] != "#":
                                if entry[0] == "/":
-                                       self.addService(ServiceReference("4097:0:0:0:0:0:0:0:0:0:" + entry))
+                                       sref = ServiceReference("4097:0:0:0:0:0:0:0:0:0:" + entry)
+                               elif entry.startswith("http"):
+                                       sref = ServiceReference("4097:0:0:0:0:0:0:0:0:0:" + entry.replace(':',"%3a"))
                                else:
-                                       self.addService(ServiceReference("4097:0:0:0:0:0:0:0:0:0:" + os.path.dirname(filename) + "/" + entry))
+                                       sref = ServiceReference("4097:0:0:0:0:0:0:0:0:0:" + os.path.dirname(filename) + "/" + entry)
+                               if self.displayname:
+                                       sref.ref.setName(self.displayname)
+                                       self.displayname = None
+                               self.addService(sref)
                file.close()
                return self.list