1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 10:42:34 +01:00

add script to collect test results in JSON format

This commit is contained in:
Mike Fährmann 2017-04-14 14:45:35 +02:00
parent f4aa452bd1
commit 385285932a
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 35 additions and 0 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
archive/
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

33
scripts/build_testresult_db.py Executable file
View File

@ -0,0 +1,33 @@
#!/usr/bin/env python
import sys
import os.path
import datetime
ROOTDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, os.path.realpath(ROOTDIR))
from gallery_dl import extractor, job, config
tests = [
([url[0] for url in extr.test], extr)
for extr in extractor.extractors()
if hasattr(extr, "test")
]
if len(sys.argv) > 1:
tests = [
(urls, extr)
for urls, extr in tests
if extr.category in sys.argv
]
path = os.path.join(ROOTDIR, "archive/testdb", str(datetime.date.today()))
os.makedirs(path, exist_ok=True)
config.load()
for urls, extr in tests:
for i, url in enumerate(urls):
name = "%s-%s-%d.json" % (extr.category, extr.subcategory, i)
print(name)
with open(os.path.join(path, name), "w") as outfile:
job.DataJob(url, outfile).run()