Skip to content

Commit

Permalink
refactor: Custom Configuration (toml format)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnieey committed Aug 3, 2020
1 parent af92698 commit c4bef36
Show file tree
Hide file tree
Showing 6 changed files with 221 additions and 187 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@ site/
demo.gif
.mypy_cache/
poetry.lock
*.swp
*.swo
*.sw[po]
13 changes: 8 additions & 5 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ These projects were used to build `aria2p`. **Thank you!**
[`requests`](https://requests.readthedocs.io) |
[`responses`](https://github.com/getsentry/responses) |
[`toml`](https://github.com/uiri/toml) |
[`websocket_client`](https://github.com/websocket-client/websocket-client.git)
[`websocket_client`](https://github.com/websocket-client/websocket-client.git) |
[`xdg`](https://github.com/srstevenson/xdg)

### Indirect dependencies
[`aiocontextvars`](https://github.com/fantix/aiocontextvars) |
Expand All @@ -55,14 +56,13 @@ These projects were used to build `aria2p`. **Thank you!**
[`attrs`](https://www.attrs.org/) |
[`backcall`](https://github.com/takluyver/backcall) |
[`beautifulsoup4`](http://www.crummy.com/software/BeautifulSoup/bs4/) |
[`certifi`](https://certifi.io/) |
[`certifi`](https://certifiio.readthedocs.io/en/latest/) |
[`chardet`](https://github.com/chardet/chardet) |
[`click`](https://palletsprojects.com/p/click/) |
[`colorama`](https://github.com/tartley/colorama) |
[`contextvars`](https://github.com/MagicStack/contextvars) |
[`decorator`](https://github.com/micheles/decorator) |
[`dis3`](https://github.com/KeyWeeUsr/python-dis3) |
[`entrypoints`](https://github.com/takluyver/entrypoints) |
[`execnet`](https://execnet.readthedocs.io/en/latest/) |
[`flake8-polyfill`](https://gitlab.com/pycqa/flake8-polyfill) |
[`future`](https://python-future.org) |
Expand All @@ -74,12 +74,14 @@ These projects were used to build `aria2p`. **Thank you!**
[`ipython-genutils`](http://ipython.org) |
[`jedi`](https://github.com/davidhalter/jedi) |
[`Jinja2`](https://palletsprojects.com/p/jinja/) |
[`joblib`](https://joblib.readthedocs.io) |
[`livereload`](https://github.com/lepture/python-livereload) |
[`lunr`](https://github.com/yeraydiazdiaz/lunr.py) |
[`Markdown`](https://Python-Markdown.github.io/) |
[`MarkupSafe`](https://palletsprojects.com/p/markupsafe/) |
[`mccabe`](https://github.com/pycqa/mccabe) |
[`more-itertools`](https://github.com/erikrose/more-itertools) |
[`mkdocs-material-extensions`](https://github.com/facelessuser/mkdocs-material-extensions) |
[`more-itertools`](https://github.com/more-itertools/more-itertools) |
[`mypy-extensions`](https://github.com/python/mypy_extensions) |
[`nltk`](http://nltk.org/) |
[`packaging`](https://github.com/pypa/packaging) |
Expand All @@ -92,7 +94,7 @@ These projects were used to build `aria2p`. **Thank you!**
[`pluggy`](https://github.com/pytest-dev/pluggy) |
[`prompt-toolkit`](https://github.com/prompt-toolkit/python-prompt-toolkit) |
[`ptyprocess`](https://github.com/pexpect/ptyprocess) |
[`py`](http://py.readthedocs.io/) |
[`py`](https://py.readthedocs.io/) |
[`pycodestyle`](https://pycodestyle.readthedocs.io/) |
[`pydocstyle`](https://github.com/PyCQA/pydocstyle/) |
[`pyfiglet`](https://github.com/pwaller/pyfiglet) |
Expand All @@ -114,6 +116,7 @@ These projects were used to build `aria2p`. **Thank you!**
[`termcolor`](http://pypi.python.org/pypi/termcolor) |
[`testfixtures`](https://github.com/Simplistix/testfixtures) |
[`tornado`](http://www.tornadoweb.org/) |
[`tqdm`](https://github.com/tqdm/tqdm) |
[`traitlets`](http://ipython.org) |
[`typed-ast`](https://github.com/python/typed_ast) |
[`typing-extensions`](https://github.com/python/typing/blob/master/typing_extensions/README.rst) |
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ requests = "*"
loguru = "*"
websocket_client = "*"
asciimatics = { version = "^1.11.0", optional = true }
xdg = "^4.0.1"

[tool.poetry.dev-dependencies]
bandit = "^1.5"
Expand Down
13 changes: 7 additions & 6 deletions src/aria2p/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,13 @@ def move_to_bottom(self, download: Download) -> int:
"""
return self.client.change_position(download.gid, 0, "POS_END")

def retry_downloads(
self, downloads: List[Download], force: bool = False, files: bool = False, clean: bool = False
) -> List[bool]:
def retry_downloads(self, downloads: List[Download], clean: bool = False) -> List[bool]:
"""
Retry failed downloads.
Resume failed downloads from where they left off with new GIDs.
Resume downloads from where they left off with new GIDs.
Parameters:
downloads: the list of downloads to remove.
clean: whether to remove the aria2 control file as well.
Returns:
Success or failure of the operation for each given download.
Expand All @@ -344,10 +344,11 @@ def retry_downloads(
if not download.has_failed:
continue
try:
uri = self.client.get_files(download.gid)[0]["uris"][0]["uri"]
uri = download.files[0].uris[0]["uri"]
new_download_gid = self.add_uris([uri], download.options)
if not new_download_gid:
continue

self.remove([download], clean)
result.append(True)

Expand Down
Loading

0 comments on commit c4bef36

Please sign in to comment.