diff --git a/ChangeLog b/ChangeLog index 02a046b..121c486 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2012-12-06 Thomas Vander Stichele + + * 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 * morituri/common/encode.py: 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)