chitter...squash

This commit is contained in:
Kovid Goyal 2007-08-11 18:46:11 +00:00
parent 6c909065c4
commit ba7f7278fe

View File

@ -37,12 +37,10 @@ def option_parser():
'''it, you must specify the --url option.''' '''it, you must specify the --url option.'''
) )
parser.remove_option('-t')
parser.add_option('-u', '--url', dest='url', default=None, parser.add_option('-u', '--url', dest='url', default=None,
help='The URL to download. You only need to specify this if you are not specifying a website_profile.') help='The URL to download. You only need to specify this if you are not specifying a website_profile.')
parser.add_option('-t', '--timeout', help='Timeout in seconds to wait for a response from the server. Default: %default s', parser.add_option('--timeout', help='Timeout in seconds to wait for a response from the server. Default: %default s',
default=None, type='int', dest='timeout') default=None, type='int', dest='timeout')
parser.add_option('-r', '--max-recursions', help='Maximum number of levels to recurse i.e. depth of links to follow. Default %default', parser.add_option('-r', '--max-recursions', help='Maximum number of levels to recurse i.e. depth of links to follow. Default %default',
default=None, type='int', dest='max_recursions') default=None, type='int', dest='max_recursions')
@ -67,10 +65,14 @@ def fetch_website(options):
return fetcher.start_fetch(options.url), tdir return fetcher.start_fetch(options.url), tdir
def create_lrf(htmlfile, options): def create_lrf(htmlfile, options):
options.author = __appname__ if not options.author:
options.author = __appname__
options.header = True options.header = True
if not options.output: if options.output:
options.output = os.path.abspath(os.path.expanduser(options.output))
else:
options.output = os.path.abspath(os.path.expanduser(options.title + ('.lrs' if options.lrs else '.lrf'))) options.output = os.path.abspath(os.path.expanduser(options.title + ('.lrs' if options.lrs else '.lrf')))
process_file(htmlfile, options) process_file(htmlfile, options)
def main(args=sys.argv): def main(args=sys.argv):
@ -111,7 +113,7 @@ def main(args=sys.argv):
options.match_regexps += profile['match_regexps'] options.match_regexps += profile['match_regexps']
options.preprocess_regexps = profile['preprocess_regexps'] options.preprocess_regexps = profile['preprocess_regexps']
options.filter_regexps += profile['filter_regexps'] options.filter_regexps += profile['filter_regexps']
htmlfile, tdir = fetch_website(options) htmlfile, tdir = fetch_website(options)
create_lrf(htmlfile, options) create_lrf(htmlfile, options)
if profile.has_key('finalize'): if profile.has_key('finalize'):