jakewaldron / PlexEmail

This script aggregates all new TV, movie and music releases for the past configured time then optionally writes to your web directory and sends out an email.
206 stars 32 forks source link

testMode always TRUE #68

Closed pengc99 closed 7 years ago

pengc99 commented 7 years ago

While trying to get my plexEmail set to work, I noticed a problem with the way the script detects the test mode argument

testMode = False

if ('test' in args):
  logging.info('Test flag found - setting script instance to test mode.')
  testMode = args['test']
else:
  logging.info('Test flag not found.')

it looks like the array "args" will always include the string "test" in it:

2017-02-03 16:00:24,880 - INFO:{'test': False, 'configfile': '/usr/local/src/plexemail/scripts/config.conf', 'version': False, 'notice': None}

Which would cause the bit of code to always be a true statement.

jakewaldron commented 7 years ago

In this case the test flag would be found and testMode would be set to False. The else statement is not necessary, but testMode will still be set properly. I'll clean it up in a future release.

jakewaldron commented 7 years ago

Logic is the same, but changed the logging information to be more clear - in the dev branch

jakewaldron commented 7 years ago

Dev branch has been merged into master. Closing.