Quellcode durchsuchen

Add path check for config save path, improve auth logging

Cammy vor 7 Jahren
Ursprung
Commit
68b42a983b
3 geänderte Dateien mit 9 neuen und 5 gelöschten Zeilen
  1. 3 3
      pyinstalive/auth.py
  2. 5 1
      pyinstalive/pyinstalive.py
  3. 1 1
      setup.py

+ 3 - 3
pyinstalive/auth.py

@@ -18,7 +18,7 @@ except ImportError:
         __version__ as client_version)
 
 
-scriptVersion = "2.1.1"
+scriptVersion = "2.1.2"
 
 
 def to_json(python_object):
@@ -38,7 +38,7 @@ def onlogin_callback(api, settings_file):
     cache_settings = api.settings
     with open(settings_file, 'w') as outfile:
         json.dump(cache_settings, outfile, default=to_json)
-        logger.log('[I] New settings file was made: {0!s}'.format(settings_file), "GREEN")
+        logger.log('[I] New auth cookie file was made: {0!s}'.format(settings_file), "GREEN")
 
 
 def login(username, password):
@@ -51,7 +51,7 @@ def login(username, password):
         settings_file = "credentials.json"
         if not os.path.isfile(settings_file):
             # settings file does not exist
-            logger.log('[W] Unable to find settings file: {0!s}'.format(settings_file), "YELLOW")
+            logger.log('[W] Unable to find auth cookie file: {0!s}'.format(settings_file), "YELLOW")
 
             # login new
             api = Client(

+ 5 - 1
pyinstalive/pyinstalive.py

@@ -32,4 +32,8 @@ def run():
 	else:
 		api = auth.login(config['pyinstalive']['username'], config['pyinstalive']['password'])
 
-	downloader.main(api, args.record, config['pyinstalive']['save_path'])
+	if (os.path.exists(config['pyinstalive']['save_path'])):
+		downloader.main(api, args.record, config['pyinstalive']['save_path'])
+	else:
+		logger.log("[W] Invalid save path was specified! Falling back to location: " + os.getcwd(), "RED")
+		downloader.main(api, args.record, os.getcwd())

+ 1 - 1
setup.py

@@ -3,7 +3,7 @@ from setuptools import setup
 
 __author__ = 'notcammy'
 __email__ = 'neus2benen@gmail.com'
-__version__ = '2.1.1'
+__version__ = '2.1.2'
 
 _api_version = '1.3.6'
 _api_extensions_version = '0.3.6'