write skipped files to archive (closes #550)

This commit is contained in:
Mike Fährmann
2020-09-03 18:37:38 +02:00
parent ac3036ef56
commit b5243297ff
2 changed files with 12 additions and 5 deletions

View File

@@ -224,7 +224,14 @@ class DownloadJob(Job):
for pp in postprocessors: for pp in postprocessors:
pp.prepare(pathfmt) pp.prepare(pathfmt)
if pathfmt.exists(archive): if archive and kwdict in archive:
pathfmt.fix_extension()
self.handle_skip()
return
if pathfmt.exists():
if archive:
archive.add(kwdict)
self.handle_skip() self.handle_skip()
return return
@@ -248,6 +255,8 @@ class DownloadJob(Job):
return return
if not pathfmt.temppath: if not pathfmt.temppath:
if archive:
archive.add(kwdict)
self.handle_skip() self.handle_skip()
return return

View File

@@ -769,10 +769,8 @@ class PathFormat():
"""Open file and return a corresponding file object""" """Open file and return a corresponding file object"""
return open(self.temppath, mode) return open(self.temppath, mode)
def exists(self, archive=None): def exists(self):
"""Return True if the file exists on disk or in 'archive'""" """Return True if the file exists on disk"""
if archive and self.kwdict in archive:
return self.fix_extension()
if self.extension and os.path.exists(self.realpath): if self.extension and os.path.exists(self.realpath):
return self.check_file() return self.check_file()
return False return False