@ -228,7 +228,7 @@ class DownloadJob(Job):
for pp in postprocessors :
for pp in postprocessors :
pp . prepare ( pathfmt )
pp . prepare ( pathfmt )
if archive and kwdict in archive:
if archive and archive. check ( kwdict ) :
pathfmt . fix_extension ( )
pathfmt . fix_extension ( )
self . handle_skip ( )
self . handle_skip ( )
return
return
@ -385,8 +385,23 @@ class DownloadJob(Job):
self . sleep = config ( " sleep " )
self . sleep = config ( " sleep " )
if not config ( " download " , True ) :
if not config ( " download " , True ) :
# monkey-patch method to do nothing and always return True
self . download = pathfmt . fix_extension
self . download = pathfmt . fix_extension
archive = config ( " archive " )
if archive :
path = util . expand_path ( archive )
try :
if " { " in path :
path = util . Formatter ( path ) . format_map ( kwdict )
self . archive = util . DownloadArchive ( path , self . extractor )
except Exception as exc :
self . extractor . log . warning (
" Failed to open download archive at ' %s ' ( ' %s : %s ' ) " ,
path , exc . __class__ . __name__ , exc )
else :
self . extractor . log . debug ( " Using download archive ' %s ' " , path )
skip = config ( " skip " , True )
skip = config ( " skip " , True )
if skip :
if skip :
self . _skipexc = None
self . _skipexc = None
@ -401,21 +416,10 @@ class DownloadJob(Job):
self . _skipcnt = 0
self . _skipcnt = 0
self . _skipmax = text . parse_int ( smax )
self . _skipmax = text . parse_int ( smax )
else :
else :
# monkey-patch methods to always return False
pathfmt . exists = lambda x = None : False
pathfmt . exists = lambda x = None : False
if self . archive :
archive = config ( " archive " )
self . archive . check = pathfmt . exists
if archive :
path = util . expand_path ( archive )
try :
if " { " in path :
path = util . Formatter ( path ) . format_map ( kwdict )
self . archive = util . DownloadArchive ( path , self . extractor )
except Exception as exc :
self . extractor . log . warning (
" Failed to open download archive at ' %s ' ( ' %s : %s ' ) " ,
path , exc . __class__ . __name__ , exc )
else :
self . extractor . log . debug ( " Using download archive ' %s ' " , path )
postprocessors = self . extractor . config_accumulate ( " postprocessors " )
postprocessors = self . extractor . config_accumulate ( " postprocessors " )
if postprocessors :
if postprocessors :