1
0
Fork 0
mirror of synced 2024-06-17 10:04:43 +12:00

LegendaryUtils: Remove dead re-implemented functions

This commit is contained in:
loathingKernel 2022-07-11 23:03:17 +03:00
parent b4a1efa357
commit 9df3355200

View file

@ -131,58 +131,3 @@ def resolve_aliases(core: LegendaryCore, name):
fallback=core.lgd.aliases.get(name.lower(), name)
)
def import_game(core: LegendaryCore, app_name: str, path: str) -> str:
_tr = QCoreApplication.translate
logger.info(f"Import {app_name}")
game = core.get_game(app_name, update_meta=False)
if not game:
return _tr("LgdUtils", "Could not get game for {}").format(app_name)
if core.is_installed(app_name):
logger.error(f"{game.app_title} is already installed")
return _tr("LgdUtils", "{} is already installed").format(game.app_title)
if not os.path.exists(path):
logger.error("Path does not exist")
return _tr("LgdUtils", "Path does not exist")
manifest, igame = core.import_game(game, path)
exe_path = os.path.join(path, manifest.meta.launch_exe.lstrip("/"))
if not os.path.exists(exe_path):
logger.error(f"Launch Executable of {game.app_title} does not exist")
return _tr("LgdUtils", "Launch executable of {} does not exist").format(
game.app_title
)
if game.is_dlc:
release_info = game.metadata.get("mainGameItem", {}).get("releaseInfo")
if release_info:
main_game_appname = release_info[0]["appId"]
main_game_title = game.metadata["mainGameItem"]["title"]
if not core.is_installed(main_game_appname):
return _tr("LgdUtils", "Game is a DLC, but {} is not installed").format(
main_game_title
)
else:
return _tr("LgdUtils", "Unable to get base game information for DLC")
total = len(manifest.file_manifest_list.elements)
found = sum(
os.path.exists(os.path.join(path, f.filename))
for f in manifest.file_manifest_list.elements
)
ratio = found / total
if ratio < 0.9:
logger.warning(
"Game files are missing. It may be not the latest version or it is corrupt"
)
# return False
core.install_game(igame)
if igame.needs_verification:
logger.info(f"{igame.title} needs verification")
logger.info(f"Successfully imported Game: {game.app_title}")
return ""