mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-22 01:23:43 +00:00
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.
This commit is contained in:
parent
171a981da2
commit
d0ab6db706
5 changed files with 11 additions and 7 deletions
|
@ -179,6 +179,8 @@
|
||||||
* Fix never set episodes without airdate to wanted
|
* Fix never set episodes without airdate to wanted
|
||||||
* Change improve getting the local timezone information
|
* 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 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]
|
[develop changelog]
|
||||||
* Change send nzb data to NZBGet for Anizb instead of url
|
* Change send nzb data to NZBGet for Anizb instead of url
|
||||||
|
|
|
@ -4,6 +4,8 @@ Libs with customisations...
|
||||||
/lib/dateutil/zoneinfo/__init__.py
|
/lib/dateutil/zoneinfo/__init__.py
|
||||||
/lib/hachoir_core/config.py
|
/lib/hachoir_core/config.py
|
||||||
/lib/hachoir_core/stream/input_helpers.py
|
/lib/hachoir_core/stream/input_helpers.py
|
||||||
|
/lib/hachoir_metadata/metadata.py
|
||||||
|
/lib/hachoir_metadata/riff.py
|
||||||
/lib/hachoir_parser/guess.py
|
/lib/hachoir_parser/guess.py
|
||||||
/lib/lockfile/mkdirlockfile.py
|
/lib/lockfile/mkdirlockfile.py
|
||||||
/lib/pynma/pynma.py
|
/lib/pynma/pynma.py
|
||||||
|
|
|
@ -270,7 +270,7 @@ def registerExtractor(parser, extractor):
|
||||||
assert issubclass(extractor, RootMetadata)
|
assert issubclass(extractor, RootMetadata)
|
||||||
extractors[parser] = extractor
|
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
|
Create a Metadata class from a parser. Returns None if no metadata
|
||||||
extractor does exist for the parser class.
|
extractor does exist for the parser class.
|
||||||
|
@ -281,7 +281,7 @@ def extractMetadata(parser, quality=QUALITY_NORMAL):
|
||||||
return None
|
return None
|
||||||
metadata = extractor(quality)
|
metadata = extractor(quality)
|
||||||
try:
|
try:
|
||||||
metadata.extract(parser)
|
metadata.extract(parser, scan_index)
|
||||||
except HACHOIR_ERRORS, err:
|
except HACHOIR_ERRORS, err:
|
||||||
error("Error during metadata extraction: %s" % unicode(err))
|
error("Error during metadata extraction: %s" % unicode(err))
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -23,7 +23,7 @@ class RiffMetadata(MultipleMetadata):
|
||||||
"IDIT": "creation_date",
|
"IDIT": "creation_date",
|
||||||
}
|
}
|
||||||
|
|
||||||
def extract(self, riff):
|
def extract(self, riff, scan_index=True):
|
||||||
type = riff["type"].value
|
type = riff["type"].value
|
||||||
if type == "WAVE":
|
if type == "WAVE":
|
||||||
self.extractWAVE(riff)
|
self.extractWAVE(riff)
|
||||||
|
@ -32,7 +32,7 @@ class RiffMetadata(MultipleMetadata):
|
||||||
computeAudioComprRate(self, size*8)
|
computeAudioComprRate(self, size*8)
|
||||||
elif type == "AVI ":
|
elif type == "AVI ":
|
||||||
if "headers" in riff:
|
if "headers" in riff:
|
||||||
self.extractAVI(riff["headers"])
|
self.extractAVI(riff["headers"], scan_index)
|
||||||
self.extractInfo(riff["headers"])
|
self.extractInfo(riff["headers"])
|
||||||
elif type == "ACON":
|
elif type == "ACON":
|
||||||
self.extractAnim(riff)
|
self.extractAnim(riff)
|
||||||
|
@ -142,7 +142,7 @@ class RiffMetadata(MultipleMetadata):
|
||||||
self.width = header["width"].value
|
self.width = header["width"].value
|
||||||
self.height = header["height"].value
|
self.height = header["height"].value
|
||||||
|
|
||||||
def extractAVI(self, headers):
|
def extractAVI(self, headers, scan_index=True):
|
||||||
audio_index = 1
|
audio_index = 1
|
||||||
for stream in headers.array("stream"):
|
for stream in headers.array("stream"):
|
||||||
if "stream_hdr/stream_type" not in 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'))
|
self.bit_rate = float(headers["/movie/size"].value) * 8 / timedelta2seconds(self.get('duration'))
|
||||||
|
|
||||||
# Video has index?
|
# Video has index?
|
||||||
if "/index" in headers:
|
if scan_index and "/index" in headers:
|
||||||
self.comment = _("Has audio/video index (%s)") \
|
self.comment = _("Has audio/video index (%s)") \
|
||||||
% humanFilesize(headers["/index"].size/8)
|
% humanFilesize(headers["/index"].size/8)
|
||||||
|
|
||||||
|
|
|
@ -261,7 +261,7 @@ class Quality:
|
||||||
logger.log(traceback.format_exc(), logger.DEBUG)
|
logger.log(traceback.format_exc(), logger.DEBUG)
|
||||||
|
|
||||||
if parser:
|
if parser:
|
||||||
extract = extractMetadata(parser)
|
extract = extractMetadata(parser, scan_index=False)
|
||||||
if extract:
|
if extract:
|
||||||
try:
|
try:
|
||||||
height = extract.get('height')
|
height = extract.get('height')
|
||||||
|
|
Loading…
Reference in a new issue