diff options
| author | ghost <andreas.monzner@multimedia-labs.de> | 2009-05-29 17:02:39 +0200 |
|---|---|---|
| committer | ghost <andreas.monzner@multimedia-labs.de> | 2009-05-29 17:02:39 +0200 |
| commit | 428e33acd1d58d08045993554b81be20b53eb5c4 (patch) | |
| tree | 8c32efe17c21a96d554a16334ede7e5123b3c265 /lib/python | |
| parent | a21f25ae8419e0630def1e4ef78c234ae5ca92d5 (diff) | |
| parent | e08e99097a457278827a6a638b326fc2224e6e5c (diff) | |
| download | enigma2-428e33acd1d58d08045993554b81be20b53eb5c4.tar.gz enigma2-428e33acd1d58d08045993554b81be20b53eb5c4.zip | |
Merge branch 'master' of git.opendreambox.org:/git/enigma2
Diffstat (limited to 'lib/python')
| -rw-r--r-- | lib/python/Components/Playlist.py | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/lib/python/Components/Playlist.py b/lib/python/Components/Playlist.py index c9ebe479..8d9d78af 100644 --- a/lib/python/Components/Playlist.py +++ b/lib/python/Components/Playlist.py @@ -1,7 +1,8 @@ from ServiceReference import ServiceReference +from enigma import eServiceReference import os -class PlaylistIO: +class PlaylistIO: def __init__(self): self.list = [] @@ -15,6 +16,8 @@ class PlaylistIO: ERROR = 3 UNSUPPORTED_FILES_IN_PLAYLIST = 4 + REMOTE_PROTOS = ["http", "https", "udp", "rtsp", "rtp", "mmp"] + def save(self, filename = None): return self.ERROR @@ -23,12 +26,22 @@ class PlaylistIO: def addService(self, service): self.list.append(service) - - + + def getRef(self, filename, entry): + if entry[0] == "/": + path = entry + else: + path = os.path.dirname(filename) + "/" + entry + for proto in self.REMOTE_PROTOS: + if entry.startswith(proto): + path = entry + ref = eServiceReference(4097, 0, path) + return ServiceReference(ref) + class PlaylistIOInternal(PlaylistIO): def __init__(self): PlaylistIO.__init__(self) - + def open(self, filename): self.clear() try: @@ -73,12 +86,7 @@ class PlaylistIOM3U(PlaylistIO): self.displayname = extinf[1] # TODO: use e2 facilities to create a service ref from file elif entry[0] != "#": - if entry[0] == "/": - 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: - sref = ServiceReference("4097:0:0:0:0:0:0:0:0:0:" + os.path.dirname(filename) + "/" + entry) + sref = PlaylistIO.getRef(self, filename, entry) if self.displayname: sref.ref.setName(self.displayname) self.displayname = None @@ -108,11 +116,8 @@ class PlaylistIOPLS(PlaylistIO): if entry[0:4] == "File": pos = entry.find('=') + 1 newentry = entry[pos:] - # TODO: use e2 facilities to create a service ref from file - if newentry[0] == "/": - self.addService(ServiceReference("4097:0:0:0:0:0:0:0:0:0:" + newentry)) - else: - self.addService(ServiceReference("4097:0:0:0:0:0:0:0:0:0:" + os.path.dirname(filename) + "/" + newentry)) + sref = PlaylistIO.getRef(self, filename, newentry) + self.addService(sref) else: playlist = PlaylistIOM3U() return playlist.open(filename) |
