Compare commits

..

10 Commits

Author SHA1 Message Date
Neocky
662f303935 Catched FileNotfoundError & Plugins updated will now display correctly
Changes:
- Catched file not found error
- Plugins updated
- Updated wrong index numbers when updating
2021-03-14 20:21:26 +01:00
Neocky
053a67e2d8 Update README.md 2021-03-14 19:38:47 +01:00
Neocky
e37840e665 Update README.md 2021-03-14 19:38:22 +01:00
Neocky
ac9b89de4f Edited license badge link 2021-03-14 19:15:06 +01:00
Neocky
f704b29ff9 Added latest release badge 2021-03-14 19:12:56 +01:00
Neocky
12f28107de Updated link 2021-03-14 18:55:39 +01:00
Neocky
b7e9673c80 Updated link 2021-03-14 18:51:43 +01:00
Neocky
0e4abad762 Update README.md 2021-03-14 18:02:09 +01:00
Neocky
972daf5687 Update README.md 2021-03-14 17:53:41 +01:00
Neocky
540a355d3d Added hit counter and removed star counter 2021-03-14 14:14:12 +01:00
3 changed files with 56 additions and 22 deletions

View File

@@ -1,4 +1,5 @@
<p align="center"> <p align="center">
<img src="https://i.ibb.co/JyCxnQn/logoreal.png" alt="pluGET" border="0"></a> <img src="https://i.ibb.co/JyCxnQn/logoreal.png" alt="pluGET" border="0"></a>
</p> </p>
@@ -8,14 +9,15 @@
</p> </p>
<p align="center"> <p align="center">
<a href="https://github.com/Neocky/pluGET/blob/main/LICENSE"> <img src="https://img.shields.io/badge/license-Apache--2.0-blue" alt="Apache-2.0" border="0"></a> <a href="https://github.com/Neocky/pluGET/blob/main/LICENSE"> <img src="https://img.shields.io/github/license/Neocky/pluGET" alt="Apache-2.0" border="0"></a>
<a href="https://github.com/Neocky/pluGET/stargazers"> <img src="https://img.shields.io/github/stars/Neocky/pluGET?color=yellow" alt="stars" border="0"></a>
<a href="https://github.com/Neocky/pluGET/releases"> <img src="https://img.shields.io/github/downloads/Neocky/pluGET/total" alt="downloads" border="0"></a> <a href="https://github.com/Neocky/pluGET/releases"> <img src="https://img.shields.io/github/downloads/Neocky/pluGET/total" alt="downloads" border="0"></a>
<a href="https://github.com/Neocky/pluGET/releases"> <img src="https://img.shields.io/github/v/release/Neocky/pluGET?include_prereleases" alt"latestrelease"></a>
</p> </p>
# pluGET
# pluGET
[![HitCount](http://hits.dwyl.com/Neocky/pluGET.svg)](http://hits.dwyl.com/Neocky/pluGET)
A powerfull package manager which handles [Plugins](https://www.spigotmc.org/resources/) for minecraft servers. A powerfull package manager which handles [Plugins](https://www.spigotmc.org/resources/) for minecraft servers.

View File

@@ -116,15 +116,9 @@ def getSpecificPackage(ressourceId, downloadPath, inputPackageVersion='latest'):
downloadPackagePath = f"{downloadPath}\\{packageDownloadName}" downloadPackagePath = f"{downloadPath}\\{packageDownloadName}"
if checkConfig().localPluginFolder: if checkConfig().localPluginFolder:
if inputPackageVersion is None or inputPackageVersion == 'latest': if inputPackageVersion is None or inputPackageVersion == 'latest':
try: downloadSpecificVersion(ressourceId=ressourceId, downloadPath=downloadPackagePath)
downloadSpecificVersion(ressourceId=ressourceId, downloadPath=downloadPackagePath)
except HTTPError as err:
print(oColors.brightRed + f"Error: {err.code} - {err.reason}" + oColors.standardWhite)
else: else:
try: downloadSpecificVersion(ressourceId, downloadPackagePath, versionId)
downloadSpecificVersion(ressourceId, downloadPackagePath, versionId)
except HTTPError as err:
print(oColors.brightRed + f"Error: {err.code} - {err.reason}" + oColors.standardWhite)
if not checkConfig().localPluginFolder: if not checkConfig().localPluginFolder:
if inputPackageVersion is None or inputPackageVersion == 'latest': if inputPackageVersion is None or inputPackageVersion == 'latest':

View File

@@ -1,5 +1,6 @@
import os import os
import re import re
from urllib.error import HTTPError
from utils.consoleoutput import oColors from utils.consoleoutput import oColors
from utils.web_request import doAPIRequest from utils.web_request import doAPIRequest
@@ -127,6 +128,7 @@ def updateInstalledPackage(inputSelectedObject='all'):
pluginList = os.listdir(checkConfig().pathToPluginFolder) pluginList = os.listdir(checkConfig().pathToPluginFolder)
i = 0 i = 0
pluginsUpdated = 0 pluginsUpdated = 0
indexNumberUpdated = 0
print(f"Updating: {inputSelectedObject}") print(f"Updating: {inputSelectedObject}")
print("Index | Name | Old V. | New V.") print("Index | Name | Old V. | New V.")
try: try:
@@ -148,28 +150,47 @@ def updateInstalledPackage(inputSelectedObject='all'):
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" [{pluginsUpdated+1}]".ljust(8), end='') print(f" [{indexNumberUpdated+1}]".ljust(8), end='')
print(f"{fileName}".ljust(30), end='') print(f"{fileName}".ljust(30), end='')
print(f"{fileVersion}".ljust(8), end='') print(f"{fileVersion}".ljust(8), end='')
print(" ", end='') print(" ", end='')
print(f"{latestVersion}".ljust(8)) print(f"{latestVersion}".ljust(8))
if not checkConfig().localPluginFolder: if not checkConfig().localPluginFolder:
pluginPath = checkConfig().sftp_folderPath if checkConfig().sftp_pathToSeperateDownloadPath is True:
pluginPath = checkConfig().sftp_pathToSeperateDownloadPath
else:
pluginPath = checkConfig().sftp_folderPath
pluginPath = f"{pluginPath}\\{plugin}" pluginPath = f"{pluginPath}\\{plugin}"
sftp = createSFTPConnection() sftp = createSFTPConnection()
sftp.remove(pluginPath) indexNumberUpdated += 1
getSpecificPackage(pluginId, checkConfig().sftp_folderPath)
pluginsUpdated += 1 pluginsUpdated += 1
try:
getSpecificPackage(pluginId, checkConfig().sftp_folderPath)
if checkConfig().sftp_seperateDownloadPath is False:
sftp.remove(pluginPath)
except HTTPError as err:
print(oColors.brightRed + f"Error: {err.code} - {err.reason}" + oColors.standardWhite)
pluginsUpdated -= 1
except FileNotFoundError:
print(oColors.brightRed + f"Error: Old plugin file coulnd't be deleted" + oColors.standardWhite)
else: else:
if checkConfig().seperateDownloadPath is True: if checkConfig().seperateDownloadPath is True:
pluginPath = checkConfig().pathToSeperateDownloadPath pluginPath = checkConfig().pathToSeperateDownloadPath
else: else:
pluginPath = checkConfig().pathToPluginFolder pluginPath = checkConfig().pathToPluginFolder
pluginPath = f"{pluginPath}\\{plugin}" pluginPath = f"{pluginPath}\\{plugin}"
os.remove(pluginPath) indexNumberUpdated += 1
getSpecificPackage(pluginId, checkConfig().pathToPluginFolder)
pluginsUpdated += 1 pluginsUpdated += 1
try:
getSpecificPackage(pluginId, checkConfig().pathToPluginFolder)
if checkConfig().seperateDownloadPath is False:
os.remove(pluginPath)
except HTTPError as err:
print(oColors.brightRed + f"Error: {err.code} - {err.reason}" + oColors.standardWhite)
pluginsUpdated -= 1
except FileNotFoundError:
print(oColors.brightRed + f"Error: Old plugin file coulnd't be deleted" + oColors.standardWhite)
break break
else: else:
print(f"{fileName} is already on {latestVersion}") print(f"{fileName} is already on {latestVersion}")
@@ -178,7 +199,7 @@ def updateInstalledPackage(inputSelectedObject='all'):
if inputSelectedObject == 'all': if inputSelectedObject == 'all':
if INSTALLEDPLUGINLIST[i][3] == True: if INSTALLEDPLUGINLIST[i][3] == True:
print(f" [{pluginsUpdated+1}]".ljust(8), end='') print(f" [{indexNumberUpdated+1}]".ljust(8), end='')
print(f"{fileName}".ljust(30), end='') print(f"{fileName}".ljust(30), end='')
print(f"{fileVersion}".ljust(8), end='') print(f"{fileVersion}".ljust(8), end='')
print(" ", end='') print(" ", end='')
@@ -192,9 +213,17 @@ def updateInstalledPackage(inputSelectedObject='all'):
pluginPath = checkConfig().sftp_folderPath pluginPath = checkConfig().sftp_folderPath
pluginPath = f"{pluginPath}\\{plugin}" pluginPath = f"{pluginPath}\\{plugin}"
sftp = createSFTPConnection() sftp = createSFTPConnection()
sftp.remove(pluginPath) indexNumberUpdated += 1
getSpecificPackage(pluginId, checkConfig().sftp_folderPath)
pluginsUpdated += 1 pluginsUpdated += 1
try:
getSpecificPackage(pluginId, checkConfig().sftp_folderPath)
if checkConfig().sftp_seperateDownloadPath is False:
sftp.remove(pluginPath)
except HTTPError as err:
print(oColors.brightRed + f"Error: {err.code} - {err.reason}" + oColors.standardWhite)
pluginsUpdated -= 1
except FileNotFoundError:
print(oColors.brightRed + f"Error: Old plugin file coulnd't be deleted" + oColors.standardWhite)
else: else:
if checkConfig().seperateDownloadPath is True: if checkConfig().seperateDownloadPath is True:
@@ -202,9 +231,18 @@ def updateInstalledPackage(inputSelectedObject='all'):
else: else:
pluginPath = checkConfig().pathToPluginFolder pluginPath = checkConfig().pathToPluginFolder
pluginPath = f"{pluginPath}\\{plugin}" pluginPath = f"{pluginPath}\\{plugin}"
os.remove(pluginPath) indexNumberUpdated += 1
getSpecificPackage(pluginId, checkConfig().pathToPluginFolder)
pluginsUpdated += 1 pluginsUpdated += 1
try:
getSpecificPackage(pluginId, checkConfig().pathToPluginFolder)
if checkConfig().seperateDownloadPath is False:
os.remove(pluginPath)
except HTTPError as err:
print(oColors.brightRed + f"Error: {err.code} - {err.reason}" + oColors.standardWhite)
pluginsUpdated -= 1
except FileNotFoundError:
print(oColors.brightRed + f"Error: Old plugin file coulnd't be deleted" + oColors.standardWhite)
i = i + 1 i = i + 1
except TypeError: except TypeError:
print(oColors.brightRed + "Aborted updating for plugins." + oColors.standardWhite) print(oColors.brightRed + "Aborted updating for plugins." + oColors.standardWhite)