Common code for url/options handling

master
pictuga 2013-06-25 13:13:23 +02:00
parent 89662ccbae
commit 1f4c219880
1 changed files with 9 additions and 10 deletions

View File

@ -457,27 +457,26 @@ def Gather(url, cachePath, mode='feed'):
return root.tostring(xml_declaration=True, encoding='UTF-8') return root.tostring(xml_declaration=True, encoding='UTF-8')
if __name__ == "__main__": if __name__ == "__main__":
if 'REQUEST_URI' in os.environ: url, options = parseOptions(OPTIONS)
url, options = parseOptions(OPTIONS)
if 'REQUEST_URI' in os.environ:
print 'Status: 200' print 'Status: 200'
if options == 'progress': if options == 'progress':
print 'Content-Type: application/octet-stream\n' print 'Content-Type: application/octet-stream'
else: else:
print 'Content-Type: text/html\n' print 'Content-Type: text/html'
print
cache = os.getcwd() + '/cache' cache = os.getcwd() + '/cache'
log(url) log(url)
else: else:
url, options = parseOptions(OPTIONS)
if url is None:
print "Please provide url."
sys.exit(1)
cache = os.path.expanduser('~') + '/.cache/morss' cache = os.path.expanduser('~') + '/.cache/morss'
if url is None:
print "Please provide url."
sys.exit(1)
if options == 'progress': if options == 'progress':
MAX_TIME = -1 MAX_TIME = -1
if options == 'cache': if options == 'cache':