Browse Source

Change reduce time taken to parse avi RIFF metadata during post processing and other times.

Change avi metadata extraction is more fault tolerant and the chance of hanging due to corrupt avi files is reduced.
pull/799/head
JackDandy 9 years ago
parent
commit
d0ab6db706
  1. 2
      CHANGES.md
  2. 2
      HACKS.txt
  3. 4
      lib/hachoir_metadata/metadata.py
  4. 8
      lib/hachoir_metadata/riff.py
  5. 2
      sickbeard/common.py

2
CHANGES.md

@ -179,6 +179,8 @@
* Fix never set episodes without airdate to wanted
* Change improve getting the local timezone information
* Change hachoir_parser to close input stream if no parser is found e.g. due to file corruption
* Change reduce time taken to parse avi RIFF metadata during post processing and other times
* Change avi metadata extraction is more fault tolerant and the chance of hanging due to corrupt avi files is reduced
[develop changelog]
* Change send nzb data to NZBGet for Anizb instead of url

2
HACKS.txt

@ -4,6 +4,8 @@ Libs with customisations...
/lib/dateutil/zoneinfo/__init__.py
/lib/hachoir_core/config.py
/lib/hachoir_core/stream/input_helpers.py
/lib/hachoir_metadata/metadata.py
/lib/hachoir_metadata/riff.py
/lib/hachoir_parser/guess.py
/lib/lockfile/mkdirlockfile.py
/lib/pynma/pynma.py

4
lib/hachoir_metadata/metadata.py

@ -270,7 +270,7 @@ def registerExtractor(parser, extractor):
assert issubclass(extractor, RootMetadata)
extractors[parser] = extractor
def extractMetadata(parser, quality=QUALITY_NORMAL):
def extractMetadata(parser, quality=QUALITY_NORMAL, scan_index=True):
"""
Create a Metadata class from a parser. Returns None if no metadata
extractor does exist for the parser class.
@ -281,7 +281,7 @@ def extractMetadata(parser, quality=QUALITY_NORMAL):
return None
metadata = extractor(quality)
try:
metadata.extract(parser)
metadata.extract(parser, scan_index)
except HACHOIR_ERRORS, err:
error("Error during metadata extraction: %s" % unicode(err))
return None

8
lib/hachoir_metadata/riff.py

@ -23,7 +23,7 @@ class RiffMetadata(MultipleMetadata):
"IDIT": "creation_date",
}
def extract(self, riff):
def extract(self, riff, scan_index=True):
type = riff["type"].value
if type == "WAVE":
self.extractWAVE(riff)
@ -32,7 +32,7 @@ class RiffMetadata(MultipleMetadata):
computeAudioComprRate(self, size*8)
elif type == "AVI ":
if "headers" in riff:
self.extractAVI(riff["headers"])
self.extractAVI(riff["headers"], scan_index)
self.extractInfo(riff["headers"])
elif type == "ACON":
self.extractAnim(riff)
@ -142,7 +142,7 @@ class RiffMetadata(MultipleMetadata):
self.width = header["width"].value
self.height = header["height"].value
def extractAVI(self, headers):
def extractAVI(self, headers, scan_index=True):
audio_index = 1
for stream in headers.array("stream"):
if "stream_hdr/stream_type" not in stream:
@ -167,7 +167,7 @@ class RiffMetadata(MultipleMetadata):
self.bit_rate = float(headers["/movie/size"].value) * 8 / timedelta2seconds(self.get('duration'))
# Video has index?
if "/index" in headers:
if scan_index and "/index" in headers:
self.comment = _("Has audio/video index (%s)") \
% humanFilesize(headers["/index"].size/8)

2
sickbeard/common.py

@ -261,7 +261,7 @@ class Quality:
logger.log(traceback.format_exc(), logger.DEBUG)
if parser:
extract = extractMetadata(parser)
extract = extractMetadata(parser, scan_index=False)
if extract:
try:
height = extract.get('height')

Loading…
Cancel
Save