Skip to content

Instantly share code, notes, and snippets.

Created Oct 24, 2021
What would you like to do?
import glob
import pathlib
from import LongRunning
DOIT_CONFIG = {"action_string_formatting": "new"}
def aria_files():
globs = glob.glob("*.aria2.txt") + glob.glob("*.session")
files = []
for g in globs:
p = pathlib.Path(g)
if p.suffix == ".txt" and p.with_suffix(".session").name in globs:
to_add = p.with_suffix(".session").name
return files
def cmd_string(_file):
f = pathlib.Path(_file)
return (
f"aria2c --input-file {_file} "
"--load-cookies cookies.txt "
'--on-download-complete "$(pwd)"/ '
"--optimize-concurrent-downloads true "
"--show-console-readout false "
"--conditional-get true"
) + (
f" --save-session {f.with_suffix('.session').name}"
if f.suffix == ".txt"
else ""
def task_download():
files = aria_files()
yield {
"basename": "download",
"name": None,
"doc": "downloads input-files with aria2",
for f in files:
cmd = cmd_string(f)
yield {
"name": f,
"actions": [LongRunning(cmd)],
"verbosity": 2,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment