diff options
author | Kushal Das <kushal@fedoraproject.org> | 2008-10-03 00:51:58 +0530 |
---|---|---|
committer | Kushal Das <kushal@fedoraproject.org> | 2008-10-03 00:51:58 +0530 |
commit | 19f37084653d08d8c471f974db9818bd4cbb81a7 (patch) | |
tree | f4fea155f082aeabb7306634e7c69bf2bbbc70d6 | |
parent | f7417a533fd96c33bc9e89f02e3a0fb14022771c (diff) | |
download | jukebox-activity.git-19f37084653d08d8c471f974db9818bd4cbb81a7.tar.gz jukebox-activity.git-19f37084653d08d8c471f974db9818bd4cbb81a7.tar.xz jukebox-activity.git-19f37084653d08d8c471f974db9818bd4cbb81a7.zip |
Now it plays files on their real location , not on the links created by sugar
-rwxr-xr-x | jukeboxactivity.py | 13 |
1 files changed, 12 insertions, 1 deletions
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: |