mirror of
https://github.com/derrod/legendary.git
synced 2024-12-22 01:45:28 +00:00
[downloader] Check if files exist before running analysis
This allows additional SDL tags to be installed without going through a repair. It will also now redownload deleted files if there's an update rather than just trusting what the old manifest says should be installed locally.
This commit is contained in:
parent
4145381b93
commit
96b155800a
|
@ -137,6 +137,24 @@ class DLManager(Process):
|
|||
except Exception as e:
|
||||
self.log.warning(f'Reading resume file failed: {e!r}, continuing as normal...')
|
||||
|
||||
elif resume:
|
||||
# Basic check if files exist locally, put all missing files into "added"
|
||||
# This allows new SDL tags to be installed without having to do a repair as well.
|
||||
missing_files = set()
|
||||
|
||||
for fm in manifest.file_manifest_list.elements:
|
||||
if fm.filename in mc.added:
|
||||
continue
|
||||
|
||||
local_path = os.path.join(self.dl_dir, fm.filename)
|
||||
if not os.path.exists(local_path):
|
||||
missing_files.add(fm.filename)
|
||||
|
||||
self.log.info(f'Found {len(missing_files)} missing files.')
|
||||
mc.added |= missing_files
|
||||
mc.changed -= missing_files
|
||||
mc.unchanged -= missing_files
|
||||
|
||||
# Install tags are used for selective downloading, e.g. for language packs
|
||||
additional_deletion_tasks = []
|
||||
if file_install_tag is not None:
|
||||
|
|
Loading…
Reference in a new issue