[SCM] morituri/master: * morituri/common/common.py: Strip bitrate tags too for comparison of dicts. Add a way to show us the different keys between dicts. * morituri/common/encode.py: Debug different keys.

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


The following commit has been merged in the master branch:
commit 90a8d4992ce267e59825a6b77d3af432c02fba8f
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Thu Dec 6 17:28:24 2012 +0000

    	* morituri/common/common.py:
    	  Strip bitrate tags too for comparison of dicts.
    	  Add a way to show us the different keys between dicts.
    	* morituri/common/encode.py:
    	  Debug different keys.

diff --git a/ChangeLog b/ChangeLog
index 02a046b..121c486 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2012-12-06  Thomas Vander Stichele  <thomas at apestaart dot org>
 
+	* morituri/common/common.py:
+	  Strip bitrate tags too for comparison of dicts.
+	  Add a way to show us the different keys between dicts.
+	* morituri/common/encode.py:
+	  Debug different keys.
+
+2012-12-06  Thomas Vander Stichele  <thomas at apestaart dot org>
+
 	* morituri/common/encode.py:
 	  Collect all tags by replacing from newer tag messages.
 	  Gets more than bitrate from flacs now.
diff --git a/morituri/common/common.py b/morituri/common/common.py
index 354d3b2..baf4638 100644
--- a/morituri/common/common.py
+++ b/morituri/common/common.py
@@ -121,7 +121,8 @@ def formatTime(seconds, fractional=3):
 
 def tagListToDict(tl):
     """
-    Removes audio-codec and video-codec since we never set them ourselves.
+    Converts gst.TagList to dict.
+    Also strips it of tags that are not writable.
     """
     import gst
 
@@ -130,7 +131,13 @@ def tagListToDict(tl):
         if key == gst.TAG_DATE:
             date = tl[key]
             d[key] = "%4d-%2d-%2d" % (date.year, date.month, date.day)
-        elif key in [gst.TAG_AUDIO_CODEC, gst.TAG_VIDEO_CODEC]:
+        elif key in [
+            gst.TAG_AUDIO_CODEC,
+            gst.TAG_VIDEO_CODEC,
+            gst.TAG_MINIMUM_BITRATE,
+            gst.TAG_BITRATE,
+            gst.TAG_MAXIMUM_BITRATE,
+            ]:
             pass
         else:
             d[key] = tl[key]
@@ -144,6 +151,14 @@ def tagListEquals(tl1, tl2):
     return d1 == d2
 
 
+def tagListDifference(tl1, tl2):
+    d1 = tagListToDict(tl1)
+    d2 = tagListToDict(tl2)
+    return set(d1.keys()) - set(d2.keys())
+
+    return d1 == d2
+
+
 class MissingDependencyException(Exception):
     dependency = None
 
diff --git a/morituri/common/encode.py b/morituri/common/encode.py
index fe29bf2..7c4e2c6 100644
--- a/morituri/common/encode.py
+++ b/morituri/common/encode.py
@@ -491,6 +491,9 @@ class SafeRetagTask(ctask.LoggableMultiSeparateTask):
                 else:
                     self.debug('failed to update tags, only have %r',
                         common.tagListToDict(self.tasks[4].taglist))
+                    self.debug('difference: %r',
+                        common.tagListDifference(self.tasks[4].taglist,
+                            self._taglist))
                     os.unlink(self._tmppath)
                     e = TypeError("Tags not written")
                     self.setAndRaiseException(e)

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list