1
0
Fork 0
mirror of https://github.com/mwalbeck/podfox.git synced 2025-04-13 09:41:45 +00:00

Add functionality for specifying an alternate config file (defaults to ~/.podfox.json)

This commit is contained in:
Christopher Martin 2015-11-08 14:38:53 -06:00
parent 3f8e9e1146
commit fe2c9a0305

View file

@ -3,14 +3,15 @@
Usage: Usage:
podfox.py import <feed-url> [<shortname>] podfox.py import <feed-url> [<shortname>] [-c=<path>]
podfox.py update [<shortname>] podfox.py update [<shortname>] [-c=<path>]
podfox.py feeds podfox.py feeds [-c=<path>]
podfox.py episodes <shortname> podfox.py episodes <shortname> [-c=<path>]
podfox.py download [<shortname> --how-many=<n>] podfox.py download [<shortname> --how-many=<n>] [-c=<path>]
podfox.py rename <shortname> <newname> podfox.py rename <shortname> <newname> [-c=<path>]
Options: Options:
-c --config=<path> Specify an alternate config file [default: ~/.podfox.json ]
-h --help Show this help -h --help Show this help
""" """
# (C) 2015 Bastian Reitemeier # (C) 2015 Bastian Reitemeier
@ -273,8 +274,9 @@ if __name__ == '__main__':
arguments = docopt(__doc__, version='p0d 0.01') arguments = docopt(__doc__, version='p0d 0.01')
# before we do anything with the commands, # before we do anything with the commands,
# find the configuration file # find the configuration file
home_directory = expanduser("~") configfile = expanduser(arguments["--config"])
with open(home_directory + '/.podfox.json') as conf_file:
with open(configfile) as conf_file:
try: try:
CONFIGURATION = json.load(conf_file) CONFIGURATION = json.load(conf_file)
except ValueError: except ValueError: