Add command line arguments

This commit is contained in:
2019-10-23 21:11:44 +02:00
parent 8eda620078
commit e60bccb429

View File

@ -39,6 +39,7 @@ Notes
/!\ Use with caution. /!\
/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\
'''
import argparse
import feedparser
import json
import logging
@ -204,15 +205,31 @@ def update_torrents():
if __name__ == '__main__':
logging.basicConfig(
level=logging.INFO,
level=logging.WARNING,
format=' %(asctime)s - %(levelname)s - %(message)s'
)
print('PDMameUpdate is about to start')
# Useful if you run this script when your machine boots
for i in range(5, 0, -1):
print('{}\r'.format(i), end=''),
time.sleep(1)
parser = argparse.ArgumentParser(
description='Update PleasureDome MAME Torrents'
)
parser.add_argument(
'-l', '--log',
action='store_true',
help='Display more log messages'
)
parser.add_argument(
'-c', '--countdown',
action='store_true',
help='Start with a 5 second countdown'
)
args = parser.parse_args()
if args.log:
logging.getLogger().setLevel(logging.INFO)
if args.countdown:
print('PDMameUpdate is about to start')
# Useful if you run this script when your machine boots
for i in range(5, 0, -1):
print('{}\r'.format(i), end=''),
time.sleep(1)
re_mame_version = re.compile(r'MAME 0.(\d+) (.*)')
config = open_config_file()