git @ Cat's Eye Technologies yastasoti / 67bbded
Add logging. Chris Pressey 1 year, 10 months ago
2 changed file(s) with 10 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
1616
1717 #### Planned features ####
1818
19 * archive youtube links with youtube-dl.
20 * logging
21 * Handle failures (redirects, etc) better. Fall back to external tool like `wget` or `curl`.
19 * Archive youtube links with youtube-dl.
20 * Handle failures (redirects, etc) better.
21 * Allow use of an external tool like `wget` or `curl` to do fetching.
22 * Allow categorization of downloaded stuff.
2223
2324 ### Examples ###
2425
168168
169169
170170 def main(args):
171 #logging.basicConfig(level=logging.INFO)
172
173171 argparser = ArgumentParser()
174172
175173 # Checks if the links are resolvable, and optionally downloads a copy of each
196194 argparser.add_argument('--ignore-urls', metavar='URLS', type=str, default=None,
197195 help='Comma-separated list of link targets that should not even try to be fetched'
198196 )
197 argparser.add_argument('--log-to', metavar='FILENAME', type=str, default=None,
198 help='Enable logging and direct the messages to the specified file'
199 )
199200
200201 options = argparser.parse_args(sys.argv[1:])
202
203 if options.log_to:
204 logging.basicConfig(level=logging.INFO, filename=options.log_to)
201205
202206 links = []
203207 for filename in options.input_files: