mirror of
https://github.com/Neocky/pluGET.git
synced 2024-04-29 16:12:30 +00:00
Fixed big duplicate array issue for a plugin; Added seperate download path
Changes: - Fixed big issue where two arrays would be created for a plugin and then everything else would fail - added seperate location for downloaded files
This commit is contained in:
parent
3e7beb477a
commit
7e9b5850be
@ -22,12 +22,16 @@ def checkConfig():
|
|||||||
config.read("config.ini")
|
config.read("config.ini")
|
||||||
localPluginFolder = config['General']['LocalPluginFolder']
|
localPluginFolder = config['General']['LocalPluginFolder']
|
||||||
pathToPluginFolder = config['General']['PathToPluginFolder']
|
pathToPluginFolder = config['General']['PathToPluginFolder']
|
||||||
|
seperateDownloadPath = config['General']['SeperateDownloadPath']
|
||||||
|
pathToSeperateDownloadPath = config['General']['PathToSeperateDownloadPath']
|
||||||
|
|
||||||
sftp_server = config['SFTP - Remote Server']['Server']
|
sftp_server = config['SFTP - Remote Server']['Server']
|
||||||
sftp_user = config['SFTP - Remote Server']['Username']
|
sftp_user = config['SFTP - Remote Server']['Username']
|
||||||
sftp_password = config['SFTP - Remote Server']['Password']
|
sftp_password = config['SFTP - Remote Server']['Password']
|
||||||
sftp_port = config['SFTP - Remote Server']['Port']
|
sftp_port = config['SFTP - Remote Server']['Port']
|
||||||
sftp_folderPath = config['SFTP - Remote Server']['PluginFolderForUpload']
|
sftp_folderPath = config['SFTP - Remote Server']['PluginFolderOnServer']
|
||||||
|
sftp_seperateDownloadPath = config['SFTP - Remote Server']['SeperateDownloadPath']
|
||||||
|
sftp_pathToSeperateDownloadPath = config['SFTP - Remote Server']['PathToSeperateDownloadPath']
|
||||||
|
|
||||||
sftp_port = int(sftp_port)
|
sftp_port = int(sftp_port)
|
||||||
if localPluginFolder == 'True':
|
if localPluginFolder == 'True':
|
||||||
@ -35,6 +39,16 @@ def checkConfig():
|
|||||||
else:
|
else:
|
||||||
localPluginFolder = False
|
localPluginFolder = False
|
||||||
|
|
||||||
|
if seperateDownloadPath == 'True':
|
||||||
|
seperateDownloadPath = True
|
||||||
|
else:
|
||||||
|
seperateDownloadPath = False
|
||||||
|
|
||||||
|
if sftp_seperateDownloadPath == 'True':
|
||||||
|
sftp_seperateDownloadPath = True
|
||||||
|
else:
|
||||||
|
sftp_seperateDownloadPath = False
|
||||||
|
|
||||||
os.chdir(currentFolder)
|
os.chdir(currentFolder)
|
||||||
return configValues
|
return configValues
|
||||||
|
|
||||||
@ -45,13 +59,21 @@ def createConfig():
|
|||||||
config['General'][';'] = 'If a local plugin folder exists (True/False): (If False SFTP will be used)'
|
config['General'][';'] = 'If a local plugin folder exists (True/False): (If False SFTP will be used)'
|
||||||
config['General']['LocalPluginFolder'] = 'True'
|
config['General']['LocalPluginFolder'] = 'True'
|
||||||
config['General']['PathToPluginFolder'] = 'C:\\Users\\USER\\Desktop\\plugins'
|
config['General']['PathToPluginFolder'] = 'C:\\Users\\USER\\Desktop\\plugins'
|
||||||
|
config['General'][';_'] = 'If you want a different folder to store the updated plugins change to (True/False) and the path below'
|
||||||
|
config['General']['SeperateDownloadPath'] = 'False'
|
||||||
|
config['General']['PathToSeperateDownloadPath'] = 'C:\\Users\\USER\\Desktop\\plugins'
|
||||||
|
|
||||||
config['SFTP - Remote Server'] = {}
|
config['SFTP - Remote Server'] = {}
|
||||||
config['SFTP - Remote Server']['Server'] = '0.0.0.0'
|
config['SFTP - Remote Server']['Server'] = '0.0.0.0'
|
||||||
config['SFTP - Remote Server']['Username'] = 'user'
|
config['SFTP - Remote Server']['Username'] = 'user'
|
||||||
config['SFTP - Remote Server']['Password'] = 'password'
|
config['SFTP - Remote Server']['Password'] = 'password'
|
||||||
config['SFTP - Remote Server'][';'] = 'Normally you won*t need to change anything below this line'
|
config['SFTP - Remote Server'][';'] = 'Normally you won*t need to change anything below this line'
|
||||||
config['SFTP - Remote Server']['Port'] = '22'
|
config['SFTP - Remote Server']['Port'] = '22'
|
||||||
config['SFTP - Remote Server']['PluginFolderForUpload'] = '.\\plugins'
|
config['SFTP - Remote Server']['PluginFolderOnServer'] = '.\\plugins'
|
||||||
|
config['SFTP - Remote Server'][';_'] = 'If you want a different folder to store the updated plugins change to (True/False) and the path below'
|
||||||
|
config['SFTP - Remote Server']['SeperateDownloadPath'] = 'False'
|
||||||
|
config['SFTP - Remote Server']['PathToSeperateDownloadPath'] = '.\\plugins'
|
||||||
|
|
||||||
|
|
||||||
with open('./config.ini', 'w') as configfile:
|
with open('./config.ini', 'w') as configfile:
|
||||||
config.write(configfile)
|
config.write(configfile)
|
||||||
|
@ -30,10 +30,18 @@ def handleInput(inputCommand, inputSelectedObject, inputParams):
|
|||||||
if inputCommand == 'get':
|
if inputCommand == 'get':
|
||||||
if inputSelectedObject.isdigit():
|
if inputSelectedObject.isdigit():
|
||||||
if not checkConfig().localPluginFolder:
|
if not checkConfig().localPluginFolder:
|
||||||
getSpecificPackage(inputSelectedObject, checkConfig().sftp_folderPath, inputParams)
|
if checkConfig().sftp_seperateDownloadPath is True:
|
||||||
|
pluginPath = checkConfig().sftp_pathToSeperateDownloadPath
|
||||||
|
else:
|
||||||
|
pluginPath = checkConfig().sftp_folderPath
|
||||||
|
getSpecificPackage(inputSelectedObject, pluginPath, inputParams)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
getSpecificPackage(inputSelectedObject, checkConfig().pathToPluginFolder, inputParams)
|
if checkConfig().seperateDownloadPath is True:
|
||||||
|
pluginPath = checkConfig().pathToSeperateDownloadPath
|
||||||
|
else:
|
||||||
|
pluginPath = checkConfig().pathToPluginFolder
|
||||||
|
getSpecificPackage(inputSelectedObject, pluginPath, inputParams)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
searchPackage(inputSelectedObject)
|
searchPackage(inputSelectedObject)
|
||||||
|
@ -161,6 +161,9 @@ def updateInstalledPackage(inputSelectedObject='all'):
|
|||||||
sftp.remove(pluginPath)
|
sftp.remove(pluginPath)
|
||||||
getSpecificPackage(pluginId, checkConfig().sftp_folderPath)
|
getSpecificPackage(pluginId, checkConfig().sftp_folderPath)
|
||||||
pluginsUpdated += 1
|
pluginsUpdated += 1
|
||||||
|
else:
|
||||||
|
if checkConfig().seperateDownloadPath is True:
|
||||||
|
pluginPath = checkConfig().pathToSeperateDownloadPath
|
||||||
else:
|
else:
|
||||||
pluginPath = checkConfig().pathToPluginFolder
|
pluginPath = checkConfig().pathToPluginFolder
|
||||||
pluginPath = f"{pluginPath}\\{plugin}"
|
pluginPath = f"{pluginPath}\\{plugin}"
|
||||||
@ -182,6 +185,10 @@ def updateInstalledPackage(inputSelectedObject='all'):
|
|||||||
print(f"{latestVersion}".ljust(8))
|
print(f"{latestVersion}".ljust(8))
|
||||||
|
|
||||||
if not checkConfig().localPluginFolder:
|
if not checkConfig().localPluginFolder:
|
||||||
|
if checkConfig().sftp_seperateDownloadPath is True:
|
||||||
|
pluginPath = checkConfig().sftp_pathToSeperateDownloadPath
|
||||||
|
else:
|
||||||
|
pluginPath = checkConfig().sftp_folderPath
|
||||||
pluginPath = checkConfig().sftp_folderPath
|
pluginPath = checkConfig().sftp_folderPath
|
||||||
pluginPath = f"{pluginPath}\\{plugin}"
|
pluginPath = f"{pluginPath}\\{plugin}"
|
||||||
sftp = createSFTPConnection()
|
sftp = createSFTPConnection()
|
||||||
@ -189,6 +196,9 @@ def updateInstalledPackage(inputSelectedObject='all'):
|
|||||||
getSpecificPackage(pluginId, checkConfig().sftp_folderPath)
|
getSpecificPackage(pluginId, checkConfig().sftp_folderPath)
|
||||||
pluginsUpdated += 1
|
pluginsUpdated += 1
|
||||||
|
|
||||||
|
else:
|
||||||
|
if checkConfig().seperateDownloadPath is True:
|
||||||
|
pluginPath = checkConfig().pathToSeperateDownloadPath
|
||||||
else:
|
else:
|
||||||
pluginPath = checkConfig().pathToPluginFolder
|
pluginPath = checkConfig().pathToPluginFolder
|
||||||
pluginPath = f"{pluginPath}\\{plugin}"
|
pluginPath = f"{pluginPath}\\{plugin}"
|
||||||
@ -229,6 +239,7 @@ def getInstalledPlugin(localFileName, localFileVersion):
|
|||||||
|
|
||||||
i = i + 1
|
i = i + 1
|
||||||
else:
|
else:
|
||||||
|
if plugin_match_found != True:
|
||||||
pID = None
|
pID = None
|
||||||
updateId = None
|
updateId = None
|
||||||
plugin_latest_version = None
|
plugin_latest_version = None
|
||||||
|
@ -19,17 +19,22 @@ def getHelp():
|
|||||||
|
|
||||||
def check_local_plugin_folder():
|
def check_local_plugin_folder():
|
||||||
if checkConfig().localPluginFolder:
|
if checkConfig().localPluginFolder:
|
||||||
if not os.path.isdir(checkConfig().pathToPluginFolder):
|
if checkConfig().seperateDownloadPath:
|
||||||
|
pluginFolderPath = checkConfig().pathToSeperateDownloadPath
|
||||||
|
else:
|
||||||
|
pluginFolderPath = checkConfig().pathToPluginFolder
|
||||||
|
|
||||||
|
if not os.path.isdir(pluginFolderPath):
|
||||||
print(oColors.brightRed + "Plugin folder coulnd*t be found. Creating one..." + oColors.standardWhite)
|
print(oColors.brightRed + "Plugin folder coulnd*t be found. Creating one..." + oColors.standardWhite)
|
||||||
try:
|
try:
|
||||||
os.mkdir(checkConfig().pathToPluginFolder)
|
os.mkdir(pluginFolderPath)
|
||||||
except OSError:
|
except OSError:
|
||||||
print(oColors.brightRed + "Creation of directory %s failed" % checkConfig().pathToPluginFolder)
|
print(oColors.brightRed + "Creation of directory %s failed" % pluginFolderPath)
|
||||||
print(oColors.brightRed + "Please check the config file!" + oColors.standardWhite)
|
print(oColors.brightRed + "Please check the config file!" + oColors.standardWhite)
|
||||||
input("Press any key + enter to exit...")
|
input("Press any key + enter to exit...")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
else:
|
else:
|
||||||
print("Created directory %s" % checkConfig().pathToPluginFolder)
|
print("Created directory %s" % pluginFolderPath)
|
||||||
|
|
||||||
|
|
||||||
def apiTest():
|
def apiTest():
|
||||||
|
Loading…
Reference in New Issue
Block a user