mirror of
https://github.com/Neocky/pluGET.git
synced 2024-04-29 16:12:30 +00:00
Fixed array was not created
Changes: - fixed array would not be created for a plugin when plugin would throw a type- or valueerror - deleted testing prints - minor code cleanup
This commit is contained in:
parent
430dbcd8d2
commit
76e1d7f5fd
@ -7,7 +7,7 @@ from plugin.plugin_downloader import searchPackage, getSpecificPackage
|
|||||||
from plugin.plugin_updatechecker import updateInstalledPackage, checkInstalledPackage
|
from plugin.plugin_updatechecker import updateInstalledPackage, checkInstalledPackage
|
||||||
from plugin.plugin_remover import removePlugin
|
from plugin.plugin_remover import removePlugin
|
||||||
from serverjar.serverjar_checker import checkInstalledServerjar, updateServerjar
|
from serverjar.serverjar_checker import checkInstalledServerjar, updateServerjar
|
||||||
from serverjar.serverjar_paper import papermc_downloader
|
from serverjar.serverjar_paper import papermc_downloader
|
||||||
|
|
||||||
|
|
||||||
def createInputLists():
|
def createInputLists():
|
||||||
|
@ -74,6 +74,7 @@ def checkInstalledPackage(inputSelectedObject="all"):
|
|||||||
fileVersion = getFileVersion(plugin)
|
fileVersion = getFileVersion(plugin)
|
||||||
pluginId = getInstalledPlugin(fileName, fileVersion)
|
pluginId = getInstalledPlugin(fileName, fileVersion)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
i += 1
|
||||||
continue
|
continue
|
||||||
pluginIdStr = str(pluginId)
|
pluginIdStr = str(pluginId)
|
||||||
|
|
||||||
@ -84,7 +85,7 @@ def checkInstalledPackage(inputSelectedObject="all"):
|
|||||||
pluginLatestVersion = INSTALLEDPLUGINLIST[i][2]
|
pluginLatestVersion = INSTALLEDPLUGINLIST[i][2]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
pluginLatestVersion = 'N/A'
|
pluginLatestVersion = 'N/A'
|
||||||
|
|
||||||
if pluginLatestVersion == None:
|
if pluginLatestVersion == None:
|
||||||
pluginLatestVersion = 'N/A'
|
pluginLatestVersion = 'N/A'
|
||||||
|
|
||||||
@ -114,7 +115,7 @@ def checkInstalledPackage(inputSelectedObject="all"):
|
|||||||
print(f"{pluginLatestVersion}".ljust(12), end='')
|
print(f"{pluginLatestVersion}".ljust(12), end='')
|
||||||
print(f" {pluginIsOutdated}".ljust(5))
|
print(f" {pluginIsOutdated}".ljust(5))
|
||||||
|
|
||||||
i = i + 1
|
i += 1
|
||||||
except TypeError:
|
except TypeError:
|
||||||
print(oColors.brightRed + "Aborted checking for plugins." + oColors.standardWhite)
|
print(oColors.brightRed + "Aborted checking for plugins." + oColors.standardWhite)
|
||||||
print(oColors.brightYellow + f"Old packages: [{oldPackages}/{i}]" + oColors.standardWhite)
|
print(oColors.brightYellow + f"Old packages: [{oldPackages}/{i}]" + oColors.standardWhite)
|
||||||
@ -139,18 +140,18 @@ def updateInstalledPackage(inputSelectedObject='all'):
|
|||||||
fileVersion = getFileVersion(plugin)
|
fileVersion = getFileVersion(plugin)
|
||||||
pluginId = getInstalledPlugin(fileName, fileVersion)
|
pluginId = getInstalledPlugin(fileName, fileVersion)
|
||||||
latestVersion = getLatestPluginVersion(pluginId)
|
latestVersion = getLatestPluginVersion(pluginId)
|
||||||
print(fileName)
|
|
||||||
print(fileVersion)
|
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
i += 1
|
||||||
continue
|
continue
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
i += 1
|
||||||
continue
|
continue
|
||||||
pluginIdStr = str(pluginId)
|
pluginIdStr = str(pluginId)
|
||||||
|
|
||||||
if pluginId == None:
|
if pluginId == None:
|
||||||
print(oColors.brightRed + "Couldn't find plugin id. Sorry :(" + oColors.standardWhite)
|
print(oColors.brightRed + "Couldn't find plugin id. Sorry :(" + oColors.standardWhite)
|
||||||
continue
|
continue
|
||||||
print(INSTALLEDPLUGINLIST[i])
|
|
||||||
if inputSelectedObject == pluginIdStr or re.search(inputSelectedObject, fileName, re.IGNORECASE):
|
if inputSelectedObject == pluginIdStr or re.search(inputSelectedObject, fileName, re.IGNORECASE):
|
||||||
if INSTALLEDPLUGINLIST[i][3] == True:
|
if INSTALLEDPLUGINLIST[i][3] == True:
|
||||||
print(f" [{indexNumberUpdated+1}]".ljust(8), end='')
|
print(f" [{indexNumberUpdated+1}]".ljust(8), end='')
|
||||||
@ -257,12 +258,10 @@ def updateInstalledPackage(inputSelectedObject='all'):
|
|||||||
def getInstalledPlugin(localFileName, localFileVersion):
|
def getInstalledPlugin(localFileName, localFileVersion):
|
||||||
url = "https://api.spiget.org/v2/search/resources/" + localFileName + "?field=name&sort=-downloads"
|
url = "https://api.spiget.org/v2/search/resources/" + localFileName + "?field=name&sort=-downloads"
|
||||||
packageName = doAPIRequest(url)
|
packageName = doAPIRequest(url)
|
||||||
#i = 1
|
|
||||||
plugin_match_found = False
|
plugin_match_found = False
|
||||||
pluginID = None
|
pluginID = None
|
||||||
for ressource in packageName:
|
for ressource in packageName:
|
||||||
if plugin_match_found == True:
|
if plugin_match_found == True:
|
||||||
plugin_match_found = False
|
|
||||||
break
|
break
|
||||||
pID = ressource["id"]
|
pID = ressource["id"]
|
||||||
url2 = f"https://api.spiget.org/v2/resources/{pID}/versions?size=100&sort=-name"
|
url2 = f"https://api.spiget.org/v2/resources/{pID}/versions?size=100&sort=-name"
|
||||||
@ -276,19 +275,14 @@ def getInstalledPlugin(localFileName, localFileVersion):
|
|||||||
plugin_latest_version = getLatestPluginVersion(pID)
|
plugin_latest_version = getLatestPluginVersion(pID)
|
||||||
plugin_is_outdated = compareVersions(plugin_latest_version, updateVersion)
|
plugin_is_outdated = compareVersions(plugin_latest_version, updateVersion)
|
||||||
addToPluginList(pID, updateId, plugin_latest_version , plugin_is_outdated)
|
addToPluginList(pID, updateId, plugin_latest_version , plugin_is_outdated)
|
||||||
print("in if")
|
return pluginID
|
||||||
print(plugin_match_found)
|
|
||||||
return pluginID # just testing
|
|
||||||
#break
|
|
||||||
|
|
||||||
else: # TODO fix duplicate entrys when update all
|
else:
|
||||||
if plugin_match_found != True:
|
if plugin_match_found != True:
|
||||||
pID = None
|
pID = None
|
||||||
updateId = None
|
updateId = None
|
||||||
plugin_latest_version = None
|
plugin_latest_version = None
|
||||||
plugin_is_outdated = None
|
plugin_is_outdated = None
|
||||||
addToPluginList(pID, updateId, plugin_latest_version , plugin_is_outdated)
|
addToPluginList(pID, updateId, plugin_latest_version , plugin_is_outdated)
|
||||||
print("in else")
|
|
||||||
print(plugin_match_found)
|
|
||||||
|
|
||||||
return pluginID
|
return pluginID
|
||||||
|
Loading…
Reference in New Issue
Block a user