Browse files

make it more robust and get more data

  • Loading branch information...
1 parent b24af0a commit 4105a0a0a87b08cba9677c0cf2bb274ff61be4df @cyberdelia committed Feb 7, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 metadata/__init__.py
View
7 metadata/__init__.py
@@ -1,7 +1,7 @@
from hachoir_core.cmd_line import unicodeFilename
from hachoir_core.error import HachoirError
from hachoir_core.stream import InputIOStream
-from hachoir_metadata import extractMetadata
+from hachoir_metadata import config, extractMetadata
from hachoir_parser import guessParser
@@ -22,8 +22,11 @@ def __init__(self, file):
super(Metadata, self).__init__(data)
def extract_metadata(self, file):
+ config.MAX_STR_LENGTH = float("inf")
try:
- filename = unicodeFilename(file.name)
+ filename = file.name
+ if not isinstance(filename, unicode):
+ filename = unicodeFilename(filename)
stream = InputIOStream(file, source="file:%s" % filename, tags=[], filename=filename)
parser = guessParser(stream)
return extractMetadata(parser)

0 comments on commit 4105a0a

Please sign in to comment.