Author: dmeyer
Date: Thu Jan 17 15:41:31 2008
New Revision: 10292

Log:
cosmetic changes

Modified:
   trunk/ui/src/playlist.py

Modified: trunk/ui/src/playlist.py
==============================================================================
--- trunk/ui/src/playlist.py    (original)
+++ trunk/ui/src/playlist.py    Thu Jan 17 15:41:31 2008
@@ -113,12 +113,11 @@
         This is the (m3u) playlist reading function.
         """
         pl_lines = [ l for l in content if not l.startswith('#') ]
-        curdir = os.path.split(plsname)[0]
+        curdir = os.path.dirname(plsname)
 
         playlist = []
         for line in pl_lines:
-            if line.endswith('\r\n'):
-                line = line.replace('\\', '/') # Fix MSDOS slashes
+            line = line.replace('\\', '/').strip()
             if os.path.exists(os.path.join(curdir,line)):
                 playlist.append(os.path.join(curdir,line))
         return playlist
@@ -131,17 +130,16 @@
         Arguments: plsname  - the playlist filename
         Returns:   The list of interesting lines in the playlist
         """
-        pl_lines = filter(lambda l: l[0:4] == 'File', content)
+        pl_lines = [ l for l in content if l.startswith('File') ]
         for pos, line in enumerate(pl_lines):
             numchars=line.find("=")+1
             if numchars > 0:
                 pl_lines[pos] = line[numchars:]
-        curdir = os.path.split(plsname)[0]
+        curdir = os.path.dirname(plsname)
 
         playlist = []
         for line in pl_lines:
-            if line.endswith('\r\n'):
-                line = line.replace('\\', '/') # Fix MSDOS slashes
+            line = line.replace('\\', '/').strip()
             if os.path.exists(os.path.join(curdir,line)):
                 playlist.append(os.path.join(curdir,line))
         return playlist
@@ -162,9 +160,9 @@
             self.set_url(self._playlist)
             log.info('create playlist for %s' % self._playlist)
             try:
-                f=open(self._playlist, "r")
+                f = open(self._playlist)
                 content = map(lambda l: l.strip(' \n\r'), f.readlines())
-                f.close
+                f.close()
                 if content and content[0].find("[playlist]") > -1:
                     self._playlist = self._read_pls(self._playlist, content)
                 else:

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