From 19f37084653d08d8c471f974db9818bd4cbb81a7 Mon Sep 17 00:00:00 2001 From: Kushal Das Date: Fri, 3 Oct 2008 00:51:58 +0530 Subject: Now it plays files on their real location , not on the links created by sugar --- jukeboxactivity.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/jukeboxactivity.py b/jukeboxactivity.py index 7a72ac3..e6ddb30 100755 --- a/jukeboxactivity.py +++ b/jukeboxactivity.py @@ -167,8 +167,19 @@ class JukeboxActivity(activity.Activity): def read_file(self, file_path): self.uri = os.path.abspath(file_path) + if os.path.islink(self.uri): + self.uri = os.path.realpath(self.uri) gobject.idle_add(self._start, self.uri) + def getplaylist(self, links): + result = [] + for x in links: + if x.startswith('http://'): + result.append(x) + else: + result.append('file://' + os.path.join(self.playpath,x)) + return result + def _start(self, uri=None): logging.info(uri) self.playpath = os.path.dirname(uri) @@ -176,7 +187,7 @@ class JukeboxActivity(activity.Activity): return False # FIXME: parse m3u files and extract actual URL if uri.endswith(".m3u"): - self.playlist = [line.strip() for line in open(uri).readlines()] + self.playlist = self.getplaylist([line.strip() for line in open(uri).readlines()]) else: self.playlist.append('file://' + urllib.quote(uri)) if not self.player: -- cgit