Added FTP support

Changes:
- added ftp support
- added ftp to every function which had already sftp interaction
- edited config
- added handle_ftp.py
fixed old configcheck() bugs
- added sftp/ftp to eggcrackingjar mechanism
- added new line input with enter
This commit is contained in:
Neocky
2021-03-30 23:55:04 +02:00
parent 2a7372dae1
commit 927767b0aa
11 changed files with 278 additions and 87 deletions

View File

@@ -8,6 +8,7 @@ from pathlib import Path
from utils.consoleoutput import oColors
from handlers.handle_config import configurationValues
from handlers.handle_sftp import createSFTPConnection
from handlers.handle_ftp import createFTPConnection
def getHelp():
@@ -134,16 +135,20 @@ def check_requirements():
apiTest()
check_local_plugin_folder()
if not configValues.localPluginFolder:
createSFTPConnection()
if configValues.sftp_useSftp:
createSFTPConnection()
else:
createFTPConnection()
def createTempPluginFolder():
tempPluginFolder = Path("./TempSFTPUploadFolder")
configValues = configurationValues()
tempPluginFolder = Path("./TempSFTPFolder")
if not os.path.isdir(tempPluginFolder):
try:
os.mkdir(tempPluginFolder)
except OSError:
print(oColors.brightRed + "Creation of directory %s failed" % checkConfig().pathToPluginFolder)
print(oColors.brightRed + "Creation of directory %s failed" % configValues.pathToPluginFolder)
print(oColors.brightRed + "Please check the config file!" + oColors.standardWhite)
input("Press any key + enter to exit...")
sys.exit()
@@ -167,4 +172,4 @@ def calculateFileSizeKb(downloadFileSize):
fileSizeDownload = int(downloadFileSize)
fileSizeKb = fileSizeDownload / 1024
roundedFileSize = round(fileSizeKb, 2)
return roundedFileSize
return roundedFileSize