-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwishlist_check.py
executable file
·42 lines (34 loc) · 1.21 KB
/
wishlist_check.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python3
"""Save items in a _wishlist.txt or configure to load
from this script. script scans the source_path and
logs all _wishlist.txt zip entries not found on the path
to _log_wishlist.csv"""
from datetime import datetime
from libs.zipeditor.zipeditor import zip_scanner_excludedirs
source_path='data_zip'
exclude_list = set(['preprocess-fails'])
load_wishlist = True
if(load_wishlist):
with open('_wishlist.txt', 'r') as f:
wishlist = set([line.strip() for line in f])
else:
wishlist = set([
'8119_8119_thechicagotribune_subfolder.zip',
'json_XX-invalid.zip',
'nothere.zip',
'zip_good.zip',
])
print('\nWISHLIST\n', wishlist, '\n')
zip_files = zip_scanner_excludedirs(source_path=source_path,
exclude_list=exclude_list, join=False)
zip_names_dict = list(list(zip(*zip_files))[1])
zip_names_dict.sort()
with open('_log_wishlist.csv', 'a') as logfile:
dt = datetime.today().strftime('%Y%m%d-%H%M')
msg = '\n--- ' + dt + ' ---'
print(msg)
logfile.write(msg + '\n')
for wish in wishlist:
if wish not in zip_names_dict:
print('missing,', wish)
logfile.write('missing, '+ wish + '\n')