[SCM] morituri/master: * morituri/rip/cd.py: Factor out function to write .m3u lines.

js at users.alioth.debian.org js at users.alioth.debian.org
Sun Oct 19 20:09:24 UTC 2014


The following commit has been merged in the master branch:
commit b86cf683416499173d673f7b3bf9961ee063e681
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Sun May 22 11:12:16 2011 +0000

    	* morituri/rip/cd.py:
    	  Factor out function to write .m3u lines.

diff --git a/ChangeLog b/ChangeLog
index 7baad40..bb8c472 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2011-05-22  Thomas Vander Stichele  <thomas at apestaart dot org>
 
+	* morituri/rip/cd.py:
+	  Factor out function to write .m3u lines.
+
+2011-05-22  Thomas Vander Stichele  <thomas at apestaart dot org>
+
 	patch by: Loïc Minier <lool at dooz.org>
 
 	* morituri/rip/cd.py:
diff --git a/morituri/rip/cd.py b/morituri/rip/cd.py
index 116b498..ec9aa4f 100644
--- a/morituri/rip/cd.py
+++ b/morituri/rip/cd.py
@@ -274,26 +274,27 @@ See  http://sourceforge.net/tracker/?func=detail&aid=604751&group_id=2171&atid=1
         m3uPath = u'%s.m3u' % discName
         handle = open(m3uPath, 'w')
         handle.write(u'#EXTM3U\n')
-        if htoapath:
-            u = u'#EXTINF:%d,%s\n' % (
-                itable.getTrackStart(1) / common.FRAMES_PER_SECOND,
-                    os.path.basename(htoapath))
+
+        def writeFile(handle, path, length):
+            u = u'#EXTINF:%d,%s\n' % (length, os.path.basename(path))
             handle.write(u.encode('utf-8'))
-            u = '%s\n' % os.path.basename(htoapath)
+            u = '%s\n' % os.path.basename(path)
             handle.write(u.encode('utf-8'))
 
+
+        if htoapath:
+            writeFile(handle, htoapath,
+                itable.getTrackStart(1) / common.FRAMES_PER_SECOND)
+
         for i, track in enumerate(itable.tracks):
             if not track.audio:
                 continue
 
             path = prog.getPath(prog.outdir, self.options.track_template, 
                 mbdiscid, i + 1) + '.' + profile.extension
-            u = u'#EXTINF:%d,%s\n' % (
-                itable.getTrackLength(i + 1) / common.FRAMES_PER_SECOND,
-                os.path.basename(path))
-            handle.write(u.encode('utf-8'))
-            u = '%s\n' % os.path.basename(path)
-            handle.write(u.encode('utf-8'))
+            writeFile(handle, path,
+                itable.getTrackLength(i + 1) / common.FRAMES_PER_SECOND)
+
         handle.close()
 
         # verify using accuraterip

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list