Optimized config handling & beautified output

Changes:
- optimized config handling
- added spinner to paper download
- changed progress bar colors
- better output for updating paper version
- misc code cleanup
This commit is contained in:
Neocky
2021-03-27 18:58:16 +01:00
parent fddc0c252c
commit 205a13ee94
5 changed files with 47 additions and 46 deletions

View File

@@ -85,6 +85,7 @@ def searchPackage(ressourceName):
def downloadSpecificVersion(ressourceId, downloadPath, versionID='latest'):
configValues = configurationValues()
if versionID != 'latest':
#url = f"https://spigotmc.org/resources/{ressourceId}/download?version={versionID}"
print(oColors.brightRed + "Sorry but specific version downloads aren't supported because of cloudflare protection. :(" + oColors.standardWhite)
@@ -104,7 +105,7 @@ def downloadSpecificVersion(ressourceId, downloadPath, versionID='latest'):
else:
filesizeData = calculateFileSizeKb(filesize)
print("Downloaded " + (str(filesizeData)).rjust(9) + f" KB here {downloadPath}")
if not configurationValues.localPluginFolder:
if not configValues.localPluginFolder:
sftpSession = createSFTPConnection()
sftp_upload_file(sftpSession, downloadPath)

View File

@@ -101,7 +101,7 @@ def checkInstalledPackage(inputSelectedObject="all"):
print("│ No. │ Name │ Installed V. │ Latest V. │ Update available │")
print("└─────┴────────────────────────────────┴──────────────┴──────────────┴───────────────────┘")
try:
for plugin in track(pluginList, description="Checking for updates" ,transient=True, complete_style="cyan"):
for plugin in track(pluginList, description="Checking for updates" ,transient=True, complete_style="bright_yellow"):
try:
fileName = getFileName(plugin)
fileVersion = getFileVersion(plugin)
@@ -176,7 +176,7 @@ def updateInstalledPackage(inputSelectedObject='all'):
print("│ No. │ Name │ Old V. │ New V. │")
print("└─────┴────────────────────────────────┴────────────┴──────────┘")
try:
for plugin in track(pluginList, description="Updating" ,transient=True, complete_style="red"):
for plugin in track(pluginList, description="Updating" ,transient=True, complete_style="bright_magenta"):
try:
fileName = getFileName(plugin)
fileVersion = getFileVersion(plugin)
@@ -197,9 +197,9 @@ def updateInstalledPackage(inputSelectedObject='all'):
print(f" [{indexNumberUpdated+1}]".rjust(6), end='')
print(" ", end='')
print(f"{fileName}".ljust(33), end='')
print(f"{fileVersion}".ljust(8), end='')
print(" ", end='')
print(f"{latestVersion}".ljust(8))
print(f"{fileVersion}".ljust(13), end='')
#print(" ", end='')
print(f"{latestVersion}".ljust(13))
if not configValues.localPluginFolder:
if configValues.sftp_seperateDownloadPath is True:
@@ -247,9 +247,9 @@ def updateInstalledPackage(inputSelectedObject='all'):
print(f" [{indexNumberUpdated+1}]".rjust(6), end='')
print(" ", end='')
print(f"{fileName}".ljust(33), end='')
print(f"{fileVersion}".ljust(8), end='')
print(" ", end='')
print(f"{latestVersion}".ljust(8))
print(f"{fileVersion}".ljust(13), end='')
#print(" ", end='')
print(f"{latestVersion}".ljust(13))
if not configValues.localPluginFolder:
if configValues.sftp_seperateDownloadPath is True: