Skip to content

Commit

Permalink
Update Script - Fix config out-of-date warning
Browse files Browse the repository at this point in the history
Fixed program displaying warning about config being out of date, when there is no config file at all.

Add config to gitignore
  • Loading branch information
ThioJoe committed Dec 27, 2021
1 parent 0b661a5 commit 8e9a2b6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,6 @@ token.pickle
# Ignore log files
Spam_*.txt
Spam_*.rtf

# Ignore user-generated config file
SpamPurgeConfig.ini
19 changes: 11 additions & 8 deletions YouTubeSpammerPurge.py
Original file line number Diff line number Diff line change
Expand Up @@ -2029,14 +2029,17 @@ def main():

# Check for config file, load into dictionary 'config'
config = load_config_file()
try:
configFileVersion = int(config['config_version'])
if configFileVersion < configVersion:
if config:
try:
configFileVersion = int(config['config_version'])
if configFileVersion < configVersion:
configOutOfDate = True
else:
configOutOfDate = False
except:
configOutOfDate = True
else:
configOutOfDate = False
except:
configOutOfDate = True
else:
configOutOfDate = False

os.system(clear_command)
if config != None:
Expand Down Expand Up @@ -2115,7 +2118,7 @@ def main():

if updateAvailable == True:
print(f"{F.LIGHTGREEN_EX}Notice: A new version is available! Choose 'Check For Updates' option for details.{S.R}\n")
if configOutOfDate == True:
if config and configOutOfDate == True:
print(f"{F.LIGHTRED_EX}Notice: Your config file is out of date! Choose 'Create your own config file' to generate a new one.{S.R}\n")

# Make sure input is valid, if not ask again
Expand Down

0 comments on commit 8e9a2b6

Please sign in to comment.