1
This commit is contained in:
		
							
								
								
									
										44
									
								
								hlna.py
									
									
									
									
									
								
							
							
						
						
									
										44
									
								
								hlna.py
									
									
									
									
									
								
							| @@ -456,35 +456,31 @@ def modinstall(g, m): | |||||||
|  |  | ||||||
|  |  | ||||||
| def modextract(id_mod, id_game_workshop): | def modextract(id_mod, id_game_workshop): | ||||||
|     dir_steam_workshop = f"{dir_workshop_ark}/content/{id_game_workshop}/{id_mod}/WindowsNoEditor/" |     dir_steam_workshop = f"{dir_workshop_ark}/content/{id_game_workshop}/{id_mod}/WindowsNoEditor" | ||||||
|     dir_ark_mods = f"{dir_mods_ark}{id_mod}" |     dir_ark_mods = f"{dir_mods_ark}/{id_mod}" | ||||||
|     dir_extract = dir_ark_mods |     dir_extract = dir_ark_mods | ||||||
|  |  | ||||||
|     if id_mod == "111111111": |     if id_mod == "111111111": | ||||||
|         return |         return | ||||||
|  |  | ||||||
|     for dirpath, dirnames, filenames in os.walk(dir_steam_workshop): |     try: | ||||||
|         for dname in dirnames: |         for curdir, subdirs, files in os.walk(os.path.join(dir_steam_workshop)): | ||||||
|             os.makedirs(os.path.join(dir_extract, os.path.relpath(os.path.join(dirpath, dname), dir_steam_workshop)), exist_ok=True) |             for file in files: | ||||||
|             if not os.path.isdir(os.path.join(dir_steam_workshop, dname)): |                 name, ext = os.path.splitext(file) | ||||||
|                 shutil.rmtree(os.path.join(dir_extract, os.path.relpath(os.path.join(dirpath, dname), dir_steam_workshop))) |                 if ext == ".z": | ||||||
|  |                     src = os.path.join(curdir, file) | ||||||
|  |                     dst = os.path.join(curdir, name) | ||||||
|  |                     uncompressed = os.path.join(curdir, file + ".uncompressed_size") | ||||||
|  |                     unpack(src, dst) | ||||||
|  |                     print("[+] Extracted " + file) | ||||||
|  |                     os.remove(src) | ||||||
|  |                     if os.path.isfile(uncompressed): | ||||||
|  |                         os.remove(uncompressed) | ||||||
|  |     except (UnpackException, SignatureUnpackException, CorruptUnpackException) as e: | ||||||
|  |         print("[x] Unpacking .z files failed, aborting mod install") | ||||||
|  |         return False | ||||||
|  |  | ||||||
|         try: |     os.system(f"mv {dir_steam_workshop} {dir_mods_ark}") | ||||||
|             for curdir, subdirs, files in os.walk(os.path.join(dir_steam_workshop)): |  | ||||||
|                 for file in files: |  | ||||||
|                     name, ext = os.path.splitext(file) |  | ||||||
|                     if ext == ".z": |  | ||||||
|                         src = os.path.join(curdir, file) |  | ||||||
|                         dst = os.path.join(dir_extract, subdirs, name) |  | ||||||
|                         uncompressed = os.path.join(curdir, file + ".uncompressed_size") |  | ||||||
|                         unpack(src, dst) |  | ||||||
|                         print("[+] Extracted " + file) |  | ||||||
|                         os.remove(src) |  | ||||||
|                         if os.path.isfile(uncompressed): |  | ||||||
|                             os.remove(uncompressed) |  | ||||||
|         except (UnpackException, SignatureUnpackException, CorruptUnpackException) as e: |  | ||||||
|             print("[x] Unpacking .z files failed, aborting mod install") |  | ||||||
|             return False |  | ||||||
|  |  | ||||||
|     modname = subprocess.check_output(['curl', '-s', 'https://steamcommunity.com/sharedfiles/filedetails/?id={}'.format(id_mod)]).decode('utf-8') |     modname = subprocess.check_output(['curl', '-s', 'https://steamcommunity.com/sharedfiles/filedetails/?id={}'.format(id_mod)]).decode('utf-8') | ||||||
|     modname = re.search(r'<div class="workshopItemTitle">(.+)</div>', modname) |     modname = re.search(r'<div class="workshopItemTitle">(.+)</div>', modname) | ||||||
| @@ -779,7 +775,7 @@ dir_logs = f"{dir_config}logs/" | |||||||
| dir_server_ark = f"{dir_server}ARK/" | dir_server_ark = f"{dir_server}ARK/" | ||||||
| dir_server_exec = f"{dir_server_ark}ShooterGame/Binaries/Linux/" | dir_server_exec = f"{dir_server_ark}ShooterGame/Binaries/Linux/" | ||||||
| dir_workshop_ark = f"{home_dir}/.local/share/Steam/steamapps/workshop/" | dir_workshop_ark = f"{home_dir}/.local/share/Steam/steamapps/workshop/" | ||||||
| dir_mods_ark = f"{dir_server_ark}ShooterGame/Content/Mods/" | dir_mods_ark = f"{dir_server_ark}ShooterGame/Content/Mods" | ||||||
|  |  | ||||||
| dir_server_7days = f"{dir_server}/7Days/" | dir_server_7days = f"{dir_server}/7Days/" | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user