Fixed bug when plugin wasn't found with description

This commit is contained in:
Neocky 2021-06-19 13:47:12 +02:00
parent 41527926b2
commit f4361ad137

View File

@ -1,8 +1,6 @@
import os import os
import re import re
import io import io
import stat
import pysftp
import base64 import base64
from zipfile import ZipFile from zipfile import ZipFile
from urllib.error import HTTPError from urllib.error import HTTPError
@ -86,6 +84,7 @@ def eggCrackingJar(localJarFileName, searchMode):
pathToPluginJar = Path(f"{pluginPath}/{localJarFileName}") pathToPluginJar = Path(f"{pluginPath}/{localJarFileName}")
pluginVersion = '' pluginVersion = ''
pluginName = '' pluginName = ''
print(localJarFileName)
with ZipFile(pathToPluginJar, 'r') as pluginJar: with ZipFile(pathToPluginJar, 'r') as pluginJar:
try: try:
with io.TextIOWrapper(pluginJar.open('plugin.yml', 'r'), encoding="utf-8") as pluginYml: with io.TextIOWrapper(pluginJar.open('plugin.yml', 'r'), encoding="utf-8") as pluginYml:
@ -117,6 +116,7 @@ def eggCrackingJar(localJarFileName, searchMode):
def getUpdateDescription(pluginId): def getUpdateDescription(pluginId):
url = f"https://api.spiget.org/v2/resources/{pluginId}/updates?size=1&sort=-date" url = f"https://api.spiget.org/v2/resources/{pluginId}/updates?size=1&sort=-date"
print(url)
latestDescriptionSearch = doAPIRequest(url) latestDescriptionSearch = doAPIRequest(url)
versionLatestDescription = latestDescriptionSearch[0]["description"] versionLatestDescription = latestDescriptionSearch[0]["description"]
versionLatestDescription = base64.b64decode(versionLatestDescription) versionLatestDescription = base64.b64decode(versionLatestDescription)
@ -228,6 +228,8 @@ def checkInstalledPackage(inputSelectedObject="all"):
print(f"{fileVersion}".ljust(15), end='') print(f"{fileVersion}".ljust(15), end='')
print(f"{pluginLatestVersion}".ljust(15), end='') print(f"{pluginLatestVersion}".ljust(15), end='')
print(f"{pluginIsOutdated}".ljust(5) + oColors.standardWhite) print(f"{pluginIsOutdated}".ljust(5) + oColors.standardWhite)
if (pluginLatestVersion != 'N/A'):
print(oColors.brightYellow + "CHANGELOG:" + oColors.standardWhite)
description = getUpdateDescription(pluginId) description = getUpdateDescription(pluginId)
print(description) print(description)