mirror of
https://github.com/Neocky/pluGET.git
synced 2024-04-29 16:12:30 +00:00
Made config path correct; Deleted unnecessary stuff; Beautified outpout; Plugin version now correct;
Changes: - config path will always be correct - deleted unnexessary stuff - plugin version will display now correct - changed some formating - created SFTP check before launching
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import os.path
|
||||
import os
|
||||
import sys
|
||||
import configparser
|
||||
|
||||
@@ -6,7 +6,10 @@ from utils.consoleoutput import oColors
|
||||
|
||||
|
||||
def checkConfig():
|
||||
configAvailable = os.path.isfile("./config.ini")
|
||||
currentFolder = os.getcwd()
|
||||
os.chdir('..')
|
||||
configAvailable = os.path.isfile("config.ini")
|
||||
|
||||
if not configAvailable:
|
||||
createConfig()
|
||||
print(oColors.brightRed + "Config created. Edit config before executing again!" + oColors.standardWhite)
|
||||
@@ -32,19 +35,20 @@ def checkConfig():
|
||||
else:
|
||||
localPluginFolder = False
|
||||
|
||||
os.chdir(currentFolder)
|
||||
return configValues
|
||||
|
||||
|
||||
def createConfig():
|
||||
config = configparser.ConfigParser(allow_no_value=True)
|
||||
config['General'] = {}
|
||||
config['General'][';'] = 'If a local plugin folder exists (True/False): (If False use SFTP)'
|
||||
config['General'][';'] = 'If a local plugin folder exists (True/False): (If False SFTP will be used)'
|
||||
config['General']['LocalPluginFolder'] = 'True'
|
||||
config['General']['PathToPluginFolder'] = 'C:\\Users\\USER\\Desktop\\plugins'
|
||||
config['SFTP - Remote Server'] = {}
|
||||
config['SFTP - Remote Server']['Server'] = '0.0.0.0'
|
||||
config['SFTP - Remote Server']['Username'] = 'user'
|
||||
config['SFTP - Remote Server']['Password'] = 'longpassword'
|
||||
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']['Port'] = '22'
|
||||
config['SFTP - Remote Server']['PluginFolderForUpload'] = '.\\plugins'
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import sys
|
||||
import time
|
||||
|
||||
from utils.consoleoutput import oColors
|
||||
from utils.utilities import getHelp
|
||||
@@ -14,6 +13,7 @@ def createInputLists():
|
||||
'get',
|
||||
'update',
|
||||
'check',
|
||||
'search',
|
||||
'exit',
|
||||
'help',
|
||||
'remove'
|
||||
@@ -44,6 +44,9 @@ def handleInput(inputCommand, inputSelectedObject, inputParams):
|
||||
if inputCommand == 'check':
|
||||
checkInstalledPackage(inputSelectedObject)
|
||||
break
|
||||
if inputCommand == 'search':
|
||||
searchPackage(inputSelectedObject)
|
||||
break
|
||||
if inputCommand == 'exit':
|
||||
sys.exit()
|
||||
if inputCommand == 'help':
|
||||
@@ -67,24 +70,4 @@ def getInput():
|
||||
print(oColors.brightRed + "Wrong input! Use: > *command* *selectedObject* *optionalParams*" + oColors.standardWhite)
|
||||
|
||||
inputParams = inputParams[0] if inputParams else None
|
||||
#print(inputCommand)
|
||||
#print(inputSelectedObject)
|
||||
#print(inputParams)
|
||||
handleInput(inputCommand, inputSelectedObject, inputParams)
|
||||
|
||||
|
||||
# only for testing purposes
|
||||
def outputTest():
|
||||
print("Hello world")
|
||||
print("Waiting still seconds: 5", end='\r')
|
||||
time.sleep(1)
|
||||
print("Waiting still seconds: 4", end='\r')
|
||||
time.sleep(1)
|
||||
print("Waiting still seconds: 3", end='\r')
|
||||
time.sleep(1)
|
||||
print("Waiting still seconds: 2", end='\r')
|
||||
time.sleep(1)
|
||||
print("Waiting still seconds: 1", end='\r')
|
||||
time.sleep(1)
|
||||
print("Done ✅☑✔ ")
|
||||
input("Press key to end program...")
|
||||
|
@@ -40,7 +40,7 @@ def sftp_upload_file(sftp, itemPath):
|
||||
sftp.put(itemPath)
|
||||
|
||||
except FileNotFoundError:
|
||||
print(oColors.brightRed + "The *plugins* folder couldn*t be found on the remote host!" + oColors.standardWhite)
|
||||
print(oColors.brightRed + "The 'plugins' folder couldn*t be found on the remote host!" + oColors.standardWhite)
|
||||
print(oColors.brightRed + "Aborting installation." + oColors.standardWhite)
|
||||
sftp.close()
|
||||
|
||||
@@ -51,7 +51,7 @@ def sftp_listAll(sftp):
|
||||
installedPlugins = sftp.listdir()
|
||||
|
||||
except FileNotFoundError:
|
||||
print(oColors.brightRed + "The *plugins* folder couldn*t be found on the remote host!" + oColors.standardWhite)
|
||||
print(oColors.brightRed + "The 'plugins' folder couldn*t be found on the remote host!" + oColors.standardWhite)
|
||||
|
||||
try:
|
||||
return installedPlugins
|
||||
|
Reference in New Issue
Block a user