[SCM] morituri/master: * morituri/common/checksum.py: Style fixes. * morituri/common/common.py: Add functions to convert a gst.TagList to a dict and compare them. * morituri/common/task.py: Add setAndRaiseException which gives us an appropriate exceptionMessage as if we raised where we called this new function.
js at users.alioth.debian.org
js at users.alioth.debian.org
Sun Oct 19 20:09:17 UTC 2014
The following commit has been merged in the master branch:
commit 7515cf9e7387d6cfcc03b25ec9bb7858e71fa2aa
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date: Tue Apr 13 21:53:43 2010 +0000
* morituri/common/checksum.py:
Style fixes.
* morituri/common/common.py:
Add functions to convert a gst.TagList to a dict and compare them.
* morituri/common/task.py:
Add setAndRaiseException which gives us an appropriate
exceptionMessage as if we raised where we called this new function.
diff --git a/ChangeLog b/ChangeLog
index 80f9737..08058b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2010-04-13 Thomas Vander Stichele <thomas at apestaart dot org>
+ * morituri/common/checksum.py:
+ Style fixes.
+ * morituri/common/common.py:
+ Add functions to convert a gst.TagList to a dict and compare them.
+ * morituri/common/task.py:
+ Add setAndRaiseException which gives us an appropriate
+ exceptionMessage as if we raised where we called this new function.
+
+2010-04-13 Thomas Vander Stichele <thomas at apestaart dot org>
+
* morituri/common/encode.py:
pychecker fix.
diff --git a/morituri/common/checksum.py b/morituri/common/checksum.py
index 5f990e1..00ecd63 100644
--- a/morituri/common/checksum.py
+++ b/morituri/common/checksum.py
@@ -32,11 +32,13 @@ from morituri.common import common, task
class ChecksumTask(task.Task):
"""
- I am a task that calculates a checksum.
+ I am a task that calculates a checksum of the decoded audio data.
@ivar checksum: the resulting checksum
"""
+ logCategory = 'ChecksumTask'
+
# this object needs a main loop to stop
description = 'Calculating checksum'
diff --git a/morituri/common/common.py b/morituri/common/common.py
index 1998d68..684efc4 100644
--- a/morituri/common/common.py
+++ b/morituri/common/common.py
@@ -182,3 +182,26 @@ class PersistedCache(object):
persister.delete()
return persister
+
+def tagListToDict(tl):
+ """
+ Removes audio-codec and video-codec since we never set them ourselves.
+ """
+ import gst
+
+ d = {}
+ for key in tl.keys():
+ 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]:
+ pass
+ else:
+ d[key] = tl[key]
+ return d
+
+def tagListEquals(tl1, tl2):
+ d1 = tagListToDict(tl1)
+ d2 = tagListToDict(tl2)
+
+ return d1 == d2
diff --git a/morituri/common/task.py b/morituri/common/task.py
index 2d8f377..cf4cc70 100644
--- a/morituri/common/task.py
+++ b/morituri/common/task.py
@@ -108,6 +108,24 @@ class Task(object, log.Loggable):
self._notifyListeners('described', description)
self.description = description
+ def setAndRaiseException(self, exception):
+ import traceback
+
+ stack = traceback.extract_stack()[:-1]
+ (filename, line, func, text) = stack[-1]
+ exc = exception.__class__.__name__
+ msg = ""
+ # a shortcut to extract a useful message out of most exceptions
+ # for now
+ if str(exception):
+ msg = ": %s" % str(exception)
+ line = "exception %(exc)s at %(filename)s:%(line)s: %(func)s()%(msg)s" \
+ % locals()
+
+ self.exception = exception
+ self.exceptionMessage = line
+ self.debug('set exception, %r' % self.exceptionMessage)
+
def setException(self, exception):
self.exception = exception
self.exceptionMessage = log.getExceptionMessage(exception)
--
morituri packaging
More information about the pkg-multimedia-commits
mailing list