[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:
derrod 2023-06-18 00:11:18 +02:00
parent 4145381b93
commit 96b155800a

View file

@ -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: