Formatted code and added test query to plugin updater

This commit is contained in:
Neocky 2021-03-03 00:17:15 +01:00
parent 42732d1ea5
commit ba4aa69173
3 changed files with 17 additions and 5 deletions

View File

@ -69,7 +69,8 @@ def printLogo():
oColors.standardWhite)
print()
print()
print(" " + oColors.darkMagenta + "by Neocky" + oColors.standardWhite+ " ")
print(oColors.brightYellow + " [" + oColors.darkMagenta + "by Neocky" +
oColors.brightYellow + "] " + oColors.standardWhite)
print()

View File

@ -1,8 +1,8 @@
import urllib.request
import cgi
import time
import requests
import re
import requests
from consoleoutput import consoleTitle, clearConsole, printMainMenu
from plugin_updatechecker import getInstalledPackages
@ -147,6 +147,7 @@ def searchPackage():
print(packageUrl)
print(ressourceId)
def downloadLatestVersion(ressourceId, packageDownloadName, sourcePath):
url = "https://api.spiget.org/v2/resources/" + ressourceId + "/download"
remotefile = urllib.request.urlopen(url)
@ -154,6 +155,8 @@ def downloadLatestVersion(ressourceId, packageDownloadName, sourcePath):
downloadPath = sourcePath + packageDownloadName
urllib.request.urlretrieve(url, downloadPath)
filesizeData = calculateFileSize(filesize)
print(filesizeData)
print(filesize)
print(f" Downloadsize: {filesizeData} MB")
@ -170,9 +173,6 @@ def getLatestPackageVersion():
downloadLatestVersion(ressourceId, packageDownloadName, downloadPath)
consoleTitle()
inputMainMenu()
outputTest()

View File

@ -1,5 +1,6 @@
import os
import re
import requests
#from consoleoutput import consoleTitle, clearConsole
#from plugin_downloader import handleInput
@ -22,6 +23,16 @@ def getInstalledPluginVersion(pluginName):
pluginNameOnly = pluginNameOnly[:-1]
print(pluginNameOnly)
print(pluginVersionString)
response = requests.get("https://api.spiget.org/v2/search/resources/" + pluginNameOnly + "?field=name")
#https://api.spiget.org/v2/search/resources/luckperms?field=name
print("https://api.spiget.org/v2/search/resources/" + pluginNameOnly + "?field=name")
packageName = response.json()
i = 1
for ressource in packageName:
pName = ressource["name"]
pID = ressource["id"]
print(f" [{i}] {pName}")
i = i + 1
# start query
# get id