Continue to clean up.
Chris Pressey
5 years ago
0 | 0 | #!/usr/bin/env python |
1 | 1 | |
2 | from os.path import realpath, dirname, join | |
2 | from argparse import ArgumentParser | |
3 | import hashlib | |
4 | import json | |
5 | import os | |
6 | #from subprocess import check_call | |
3 | 7 | import sys |
4 | ||
5 | sys.path.insert(0, join(dirname(realpath(sys.argv[0])), '..', 'src')) | |
6 | ||
7 | from argparse import ArgumentParser | |
8 | import json | |
9 | import sys | |
10 | import hashlib | |
11 | import os | |
12 | 8 | from time import sleep, localtime, strftime |
13 | 9 | import urllib |
14 | 10 | |
72 | 68 | def __init__(self, links, article_root=None, ignore_urls=None): |
73 | 69 | self.links = links |
74 | 70 | self.article_root = article_root |
75 | self.missing_only = missing_only | |
76 | 71 | self.ignore_urls = ignore_urls or [] |
77 | 72 | |
78 | 73 | def handle_link(self, url): |
93 | 88 | else: |
94 | 89 | filename = url |
95 | 90 | filename = urllib.unquote(filename) |
96 | filename = os.path.join(article_root, filename) | |
91 | filename = os.path.join(self.article_root, filename) | |
97 | 92 | if not os.path.exists(filename): |
98 | 93 | raise ValueError('Local file "{}" does not exist'.format(filename)) |
99 | 94 | continue |