archive directory arg/option

This commit is contained in:
gauthiier 2016-06-27 16:08:51 +02:00
parent c813d877ae
commit c93cd5f300
3 changed files with 16 additions and 4 deletions

1
README
View File

@ -4,5 +4,6 @@ Options:
-h, --help show this help message and exit -h, --help show this help message and exit
-u URL, --url=URL nettime url -u URL, --url=URL nettime url
-l LIST, --list=LIST nettime's list name (ex: nettime-l) -l LIST, --list=LIST nettime's list name (ex: nettime-l)
-a ARCH, --arch=ARCH path to archive directory
Dependencies: bs4 Dependencies: bs4

View File

@ -14,7 +14,7 @@ def run(options):
## check valid url?... nej ## check valid url?... nej
nettime.archive_from_url(options.url, options.list) nettime.archive_from_url(options.url, options.list, options.arch)
sys.exit() sys.exit()
if __name__ == "__main__": if __name__ == "__main__":
@ -22,6 +22,7 @@ if __name__ == "__main__":
p = OptionParser(); p = OptionParser();
p.add_option('-u', '--url', action="store", help="nettime url", default="http://www.nettime.org/archives.php") p.add_option('-u', '--url', action="store", help="nettime url", default="http://www.nettime.org/archives.php")
p.add_option('-l', '--list', action="store", help="nettime's list name (ex: nettime-l)", default="nettime-l") p.add_option('-l', '--list', action="store", help="nettime's list name (ex: nettime-l)", default="nettime-l")
p.add_option('-a', '--arch', action="store", help="path to archive directory", default="archives")
options, args = p.parse_args() options, args = p.parse_args()

View File

@ -9,7 +9,7 @@ from pprint import pprint as pp
import sys, os, re, json, gzip import sys, os, re, json, gzip
import traceback import traceback
DELAY = 0.5 DELAY = 0.2
# hack for the mailbox module (re: force mbox.add() encoding to utf8) # hack for the mailbox module (re: force mbox.add() encoding to utf8)
reload(sys) reload(sys)
@ -99,8 +99,18 @@ def collect_threads_from_url(url, base_arch_dir, mbox):
for l in lists: for l in lists:
n += 1 n += 1
logging.info("> " + str(n) + " / " + nbr_threads) logging.info("> " + str(n) + " / " + nbr_threads)
thread = archive_thread(l, base_url, None)
threads['threads'].append(thread) try:
thread = archive_thread(l, base_url, None)
threads['threads'].append(thread)
except:
ex_type, ex, tb = sys.exc_info()
print ex_type
print ex
traceback.print_tb(tb)
del tb
continue
time.sleep(DELAY) time.sleep(DELAY)
# write # write