Commits

haypo  committed 1a51bcb

Metadata: truncate very long text

  • Participants
  • Parent commits b931c2a

Comments (0)

Files changed (1)

File hachoir-metadata/hachoir_metadata/metadata.py

 from hachoir_core.dict import Dict
 from hachoir_core.i18n import _
 
+MAX_STR_LENGTH = 80*10
+
 extractors = {}
 
 class Data:
             value = value.strip(" \t\v\n\r\0")
             if not value:
                 return
+            if MAX_STR_LENGTH < len(value):
+                value = value[:MAX_STR_LENGTH] + "(...)"
 
         # Skip duplicates
         data = self.__data[key]