diff options
author | msglm <msglm@techchud.xyz> | 2023-01-11 20:51:08 -0600 |
---|---|---|
committer | msglm <msglm@techchud.xyz> | 2023-01-11 20:51:08 -0600 |
commit | 6c542eb4bddd96297419b8593c823056aff6b3a8 (patch) | |
tree | 5ca85fa57408c75baca422034fd6dea77ad8d9b7 | |
parent | 0f10a47ad296b7f6bee00b157aee58f6c9056aa9 (diff) | |
download | comedyGenerator-6c542eb4bddd96297419b8593c823056aff6b3a8.tar.gz comedyGenerator-6c542eb4bddd96297419b8593c823056aff6b3a8.tar.bz2 comedyGenerator-6c542eb4bddd96297419b8593c823056aff6b3a8.zip |
added logging to standard output
-rwxr-xr-x | comedyGenerator | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/comedyGenerator b/comedyGenerator index 163875c..0d05108 100755 --- a/comedyGenerator +++ b/comedyGenerator @@ -47,7 +47,7 @@ parser.add_argument('--log','-l', default=config['DEFAULT']['log'], dest='log', action="store", - help="the output directory of the log file for your funnies", + help="the output directory of the log file for your funnies. STDOUT if you wish for standard output.", type=str ) @@ -59,6 +59,12 @@ parser.add_argument('--jobs','-j', type=int ) +parser.add_argument('--no-download', '--nd', + dest='noDownload', + action="store_true", + help="If you would like to actually download the funnies or not", + ) + parser.add_argument('--type','-t', default=str(config['DEFAULT']['type']), dest='type', @@ -105,7 +111,10 @@ if args.verbose: logging = False if not args.log == "False": logging = True - logFile = open(args.log, "a") + if args.log == "STDOUT": + logFile = "STDOUT" + else: + logFile = open(args.log, "a") tmpLog = [] if args.verbose: print("We're going to be logging!") @@ -220,23 +229,31 @@ for tags in args.tags: time.sleep(tries*1.5) continue break - if args.jobs > 1: + if args.jobs > 1 and args.noDownload == False: pool = Pool(args.jobs) for video in videos: pool.apply_async(download, (video.url, video.name,)) pool.close() pool.join() - if logging: - for video in videos: - logName = video.url - logPath = args.output + logName - if args.verbose: - print("Writing " + logPath + " to log file") - logFile.write(logPath + "\n") - logFile.close() - else: + elif args.noDownload == False: for video in videos: download(video.url, video.name) + + if logging and args.noDownload == False: + for video in videos: + logName = video.url + logPath = args.output + logName + if args.verbose: + print("Writing " + logPath + " to log file") + logFile.write(logPath + "\n") + elif logging: + for video in videos: + logName = video.url + if args.verbose: + print("Writing " + logName + " to log file") + logFile.write(logName + "\n") +logFile.close() + #This program is free software: you can redistribute it and/or modify #it under the terms of the GNU Affero General Public License version 3 as published by #the Free Software Foundation. |