diff --git a/vollerei/cli/hsr.py b/vollerei/cli/hsr.py index fc5f052..f881c19 100644 --- a/vollerei/cli/hsr.py +++ b/vollerei/cli/hsr.py @@ -148,7 +148,7 @@ class VoicepackUpdateAll(Command): game_info = State.game.get_remote_game(pre_download=pre_download) except Exception as e: progress.finish( - f"Update checking failed with following error: {e} ({e.__context__})" + f"Update checking failed with following error: {e} \n({traceback.format_exc()})" ) return if update_diff is None: @@ -192,7 +192,7 @@ class VoicepackUpdateAll(Command): ) except Exception as e: progress.finish( - f"Couldn't apply update: {e} ({e.__context__})" + f"Couldn't apply update: {e} \n({traceback.format_exc()})" ) return progress.finish( @@ -228,7 +228,7 @@ class UpdatePatchCommand(Command): patcher.update_patch() except PatchUpdateError as e: progress.finish( - f"Patch update failed with following error: {e} ({e.__context__})" + f"Patch update failed with following error: {e} \n({traceback.format_exc()})" ) else: progress.finish("Patch updated!") @@ -246,7 +246,7 @@ class PatchInstallCommand(Command): jadeite_dir = patcher.patch_game(game=State.game) except PatcherError as e: progress.finish( - f"Patch installation failed with following error: {e} ({e.__context__})" + f"Patch installation failed with following error: {e} \n({traceback.format_exc()})" ) return progress.finish("Patch installed!") @@ -279,7 +279,7 @@ class PatchInstallCommand(Command): patcher.patch_game(game=State.game) except PatcherError as e: progress.finish( - f"Patch installation failed with following error: {e} ({e.__context__})" + f"Patch installation failed with following error: {e} \n({traceback.format_exc()})" ) return progress.finish("Patch installed!") @@ -327,7 +327,7 @@ class PatchInstallCommand(Command): patcher.block_telemetry(telemetry_list=telemetry_list) except Exception as e: self.line_error( - f"Couldn't block telemetry hosts: {e.__context__}" + f"Couldn't block telemetry hosts: {traceback.format_exc()}" ) # There's a good reason for this. if system() != "Windows": @@ -344,7 +344,7 @@ class PatchInstallCommand(Command): patcher.update_patch() except PatchUpdateError as e: progress.finish( - f"Patch update failed with following error: {e} ({e.__context__})" + f"Patch update failed with following error: {e} \n({traceback.format_exc()})" ) else: progress.finish("Patch updated.") @@ -386,7 +386,7 @@ class PatchTelemetryCommand(Command): patcher.block_telemetry(telemetry_list=telemetry_list) except Exception as e: self.line_error( - f"Couldn't block telemetry hosts: {e.__context__}" + f"Couldn't block telemetry hosts: {traceback.format_exc()}" ) else: progress.finish("No telemetry hosts found.") @@ -436,9 +436,8 @@ class UpdateCommand(Command): update_diff = State.game.get_update(pre_download=pre_download) game_info = State.game.get_remote_game(pre_download=pre_download) except Exception as e: - print(traceback.format_exc()) progress.finish( - f"Update checking failed with following error: {e} ({e.__context__})" + f"Update checking failed with following error: {e} \n({traceback.format_exc()})" ) return if update_diff is None or isinstance(game_info.major, str | None): @@ -475,7 +474,7 @@ class UpdateCommand(Command): State.game.apply_update_archive(out_path, auto_repair=auto_repair) except Exception as e: progress.finish( - f"Couldn't apply update: {e} ({e.__context__})" + f"Couldn't apply update: {e} \n({traceback.format_exc()})" ) return progress.finish("Update applied for base game.") @@ -506,7 +505,7 @@ class UpdateCommand(Command): ) except Exception as e: progress.finish( - f"Couldn't apply update: {e} ({e.__context__})" + f"Couldn't apply update: {e} \n({traceback.format_exc()})" ) return progress.finish( @@ -543,7 +542,7 @@ class RepairCommand(Command): State.game.repair_game() except Exception as e: progress.finish( - f"Repairation failed with following error: {e} ({e.__context__})" + f"Repairation failed with following error: {e} \n({traceback.format_exc()})" ) return progress.finish("Repairation completed.") @@ -579,10 +578,10 @@ class UpdateDownloadCommand(Command): game_info = State.game.get_remote_game(pre_download=pre_download) except Exception as e: progress.finish( - f"Update checking failed with following error: {e} ({e.__context__})" + f"Update checking failed with following error: {e} \n({traceback.format_exc()})" ) return - if update_diff is None: + if update_diff is None or isinstance(game_info.major, str | None): progress.finish("Game is already updated.") return progress.finish("Update available.") @@ -590,16 +589,17 @@ class UpdateDownloadCommand(Command): f"The current version is: {State.game.get_version_str()}" ) self.line( - f"The latest version is: {game_info.latest.version}" + f"The latest version is: {game_info.major.version}" ) if not self.confirm("Do you want to download the update?"): self.line("Download aborted.") return self.line("Downloading update package...") - out_path = State.game.cache.joinpath(update_diff.name) + update_game_url = update_diff.game_pkgs[0].url + out_path = State.game.cache.joinpath(PurePath(update_game_url).name) try: download_result = utils.download( - update_diff.path, out_path, file_len=update_diff.size + update_game_url, out_path, file_len=update_diff.game_pkgs[0].size ) except Exception as e: self.line_error(f"Couldn't download update: {e}") @@ -612,14 +612,14 @@ class UpdateDownloadCommand(Command): # Get installed voicepacks installed_voicepacks = State.game.get_installed_voicepacks() # Voicepack update - for remote_voicepack in update_diff.voice_packs: + for remote_voicepack in update_diff.audio_pkgs: if remote_voicepack.language not in installed_voicepacks: continue # Voicepack is installed, update it - archive_file = State.game.cache.joinpath(remote_voicepack.name) + archive_file = State.game.cache.joinpath(PurePath(remote_voicepack.url).name) try: download_result = utils.download( - remote_voicepack.path, archive_file, file_len=update_diff.size + remote_voicepack.url, archive_file, file_len=remote_voicepack.size ) except Exception as e: self.line_error(f"Couldn't download update: {e}") @@ -652,7 +652,7 @@ class ApplyUpdateArchive(Command): State.game.apply_update_archive(update_archive, auto_repair=auto_repair) except Exception as e: progress.finish( - f"Couldn't apply update: {e} ({e.__context__})" + f"Couldn't apply update: {e} \n({traceback.format_exc()})" ) return progress.finish("Update applied.")