Revert "Add --config option for explicitly stating configuration file to use."
This reverts commit 37a3d83725
.
This commit is contained in:
parent
975b2753c4
commit
e179c09fae
|
@ -186,15 +186,6 @@ Example usage: **`--downloaded-posts D:\bdfr\ALL_POSTS.txt`**
|
||||||
|
|
||||||
## **`--downloaded-delay`**
|
## **`--downloaded-delay`**
|
||||||
When specified, it delays every download for given seconds.
|
When specified, it delays every download for given seconds.
|
||||||
|
|
||||||
|
|
||||||
## **`--config`**
|
|
||||||
Specify a `config.json` file to use. This will disable reading from the default `Bulk downloader for reddit/config.json` file, as well as `--use-local-config` option.
|
|
||||||
|
|
||||||
Example usage: **`--config /etc/bdfr/config.json`**
|
|
||||||
Example usage: **`-c ~/config.json`**
|
|
||||||
Example usage: **`--config c:\Users\Me\Downloads\config.json`**
|
|
||||||
Example usage: **`-c c:\config.json`**
|
|
||||||
|
|
||||||
## ❔ FAQ
|
## ❔ FAQ
|
||||||
|
|
||||||
|
|
33
script.py
33
script.py
|
@ -269,26 +269,14 @@ def printLogo():
|
||||||
)
|
)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
sys.argv = sys.argv + GLOBAL.config["options"].split()
|
|
||||||
arguments = Arguments.parse()
|
|
||||||
GLOBAL.arguments = arguments
|
|
||||||
|
|
||||||
if arguments.config:
|
if not Path(GLOBAL.defaultConfigDirectory).is_dir():
|
||||||
if arguments.use_local_config:
|
os.makedirs(GLOBAL.defaultConfigDirectory)
|
||||||
sys.exit()
|
|
||||||
if Path(arguments.config).exists():
|
if Path("config.json").exists():
|
||||||
GLOBAL.configDirectory = Path(arguments.config)
|
GLOBAL.configDirectory = Path("config.json")
|
||||||
else:
|
|
||||||
VanillaPrint("custom config",arguments.config,"not found. Exiting.")
|
|
||||||
sys.exit()
|
|
||||||
else:
|
else:
|
||||||
if Path("config.json").exists():
|
GLOBAL.configDirectory = GLOBAL.defaultConfigDirectory / "config.json"
|
||||||
GLOBAL.configDirectory = Path("config.json")
|
|
||||||
else:
|
|
||||||
if not Path(GLOBAL.defaultConfigDirectory).is_dir():
|
|
||||||
os.makedirs(GLOBAL.defaultConfigDirectory)
|
|
||||||
GLOBAL.configDirectory = GLOBAL.defaultConfigDirectory / "config.json"
|
|
||||||
try:
|
try:
|
||||||
GLOBAL.config = Config(GLOBAL.configDirectory).generate()
|
GLOBAL.config = Config(GLOBAL.configDirectory).generate()
|
||||||
except InvalidJSONFile as exception:
|
except InvalidJSONFile as exception:
|
||||||
|
@ -296,6 +284,11 @@ def main():
|
||||||
VanillaPrint("Resolve it or remove it to proceed")
|
VanillaPrint("Resolve it or remove it to proceed")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
sys.argv = sys.argv + GLOBAL.config["options"].split()
|
||||||
|
|
||||||
|
arguments = Arguments.parse()
|
||||||
|
GLOBAL.arguments = arguments
|
||||||
|
|
||||||
if arguments.set_filename:
|
if arguments.set_filename:
|
||||||
Config(GLOBAL.configDirectory).setCustomFileName()
|
Config(GLOBAL.configDirectory).setCustomFileName()
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
@ -382,5 +375,5 @@ if __name__ == "__main__":
|
||||||
exc_info=full_exc_info(sys.exc_info()))
|
exc_info=full_exc_info(sys.exc_info()))
|
||||||
print(GLOBAL.log_stream.getvalue())
|
print(GLOBAL.log_stream.getvalue())
|
||||||
|
|
||||||
if not GLOBAL.arguments.quit:
|
if not GLOBAL.arguments.quit: input("\nPress enter to quit\n")
|
||||||
input("\nPress enter to quit\n")
|
|
||||||
|
|
|
@ -170,12 +170,6 @@ class Arguments:
|
||||||
type=int,
|
type=int,
|
||||||
help="Amount, in seconds, to delay before beginning the next item in the download queue")
|
help="Amount, in seconds, to delay before beginning the next item in the download queue")
|
||||||
|
|
||||||
parser.add_argument(
|
|
||||||
"--config","-c",
|
|
||||||
help="Specify exact config.json file to use. " \
|
|
||||||
"Disables reading from 'Bulk downloader for " \
|
|
||||||
"reddit/config.json' and --use-local-config " \
|
|
||||||
"option.")
|
|
||||||
|
|
||||||
if arguments == []:
|
if arguments == []:
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
Loading…
Reference in a new issue