* 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.
This commit is contained in:
Thomas Vander Stichele
2012-12-06 17:28:24 +00:00
parent 90bb3a7371
commit 90a8d4992c
3 changed files with 28 additions and 2 deletions

View File

@@ -1,3 +1,11 @@
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:

View File

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

View File

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