Author: duncan
Date: Mon Jan 21 14:01:42 2008
New Revision: 10303

Log:
[ 1872465 ] m3u parsing error
Fix applied, changed os.path.join(curdir,line) to os.path.abspath(line)


Modified:
   branches/rel-1-7/freevo/ChangeLog
   branches/rel-1-7/freevo/src/playlist.py
   branches/rel-1/freevo/ChangeLog
   branches/rel-1/freevo/src/playlist.py

Modified: branches/rel-1-7/freevo/ChangeLog
==============================================================================
--- branches/rel-1-7/freevo/ChangeLog   (original)
+++ branches/rel-1-7/freevo/ChangeLog   Mon Jan 21 14:01:42 2008
@@ -39,6 +39,7 @@
  * Fixed audio playlists when the the fxd file contains utf-8 characters 
(B#1865272)
  * Fixed manual record tv plug-in to work in December (B#1858008)
  * Fixed oneclick weather plug-in to allow non-ascii location names (B#1856597)
+ * Fixed play lists not handling absolute paths (B#1872465)
  * Fixed tv guide not scrolling to last channel from second channel (B#1858010)
  * Fixed web server favorites and edit_favorite to use name and duplicate 
detection (B#1857394)
 

Modified: branches/rel-1-7/freevo/src/playlist.py
==============================================================================
--- branches/rel-1-7/freevo/src/playlist.py     (original)
+++ branches/rel-1-7/freevo/src/playlist.py     Mon Jan 21 14:01:42 2008
@@ -51,12 +51,13 @@
         """
         Init the playlist
 
-        playlist: a) a filename to a playlist file (e.g. m3u)
-                  b) a list of items to play, this list can include
-                     1) Items
-                     2) filenames
-                     3) a list (directoryname, recursive=0|1)
-        build:    create the playlist. This means unfold the directories
+            1. a filename to a playlist file (e.g. m3u)
+            2. a list of items to play, this list can include
+                - Items
+                - filenames
+                - a list (directoryname, recursive=0|1)
+
+        @param build: create the playlist, this means unfold the directories
         """
         Item.__init__(self, parent)
 
@@ -109,8 +110,8 @@
         for line in playlist_lines:
             line = line.replace('\\', '/') # Fix MSDOS slashes
             try:
-                if os.path.exists(os.path.join(curdir,line)):
-                    self.playlist.append(os.path.join(curdir,line))
+                if os.path.exists(os.path.abspath(line)):
+                    self.playlist.append(os.path.abspath(line))
             except TypeError:
                 print 'Bad m3u playlist line in "%s":%r' % (plsname, line)
 
@@ -141,8 +142,8 @@
         for line in playlist_lines:
             if line.endswith('\r\n'):
                 line = line.replace('\\', '/') # Fix MSDOS slashes
-            if os.path.exists(os.path.join(curdir,line)):
-                self.playlist.append(os.path.join(curdir,line))
+            if os.path.exists(os.path.abspath(line)):
+                self.playlist.append(os.path.abspath(line))
 
 
 
@@ -150,14 +151,14 @@
         """
         This is the (ssr) slideshow reading function.
 
-        Arguments: ssrname - the slideshow filename
-        Returns:   The list of interesting lines in the slideshow
-
-        File line format:
+        File line format::
 
             FileName: "image file name"; Caption: "caption text"; Delay: "sec"
 
         The caption and delay are optional.
+
+        @param ssrname: the slideshow filename
+        @returns: the list of interesting lines in the slideshow
         """
 
         (curdir, playlistname) = os.path.split(ssrname)
@@ -189,7 +190,7 @@
                     ss_delay += [5]
 
                 for p in self.get_plugins:
-                    for i in p.get(self, [os.path.join(curdir, ss_name[0])]):
+                    for i in p.get(self, [os.path.abspath(ss_name[0])]):
                         if i.type == 'image':
                             i.name     = Unicode(ss_caption[0])
                             i.duration = int(ss_delay[0])
@@ -322,13 +323,14 @@
         """
         Playlist(playlist=self.playlist, parent=self.parent,
                  display_type=self.display_type, random=True,
-                 repeat=self.repeat).play(arg,menuw)
+                 repeat=self.repeat).play(arg, menuw)
 
 
     def play(self, arg=None, menuw=None):
         """
         play the playlist
         """
+        _debug_('play(arg=%r, menuw=%r)' % (arg, menuw), 2)
         if not self.menuw:
             self.menuw = menuw
 
@@ -421,9 +423,9 @@
                 rc.post_event(Event(AUDIO_LOG, arg=self.current_item.filename))
 
         if event in (INPUT_1, INPUT_2, INPUT_3, INPUT_4, INPUT_5) and \
-               event.arg and self.current_item and 
hasattr(self.current_item,'type'):
+               event.arg and self.current_item and hasattr(self.current_item, 
'type'):
             if (self.current_item.type == 'audio'):
-                
rc.post_event(Event(RATING,(event.arg,self.current_item.filename)))
+                rc.post_event(Event(RATING, (event.arg, 
self.current_item.filename)))
 
 
         if not menuw:
@@ -522,21 +524,21 @@
 
     def fxdhandler(self, fxd, node):
         """
-        parse audio specific stuff from fxd files
+        parse audio specific stuff from fxd files::
 
-        <?xml version="1.0" ?>
-        <freevo>
-          <playlist title="foo" random="1|0" repeat="1|0">
-            <cover-img>foo.jpg</cover-img>
-            <files>
-              <directory recursive="1|0">path</directory>
-              <file>filename</file>
-            </files>
-            <info>
-              <description>A nice description</description>
-            </info>
-          </playlist>
-        </freevo>
+            <?xml version="1.0" ?>
+            <freevo>
+                <playlist title="foo" random="1|0" repeat="1|0">
+                    <cover-img>foo.jpg</cover-img>
+                    <files>
+                        <directory recursive="1|0">path</directory>
+                        <file>filename</file>
+                    </files>
+                    <info>
+                        <description>A nice description</description>
+                    </info>
+                </playlist>
+            </freevo>
         """
         children = fxd.get_children(node, 'files')
         dirname  = os.path.dirname(fxd.getattr(None, 'filename', ''))

Modified: branches/rel-1/freevo/ChangeLog
==============================================================================
--- branches/rel-1/freevo/ChangeLog     (original)
+++ branches/rel-1/freevo/ChangeLog     Mon Jan 21 14:01:42 2008
@@ -44,6 +44,7 @@
  * Fixed audio playlists when the the fxd file contains utf-8 characters 
(B#1865272)
  * Fixed manual record tv plug-in to work in December (B#1858008)
  * Fixed oneclick weather plug-in to allow non-ascii location names (B#1856597)
+ * Fixed play lists not handling absolute paths (B#1872465)
  * Fixed tv guide not scrolling to last channel from second channel (B#1858010)
  * Fixed web server favorites and edit_favorite to use name and duplicate 
detection (B#1857394)
 

Modified: branches/rel-1/freevo/src/playlist.py
==============================================================================
--- branches/rel-1/freevo/src/playlist.py       (original)
+++ branches/rel-1/freevo/src/playlist.py       Mon Jan 21 14:01:42 2008
@@ -110,8 +110,8 @@
         for line in playlist_lines:
             line = line.replace('\\', '/') # Fix MSDOS slashes
             try:
-                if os.path.exists(os.path.join(curdir,line)):
-                    self.playlist.append(os.path.join(curdir,line))
+                if os.path.exists(os.path.abspath(line)):
+                    self.playlist.append(os.path.abspath(line))
             except TypeError:
                 print 'Bad m3u playlist line in "%s":%r' % (plsname, line)
 
@@ -142,8 +142,8 @@
         for line in playlist_lines:
             if line.endswith('\r\n'):
                 line = line.replace('\\', '/') # Fix MSDOS slashes
-            if os.path.exists(os.path.join(curdir,line)):
-                self.playlist.append(os.path.join(curdir,line))
+            if os.path.exists(os.path.abspath(line)):
+                self.playlist.append(os.path.abspath(line))
 
 
 
@@ -190,7 +190,7 @@
                     ss_delay += [5]
 
                 for p in self.get_plugins:
-                    for i in p.get(self, [os.path.join(curdir, ss_name[0])]):
+                    for i in p.get(self, [os.path.abspath(ss_name[0])]):
                         if i.type == 'image':
                             i.name     = Unicode(ss_caption[0])
                             i.duration = int(ss_delay[0])
@@ -323,7 +323,7 @@
         """
         Playlist(playlist=self.playlist, parent=self.parent,
                  display_type=self.display_type, random=True,
-                 repeat=self.repeat).play(arg,menuw)
+                 repeat=self.repeat).play(arg, menuw)
 
 
     def play(self, arg=None, menuw=None):
@@ -423,9 +423,9 @@
                 rc.post_event(Event(AUDIO_LOG, arg=self.current_item.filename))
 
         if event in (INPUT_1, INPUT_2, INPUT_3, INPUT_4, INPUT_5) and \
-               event.arg and self.current_item and 
hasattr(self.current_item,'type'):
+               event.arg and self.current_item and hasattr(self.current_item, 
'type'):
             if (self.current_item.type == 'audio'):
-                
rc.post_event(Event(RATING,(event.arg,self.current_item.filename)))
+                rc.post_event(Event(RATING, (event.arg, 
self.current_item.filename)))
 
 
         if not menuw:

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to