From 1e7b30a1be86208565b381b071309707e0b3e422 Mon Sep 17 00:00:00 2001 From: Neocky Date: Sun, 20 Jun 2021 13:54:15 +0200 Subject: [PATCH] Changed output when checking and removed debug output Changes: -removed update available columm and integrated it with colors of the plugin name - removed leftover debug output --- src/plugin/plugin_updatechecker.py | 24 +++++++++++++++--------- src/serverjar/serverjar_paper.py | 2 -- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/plugin/plugin_updatechecker.py b/src/plugin/plugin_updatechecker.py index 194944e..6086041 100644 --- a/src/plugin/plugin_updatechecker.py +++ b/src/plugin/plugin_updatechecker.py @@ -149,9 +149,9 @@ def checkInstalledPackage(inputSelectedObject="all", inputOptionalParam=None): print(oColors.brightBlack + f"Checking: {inputSelectedObject}" + oColors.standardWhite) if inputOptionalParam != "changelog": print(oColors.brightBlack + f"Use 'check {inputSelectedObject} changelog' to get the latest changelog from plugins" + oColors.standardWhite) - print("┌─────┬────────────────────────────────┬──────────────┬──────────────┬───────────────────┐") - print("│ No. │ Name │ Installed V. │ Latest V. │ Update available │") - print("└─────┴────────────────────────────────┴──────────────┴──────────────┴───────────────────┘") + print("┌─────┬────────────────────────────────┬──────────────┬──────────────┐") + print("│ No. │ Name │ Installed V. │ Latest V. │") + print("└─────┴────────────────────────────────┴──────────────┴──────────────┘") try: for plugin in track(pluginList, description="Checking for updates" ,transient=True, complete_style="bright_yellow"): if not configValues.localPluginFolder: @@ -222,10 +222,15 @@ def checkInstalledPackage(inputSelectedObject="all", inputOptionalParam=None): else: print(f" [{i+1}]".rjust(6), end='') print(" ", end='') - print(f"{fileName}".ljust(33), end='') + if pluginIsOutdated == True: + print(oColors.brightGreen + f"{fileName}".ljust(33) + oColors.standardWhite, end='') + elif pluginIsOutdated == False: + print(oColors.brightRed + f"{fileName}".ljust(33) + oColors.standardWhite, end='') + else: + print(f"{fileName}".ljust(33), end='') + print(f"{fileVersion}".ljust(15), end='') - print(f"{pluginLatestVersion}".ljust(15), end='') - print(f"{pluginIsOutdated}".ljust(5) + oColors.standardWhite) + print(f"{pluginLatestVersion}".ljust(15)) if (inputOptionalParam == "changelog" and pluginLatestVersion != 'N/A'): print(oColors.brightYellow + f"CHANGELOG {fileName}:" + oColors.standardWhite) description = getUpdateDescription(pluginId) @@ -252,11 +257,12 @@ def updateInstalledPackage(inputSelectedObject='all'): connection = createFTPConnection() try: - print(oColors.brightBlack + "Selected plugins:" + oColors.standardWhite) + print(oColors.brightBlack + "Selected plugins with available Updates:" + oColors.standardWhite) if inputSelectedObject == "all" or inputSelectedObject == "*": for pluginIndex in range(len(INSTALLEDPLUGINLIST)): - fileName = getFileName(INSTALLEDPLUGINLIST[pluginIndex][0]) - print(fileName, end=' ') + if INSTALLEDPLUGINLIST[pluginIndex][4] == True: + fileName = getFileName(INSTALLEDPLUGINLIST[pluginIndex][0]) + print(fileName, end=' ') else: print(inputSelectedObject, end=' ') diff --git a/src/serverjar/serverjar_paper.py b/src/serverjar/serverjar_paper.py index a33b3ec..2f9015b 100644 --- a/src/serverjar/serverjar_paper.py +++ b/src/serverjar/serverjar_paper.py @@ -142,7 +142,6 @@ def paperCheckForUpdate(installedServerjarFullName): if not paperVersionBehind: print(oColors.brightRed + f"ERR: An error was encountered while detecting how many versions behind you are. " f"Will display as 'N/A'." + oColors.standardWhite) - print(paperVersionBehind) paperVersionBehind = "N/A" # Sets paperVersionBehind to N/A while still letting the versionBehind check return # False for error-handing reasons. @@ -195,7 +194,6 @@ def papermc_downloader(paperBuild='latest', installedServerjarName=None, mcVersi downloadPath = createTempPluginFolder() url = f"https://papermc.io/api/v2/projects/paper/versions/{mcVersion}/builds/{paperBuild}/downloads/{downloadFileName}" - print(url) remotefile = urllib.request.urlopen(url) filesize = remotefile.info()['Content-Length'] print(f"Getting Paper {paperBuild} for {mcVersion}")