diff options
author | Julien Valroff <julien@kirya.net> | 2011-04-08 07:09:55 +0200 |
---|---|---|
committer | Julien Valroff <julien@kirya.net> | 2011-04-08 07:09:55 +0200 |
commit | c7dff12ef94a1f5e5faa422444ebd2cf47b6b549 (patch) | |
tree | 028059e3a81327c18ec61f46bd30a3ed82a707ce /rapid/metadatavideo.py | |
parent | 4e2b25f9d85f23c51ae51a03049436a6778da69e (diff) | |
parent | eb4c5cc4472b16ce10401611140381e5ba5b6aca (diff) |
Merge commit 'upstream/0.4.0_alpha4' into experimental
Diffstat (limited to 'rapid/metadatavideo.py')
-rw-r--r-- | rapid/metadatavideo.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/rapid/metadatavideo.py b/rapid/metadatavideo.py index 144686a..7b6bc6c 100644 --- a/rapid/metadatavideo.py +++ b/rapid/metadatavideo.py @@ -41,7 +41,6 @@ try: except ImportError: DOWNLOAD_VIDEO = False - if DOWNLOAD_VIDEO: def version_info(): @@ -76,12 +75,9 @@ if DOWNLOAD_VIDEO: self.filename = filename self.u_filename = unicodeFilename(filename) - self.parser = createParser(self.u_filename, self.filename) - self.metadata = extractMetadata(self.parser) - + self.metadata = None def _kaa_get(self, key, missing, stream=None): - if not hasattr(self, 'info'): try: from kaa.metadata import parse @@ -104,7 +100,14 @@ It is needed to access FPS and codec video file metadata.""" else: return missing + def _load_hachoir_metadata_parser(self): + self.parser = createParser(self.u_filename, self.filename) + self.metadata = extractMetadata(self.parser) + def _get(self, key, missing): + if self.metadata is None: + self._load_hachoir_metadata_parser() + try: v = self.metadata.get(key) except: @@ -174,11 +177,11 @@ class DummyMetaData(): See VideoMetaData class for documentation of class methods. """ - def __init__(self): + def __init__(self, filename): pass def date_time(self, missing=''): - return date_time.date_time.now() + return datetime.datetime.now() def codec(self, stream=0, missing=''): return 'H.264 AVC' |