summaryrefslogtreecommitdiff
path: root/rapid/metadatavideo.py
diff options
context:
space:
mode:
authorJulien Valroff <julien@kirya.net>2011-04-08 07:09:54 +0200
committerJulien Valroff <julien@kirya.net>2011-04-08 07:09:54 +0200
commiteb4c5cc4472b16ce10401611140381e5ba5b6aca (patch)
tree6e52c0a981186a09ab8161a6bc99a999f32ac408 /rapid/metadatavideo.py
parent6866d4a5b74779f087b8e44148a49163d8b7327b (diff)
Imported Upstream version 0.4.0~alpha4upstream/0.4.0_alpha4
Diffstat (limited to 'rapid/metadatavideo.py')
-rw-r--r--rapid/metadatavideo.py17
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'