Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
bobrinik committed Jan 29, 2022
1 parent 95b90e3 commit 72366e0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions humble_get/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import sys
import click
from .humble_get import get_page, get_books_to_download, select_format, download_a_book, BookFormat
from tqdm import tqdm


@click.command()
Expand All @@ -21,11 +20,15 @@ def main(humble_key, target_path, book_format, dry_run):
books = get_books_to_download(data)
books_to_download = [b for b in select_format(books, book_format)]

for book_to_download in tqdm(books_to_download):
n = len(books_to_download)
print(f"Books to download: {n}")
for book_to_download in books_to_download:
if dry_run:
print(f"Book: {book_to_download['book_name']}.{book_to_download['file_format']}")
else:
download_a_book(target_path, book_to_download)
n = n - 1
print(f"Books left to download: {n} ", end="\r")
return 0


Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
with open('README.md', encoding="utf-8") as readme_file:
readme = readme_file.read()

requirements = ['Click>=6.0', ]
requirements = ['Click>=6.0', 'requests', ]

setup_requirements = ['pytest-runner', ]

Expand All @@ -32,11 +32,12 @@
include_package_data=True,
keywords='humble_get',
name='humble_get',
python_requires='>=3.6, <3.10',
packages=find_packages(include=['humble_get']),
setup_requires=setup_requirements,
test_suite='tests',
tests_require=test_requirements,
url='https://github.com/bobrinik/humble_get',
version='0.1.0',
version='0.1.7',
zip_safe=False,
)

0 comments on commit 72366e0

Please sign in to comment.