mirror of
https://github.com/derrod/legendary.git
synced 2024-12-22 17:55:27 +00:00
Skip files with the same hash
This commit is contained in:
parent
572bce21af
commit
0b3555d4c1
|
@ -55,7 +55,7 @@ class SaveGameHelper:
|
||||||
epic_id: str = '', cloud_folder: str = '',
|
epic_id: str = '', cloud_folder: str = '',
|
||||||
include_filter: list = None,
|
include_filter: list = None,
|
||||||
exclude_filter: list = None,
|
exclude_filter: list = None,
|
||||||
manifest_dt: datetime = None):
|
manifest_dt: datetime = None, ok_files: dict = None, ok_chunks: set = None):
|
||||||
"""
|
"""
|
||||||
:param input_folder: Folder to be packaged into chunks/manifest
|
:param input_folder: Folder to be packaged into chunks/manifest
|
||||||
:param app_name: App name for savegame being stored
|
:param app_name: App name for savegame being stored
|
||||||
|
@ -104,6 +104,10 @@ class SaveGameHelper:
|
||||||
cur_buffer = None
|
cur_buffer = None
|
||||||
|
|
||||||
for _file in sorted(files, key=str.casefold):
|
for _file in sorted(files, key=str.casefold):
|
||||||
|
if ok_files:
|
||||||
|
if ok_file_manifest := ok_files.get(_file, None):
|
||||||
|
m.file_manifest_list.elements.append(ok_file_manifest)
|
||||||
|
continue
|
||||||
s = os.stat(_file)
|
s = os.stat(_file)
|
||||||
f = FileManifest()
|
f = FileManifest()
|
||||||
# get relative path for manifest
|
# get relative path for manifest
|
||||||
|
@ -146,6 +150,9 @@ class SaveGameHelper:
|
||||||
f.hash = fhash.digest()
|
f.hash = fhash.digest()
|
||||||
m.file_manifest_list.elements.append(f)
|
m.file_manifest_list.elements.append(f)
|
||||||
|
|
||||||
|
if ok_chunks:
|
||||||
|
m.chunk_data_list.elements.extend(ok_chunks)
|
||||||
|
|
||||||
# write remaining chunk if it exists
|
# write remaining chunk if it exists
|
||||||
if cur_chunk:
|
if cur_chunk:
|
||||||
cur_chunk.data = cur_buffer.getvalue()
|
cur_chunk.data = cur_buffer.getvalue()
|
||||||
|
|
Loading…
Reference in a new issue