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
|
--- a/infinitychan.py
+++ b/infinitychan.py
@@ -287,18 +287,21 @@
threadviewer.parser.parse_post(report['reason'])))
-def scrape_files(board, thread, mode='unix'):
+def scrape_files(board, thread, mode='unix_original'):
"""Download all of a thread's files."""
for post in posts(board, thread):
files = get_files(post)
for i, file in enumerate(files):
- if mode == 'unix':
+ if mode == 'unix' \
+ or mode == 'unix_original':
if is_dedup(file):
name = str(post['time'] * 1000 + post['no'] % 1000)
if len(files) != 1:
name += '-{}'.format(i)
else:
name = file['tim']
+ if mode == 'unix_original':
+ name += '_' + file['filename']
elif mode == 'plain':
name = file['tim']
elif mode == 'original':
--- a/infinityctl
+++ b/infinityctl
@@ -72,7 +72,7 @@
('-c', '--count'): {'action': 'store_true'},
('-f', '--follow'): {'action': 'store_true'},
('-i', '--interval'): {'type': float},
- ('-m', '--mode'): {'choices': ('unix', 'plain', 'original')},
+ ('-m', '--mode'): {'choices': ('unix', 'plain', 'original', 'unix_original')},
('-n', '--number'): {'type': int},
('-o', '--ocr'): {'action': 'store_true'},
('-r', '--raw'): {'action': 'store_true'},
|