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. /!\ /!\ Use with caution. /!\
/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\ /!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\
''' '''
import argparse
import feedparser import feedparser
import json import json
import logging import logging
@ -204,15 +205,31 @@ def update_torrents():
if __name__ == '__main__': if __name__ == '__main__':
logging.basicConfig( logging.basicConfig(
level=logging.INFO, level=logging.WARNING,
format=' %(asctime)s - %(levelname)s - %(message)s' format=' %(asctime)s - %(levelname)s - %(message)s'
) )
parser = argparse.ArgumentParser(
print('PDMameUpdate is about to start') description='Update PleasureDome MAME Torrents'
# Useful if you run this script when your machine boots )
for i in range(5, 0, -1): parser.add_argument(
print('{}\r'.format(i), end=''), '-l', '--log',
time.sleep(1) 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+) (.*)') re_mame_version = re.compile(r'MAME 0.(\d+) (.*)')
config = open_config_file() config = open_config_file()