1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-23 03:02:50 +01:00

apply selection options (filter, range) when using '-j'

This commit is contained in:
Mike Fährmann 2017-11-18 17:35:57 +01:00
parent b8cdd42cab
commit 6c9da67581
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -335,13 +335,11 @@ class DataJob(Job):
# collect data # collect data
try: try:
for msg in self.extractor: for msg in self.extractor:
copy = [ self.dispatch(msg)
part.copy() if hasattr(part, "copy") else part
for part in msg
]
self.data.append(copy)
except Exception as exc: except Exception as exc:
self.data.append((exc.__class__.__name__, str(exc))) self.data.append((exc.__class__.__name__, str(exc)))
except BaseException:
pass
# dump to 'file' # dump to 'file'
json.dump( json.dump(
@ -349,3 +347,12 @@ class DataJob(Job):
sort_keys=True, indent=2, ensure_ascii=self.ensure_ascii sort_keys=True, indent=2, ensure_ascii=self.ensure_ascii
) )
self.file.write("\n") self.file.write("\n")
def handle_url(self, url, keywords):
self.data.append((Message.Url, url, keywords.copy()))
def handle_directory(self, keywords):
self.data.append((Message.Directory, keywords.copy()))
def handle_queue(self, url, keywords):
self.data.append((Message.Queue, url, keywords.copy()))