updated fastdl_sync with gmod stuff. used specific path structures that i was asked to use.

This commit is contained in:
jenz
2025-07-26 15:36:27 +02:00
parent 0045b37f29
commit f174a8a5b1
7 changed files with 118 additions and 102 deletions
+96 -13
View File
@@ -1,36 +1,119 @@
#!/usr/local/bin/python3.5
import subprocess
import subprocess
import sys
def compare_lists(docker_find, ovh_find):
d = []
d = []
for file_docker in docker_find:
file_name_docker = str(file_docker).split("/", -1)[-1].replace("'", '')
found = False
for file_ovh in ovh_find:
file_name_ovh = str(file_ovh).split("/", -1)[-1].replace("'", '')
if file_name_ovh == file_name_docker:
found = True
break
found = True
break
if not found:
d.append(file_docker)
d.append(file_docker)
return d
def files_to_move(files, directory):
def files_to_move(files):
for file in files:
file = file.decode("utf-8")
str1 = f"docker cp debian-server:{file} ../gmod_zs/fastdl/{directory}/"
#print(str1)
wanted_path = file.split("/garrysmod/")[1]
wanted_path = wanted_path.rsplit("/", 1)[0]
str1 = f"docker cp debian-server:{file} ../gmod_zs/fastdl/{wanted_path}"
#print('str1: ', str1)
##sys.exit(1)
subprocess.Popen([f"mkdir -p ../gmod_zs/fastdl/{wanted_path}"], shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL).communicate()[0]
subprocess.Popen([str1], shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL).communicate()[0]
if __name__ == "__main__":
#find maps in docker
docker_find = subprocess.Popen(["docker exec debian-server find /home/gameservers_zs/gmod_zs_1/garrysmod/maps -type f"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].splitlines()
#find maps on our OVH machine
ovh_find = subprocess.Popen(["find /home/gameservers/gmod_zs/fastdl/maps/ -type f"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].splitlines()
#if maps are in docker but not OVH we need to list them
maps_to_move = compare_lists(docker_find, ovh_find)
content_to_move = compare_lists(docker_find, ovh_find)
#move the files to OVH.
files_to_move(maps_to_move, "maps")
files_to_move(content_to_move)
#find gamemodes in docker
docker_find = subprocess.Popen(["docker exec debian-server find /home/gameservers_zs/gmod_zs_1/garrysmod/gamemodes/zombiesurvival/content/ -type f"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].splitlines()
#find gamemodes on our OVH machine
ovh_find = subprocess.Popen(["find /home/gameservers/gmod_zs/fastdl/gamemodes/zombiesurvival/content/ -type f"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].splitlines()
#if are in docker but not OVH we need to list them
content_to_move = compare_lists(docker_find, ovh_find)
#move the files to OVH.
files_to_move(content_to_move)
docker_find = subprocess.Popen(["docker exec debian-server find /home/gameservers_zs/gmod_zs_1/garrysmod/addons/atlaschat/materials/ -type f"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].splitlines()
ovh_find = subprocess.Popen(["find /home/gameservers/gmod_zs/fastdl/gamemodes/addons/atlaschat/materials/ -type f"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].splitlines()
content_to_move = compare_lists(docker_find, ovh_find)
#move the files to OVH.
files_to_move(content_to_move)
docker_find = subprocess.Popen(["docker exec debian-server find /home/gameservers_zs/gmod_zs_1/garrysmod/addons/atlaschat/resource/ -type f"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].splitlines()
ovh_find = subprocess.Popen(["find /home/gameservers/gmod_zs/fastdl/gamemodes/addons/atlaschat/resource/ -type f"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].splitlines()
content_to_move = compare_lists(docker_find, ovh_find)
#move the files to OVH.
files_to_move(content_to_move)
docker_find = subprocess.Popen(["docker exec debian-server find /home/gameservers_zs/gmod_zs_1/garrysmod/addons/uzscontent/materials/ -type f"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].splitlines()
ovh_find = subprocess.Popen(["find /home/gameservers/gmod_zs/fastdl/gamemodes/addons/uzscontent/materials/ -type f"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].splitlines()
content_to_move = compare_lists(docker_find, ovh_find)
#move the files to OVH.
files_to_move(content_to_move)
docker_find = subprocess.Popen(["docker exec debian-server find /home/gameservers_zs/gmod_zs_1/garrysmod/addons/uzscontent/models/ -type f"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].splitlines()
ovh_find = subprocess.Popen(["find /home/gameservers/gmod_zs/fastdl/gamemodes/addons/uzscontent/models/ -type f"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].splitlines()
content_to_move = compare_lists(docker_find, ovh_find)
#move the files to OVH.
files_to_move(content_to_move)
docker_find = subprocess.Popen(["docker exec debian-server find /home/gameservers_zs/gmod_zs_1/garrysmod/addons/uzscontent/particles/ -type f"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].splitlines()
ovh_find = subprocess.Popen(["find /home/gameservers/gmod_zs/fastdl/gamemodes/addons/uzscontent/particles/ -type f"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].splitlines()
content_to_move = compare_lists(docker_find, ovh_find)
#move the files to OVH.
files_to_move(content_to_move)
docker_find = subprocess.Popen(["docker exec debian-server find /home/gameservers_zs/gmod_zs_1/garrysmod/addons/uzscontent/resource/ -type f"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].splitlines()
ovh_find = subprocess.Popen(["find /home/gameservers/gmod_zs/fastdl/gamemodes/addons/uzscontent/resource/ -type f"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].splitlines()
content_to_move = compare_lists(docker_find, ovh_find)
#move the files to OVH.
files_to_move(content_to_move)
docker_find = subprocess.Popen(["docker exec debian-server find /home/gameservers_zs/gmod_zs_1/garrysmod/addons/uzscontent/sound/ -type f"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].splitlines()
ovh_find = subprocess.Popen(["find /home/gameservers/gmod_zs/fastdl/gamemodes/addons/uzscontent/sound/ -type f"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].splitlines()
content_to_move = compare_lists(docker_find, ovh_find)
#move the files to OVH.
files_to_move(content_to_move)
docker_find = subprocess.Popen(["docker exec debian-server find /home/gameservers_zs/gmod_zs_1/garrysmod/addons/vipmodels/materials/ -type f"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].splitlines()
ovh_find = subprocess.Popen(["find /home/gameservers/gmod_zs/fastdl/gamemodes/addons/vipmodels/materials/ -type f"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].splitlines()
content_to_move = compare_lists(docker_find, ovh_find)
#move the files to OVH.
files_to_move(content_to_move)
docker_find = subprocess.Popen(["docker exec debian-server find /home/gameservers_zs/gmod_zs_1/garrysmod/addons/vipmodels/models/ -type f"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].splitlines()
ovh_find = subprocess.Popen(["find /home/gameservers/gmod_zs/fastdl/gamemodes/addons/vipmodels/models/ -type f"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].splitlines()
content_to_move = compare_lists(docker_find, ovh_find)
#move the files to OVH.
files_to_move(content_to_move)
docker_find = subprocess.Popen(["docker exec debian-server find /home/gameservers_zs/gmod_zs_1/garrysmod/addons/wepmodels/models/ -type f"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].splitlines()
ovh_find = subprocess.Popen(["find /home/gameservers/gmod_zs/fastdl/gamemodes/addons/wepmodels/models/ -type f"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].splitlines()
content_to_move = compare_lists(docker_find, ovh_find)
#move the files to OVH.
files_to_move(content_to_move)