[SCM] morituri/master: * morituri/common/program.py: If any track is missing duration, set the whole album duration to 0.

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


The following commit has been merged in the master branch:
commit 2ed3f8837f6787dbaf27ce406cfade24cbbea3db
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Sun Sep 4 14:19:29 2011 +0000

    	* morituri/common/program.py:
    	  If any track is missing duration, set the whole album duration
    	  to 0.

diff --git a/ChangeLog b/ChangeLog
index ae63641..0a65874 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2011-09-04  Thomas Vander Stichele  <thomas at apestaart dot org>
 
+	* morituri/common/program.py:
+	  If any track is missing duration, set the whole album duration
+	  to 0.
+
+2011-09-04  Thomas Vander Stichele  <thomas at apestaart dot org>
+
 	* morituri/common/gstreamer.py:
 	  flacparse is busted in gst-plugins-good 0.10.30 too.
 
diff --git a/morituri/common/program.py b/morituri/common/program.py
index c3d47fa..60022b1 100644
--- a/morituri/common/program.py
+++ b/morituri/common/program.py
@@ -92,13 +92,12 @@ def getMetadata(release):
     metadata.mbidArtist = urlparse.urlparse(release.artist.id)[2].split("/")[-1]
     metadata.url = release.getId()
 
-
+    tainted = False
     duration = 0
 
     for t in release.tracks:
         track = TrackMetadata()
-        track.duration = t.duration
-        duration += t.duration
+
         if isSingleArtist or t.artist == None:
             track.artist = metadata.artist
             track.sortName = metadata.sortName
@@ -111,9 +110,22 @@ def getMetadata(release):
 
         track.title = t.title
         track.mbid = urlparse.urlparse(t.id)[2].split("/")[-1]
+
+        track.duration = t.duration
+        if not track.duration:
+            log.warning('getMetadata',
+                'track %r (%r) does not have duration' % (
+                    track.title, track.mbid))
+            tainted = True
+        else:
+            duration += t.duration
+
         metadata.tracks.append(track)
 
-    metadata.duration = duration
+    if not tainted:
+        metadata.duration = duration
+    else:
+        metadata.duration = 0
 
     return metadata
 

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list