Author: duncan
Date: Sat Feb  9 16:20:09 2008
New Revision: 10353

Log:
[ 1890203 ] m3u with #EXTINF
Patch from owen applied


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   Sat Feb  9 16:20:09 2008
@@ -16,6 +16,7 @@
 == Release 1.7.7 (2008-??-??) ==
 --------------------------------
 
+ * Updated playlist to process "#EXTINF" comments in m3u files (F#1890203)
  * Updated Russian translation (B#1889826)
  * Updated tv guide with scheduled to record and favorite icons (F#1886621)
  * Updated tv program to stop reporting that a program is over (F#1886568)

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     Sat Feb  9 16:20:09 2008
@@ -101,7 +101,7 @@
 
         try:
             playlist_lines_dos = map(lambda l: l.strip(), lines)
-            playlist_lines = filter(lambda l: len(l) > 0 and l[0] != '#', 
playlist_lines_dos)
+            playlist_lines = filter(lambda l: len(l) > 0, playlist_lines_dos)
         except IndexError:
             print 'Bad m3u playlist file "%s"' % plsname
             return 0
@@ -109,11 +109,17 @@
         (curdir, playlistname) = os.path.split(plsname)
         #XXX this may not work if the curdir is not accessible
         os.chdir(curdir)
-        for line in playlist_lines:
+        for i in range(0,len(playlist_lines)):
+            if playlist_lines[i][0] == "#":
+                continue
+            line = playlist_lines[i]
             line = line.replace('\\', '/') # Fix MSDOS slashes
             try:
                 if line.find('://') > 0:
-                    self.playlist.append(line)
+                    if playlist_lines[i-1].find('#EXTINF') > -1 and 
len(playlist_lines[i-1].split(","))>1:
+                        
self.playlist.append((line,playlist_lines[i-1].split(",")[1]))
+                    else:
+                        self.playlist.append(line)
                 elif os.path.isabs(line):
                     if os.path.exists(line):
                         self.playlist.append(line)
@@ -321,7 +327,14 @@
             if not callable(item):
                 # get a real item
                 for p in self.get_plugins:
-                    items += p.get(self, [ item ])
+                    if isinstance(item,(tuple)):
+                        mi = p.get(self, [ item[0] ])
+                        if len(mi) > 0:
+                            mi[0].name=item[1]
+                            mi[0].description=item[1]
+                        items += mi
+                    else:
+                        items += p.get(self, [ item ])
             else:
                 items.append(item)
 

Modified: branches/rel-1/freevo/ChangeLog
==============================================================================
--- branches/rel-1/freevo/ChangeLog     (original)
+++ branches/rel-1/freevo/ChangeLog     Sat Feb  9 16:20:09 2008
@@ -19,6 +19,7 @@
 == Release 1.7.7 (2008-??-??) ==
 --------------------------------
 
+ * Updated playlist to process "#EXTINF" comments in m3u files (F#1890203)
  * Updated Russian translation (B#1889826)
  * Updated tv guide with scheduled to record and favorite icons (F#1886621)
  * Updated tv program to stop reporting that a program is over (F#1886568)

Modified: branches/rel-1/freevo/src/playlist.py
==============================================================================
--- branches/rel-1/freevo/src/playlist.py       (original)
+++ branches/rel-1/freevo/src/playlist.py       Sat Feb  9 16:20:09 2008
@@ -101,7 +101,7 @@
 
         try:
             playlist_lines_dos = map(lambda l: l.strip(), lines)
-            playlist_lines = filter(lambda l: len(l) > 0 and l[0] != '#', 
playlist_lines_dos)
+            playlist_lines = filter(lambda l: len(l) > 0, playlist_lines_dos)
         except IndexError:
             print 'Bad m3u playlist file "%s"' % plsname
             return 0
@@ -109,11 +109,17 @@
         (curdir, playlistname) = os.path.split(plsname)
         #XXX this may not work if the curdir is not accessible
         os.chdir(curdir)
-        for line in playlist_lines:
+        for i in range(0,len(playlist_lines)):
+            if playlist_lines[i][0] == "#":
+                continue
+            line = playlist_lines[i]
             line = line.replace('\\', '/') # Fix MSDOS slashes
             try:
                 if line.find('://') > 0:
-                    self.playlist.append(line)
+                    if playlist_lines[i-1].find('#EXTINF') > -1 and 
len(playlist_lines[i-1].split(","))>1:
+                        
self.playlist.append((line,playlist_lines[i-1].split(",")[1]))
+                    else:
+                        self.playlist.append(line)
                 elif os.path.isabs(line):
                     if os.path.exists(line):
                         self.playlist.append(line)
@@ -321,7 +327,14 @@
             if not callable(item):
                 # get a real item
                 for p in self.get_plugins:
-                    items += p.get(self, [ item ])
+                    if isinstance(item,(tuple)):
+                        mi = p.get(self, [ item[0] ])
+                        if len(mi) > 0:
+                            mi[0].name=item[1]
+                            mi[0].description=item[1]
+                        items += mi
+                    else:
+                        items += p.get(self, [ item ])
             else:
                 items.append(item)
 

-------------------------------------------------------------------------
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