Parcourir la source

FTP upload logging message changes, update default config generator

notcammy il y a 7 ans
Parent
commit
a17f6cf0bd
2 fichiers modifiés avec 9 ajouts et 4 suppressions
  1. 8 3
      pyinstalive/downloader.py
  2. 1 1
      pyinstalive/initialize.py

+ 8 - 3
pyinstalive/downloader.py

@@ -389,15 +389,20 @@ def upload_ftp_files(files):
 			try:
 				filename = file.split('/').pop() or file.split('\\').pop()
 				log("", "GREEN")
-				log("[I] Uploading {:s}...".format(filename), "GREEN")
+				if filename.endswith("mp4"):
+					log("[I] Uploading video MP4 file to FTP server...".format(filename), "GREEN")
+				if filename.endswith("log"):
+					log("[I] Uploading comments logfile to FTP server...".format(filename), "GREEN")
+				if filename.endswith("json"):
+					log("[I] Uploading comments JSON file to FTP server...".format(filename), "GREEN")
 				filesize = os.path.getsize(file)
 				file_read = open(file, 'rb')
 				with tqdm(leave = False, ncols=70, miniters = 1, total = filesize, bar_format=">{bar}< - {percentage:3.0f}%") as tqdm_instance:
 					ftp.storbinary('STOR ' + filename, file_read, 2048, callback = lambda sent: tqdm_instance.update(len(sent)))
 				file_read.close()
-				log("[I] Successfully uploaded {:s}.".format(filename), "GREEN")
+				log("[I] Successfully uploaded file to FTP server.", "GREEN")
 			except Exception as e:
-				log("[E] Could not upload file to FTP server: {:s}".format(str(e)), "RED")
+				log("[E] Could not upload file '{:s}' to FTP server: {:s}".format(filename, str(e)), "RED")
 		ftp.quit()
 		ftp = None
 	except Exception as e:

+ 1 - 1
pyinstalive/initialize.py

@@ -255,7 +255,7 @@ def new_config():
 		else:
 			try:
 				log("[W] Could not find configuration file, creating a default one...", "YELLOW")
-				config_template = "[pyinstalive]\nusername = johndoe\npassword = grapefruits\nsave_path = " + os.getcwd() + "\nshow_cookie_expiry = true\nclear_temp_files = false\nsave_replays = true\nrun_at_start = \nrun_at_finish = \nsave_comments = false\n"
+				config_template = "[pyinstalive]\nusername = johndoe\npassword = grapefruits\nsave_path = " + os.getcwd() + "\nshow_cookie_expiry = true\nclear_temp_files = false\nsave_replays = true\nrun_at_start = \nrun_at_finish = \nsave_comments = false\n\n[ftp]\nftp_enabled = false\nftp_host = \nftp_save_path = \nftp_username = \nftp_password = \n"
 				config_file = open("pyinstalive.ini", "w")
 				config_file.write(config_template)
 				config_file.close()