Selaa lähdekoodia

Minor code improvements

Cammy 7 vuotta sitten
vanhempi
commit
8a2035dd3a
3 muutettua tiedostoa jossa 8 lisäystä ja 8 poistoa
  1. 1 1
      pyinstalive/auth.py
  2. 5 5
      pyinstalive/initialize.py
  3. 2 2
      pyinstalive/logger.py

+ 1 - 1
pyinstalive/auth.py

@@ -98,7 +98,7 @@ def login(username, password, show_cookie_expiry, ignore_existing_cookie):
 		sys.exit(99)
 
 	log('[I] Using cached login cookie for "' + api.authenticated_user_name + '".', "GREEN")
-	if show_cookie_expiry.title() == 'True' and ignore_existing_cookie == False:
+	if show_cookie_expiry.title() == 'True' and not ignore_existing_cookie:
 		cookie_expiry = api.cookie_jar.expires_earliest
 		log('[I] Login cookie expiry date: {0!s}'.format(datetime.datetime.fromtimestamp(cookie_expiry).strftime('%Y-%m-%d at %I:%M:%S %p')), "GREEN")
 

+ 5 - 5
pyinstalive/initialize.py

@@ -180,7 +180,7 @@ def show_info(config):
 	log("", "GREEN")
 	log("[I] PyInstaLive version:    	" + script_version, "GREEN")
 	log("[I] Python version:         	" + python_version, "GREEN")
-	if check_ffmpeg() == False:
+	if not check_ffmpeg():
 		log("[E] FFmpeg framework:       	Not found", "RED")
 	else:
 		log("[I] FFmpeg framework:       	Available", "GREEN")
@@ -371,7 +371,7 @@ def run():
 		show_info(config)
 		sys.exit(0)
 	
-	if (args.config == True):
+	if (args.config):
 		new_config()
 		sys.exit(0)
 
@@ -388,11 +388,11 @@ def run():
 
 
 	if check_config_validity(config):
-		if (args.clean == True):
+		if (args.clean):
 			clean_download_dir()
 			sys.exit(0)
 
-		if check_ffmpeg() == False:
+		if not check_ffmpeg():
 			log("[E] Could not find ffmpeg, the script will now exit. ", "RED")
 			seperator("GREEN")
 			sys.exit(1)
@@ -402,7 +402,7 @@ def run():
 			seperator("GREEN")
 			sys.exit(1)
 
-		if (args.noreplays == True):
+		if (args.noreplays):
 			settings.save_replays = "false"
 
 		if (args.username is not None) and (args.password is not None):

+ 2 - 2
pyinstalive/logger.py

@@ -40,8 +40,8 @@ def supports_color():
 	# isatty is not always implemented, #6223.
 	is_a_tty = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty()
 	if not supported_platform or not is_a_tty:
-		return False
-	return True
+		return "No"
+	return "Yes"
 
 def log(string, color):
 	if not supports_color():