slave remembers previous modlist
This commit is contained in:
parent
e3df6b4276
commit
6ec11def3e
|
@ -15,7 +15,11 @@ def sync(delete=False):
|
|||
"""
|
||||
remote_mods =urllib.request.urlopen(config_slave.remote_addr+'/get').read()
|
||||
remote_mods = json.loads(remote_mods)
|
||||
local_mods = os.listdir('mods')
|
||||
if os.path.isfile('modlist.json'):
|
||||
with open('modlist.json', 'r') as file:
|
||||
local_mods = json.loads(file.read())
|
||||
else:
|
||||
local_mods = os.listdir('mods')
|
||||
|
||||
local_mods_del = [mod for mod in local_mods if mod not in remote_mods]
|
||||
remote_mods_get = [mod for mod in remote_mods if mod not in local_mods]
|
||||
|
@ -35,6 +39,8 @@ def sync(delete=False):
|
|||
with open(os.path.join('mods', mod), 'wb') as file:
|
||||
file.write(data)
|
||||
print(f"Downloaded {mod}")
|
||||
with open('modlist.json', 'w') as file:
|
||||
file.write(json.dumps(remote_mods))
|
||||
print("Success!")
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Reference in New Issue
Block a user