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,10 +205,26 @@ 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(
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') print('PDMameUpdate is about to start')
# Useful if you run this script when your machine boots # Useful if you run this script when your machine boots
for i in range(5, 0, -1): for i in range(5, 0, -1):