mirror of
https://github.com/xtream1101/humblebundle-downloader.git
synced 2025-03-08 03:15:15 +01:00
Deprecate the download argument. Fixes #38
This commit is contained in:
parent
c6bb45911d
commit
95302d81e5
@ -40,7 +40,7 @@ pypi-package:
|
||||
tag:
|
||||
stage: release
|
||||
only:
|
||||
- master
|
||||
- main
|
||||
script:
|
||||
- *write_permission
|
||||
- export VERSION=$(echo $(python -c "import humblebundle_downloader._version as v; print(v.__version__)"))
|
||||
|
@ -1,5 +1,10 @@
|
||||
# Change log
|
||||
|
||||
|
||||
### 0.4.0
|
||||
- Deprecate the `download` argument. It is no longer needed since that is the only action that can be taken
|
||||
|
||||
|
||||
### 0.3.4
|
||||
- Merged in [PR 35](https://github.com/xtream1101/humblebundle-downloader/pull/35) to fix some trove games not downloading
|
||||
|
||||
|
@ -36,7 +36,7 @@ First thing to do is get your account cookies. This can be done by getting a bro
|
||||
|
||||
### 2. Downloading your library
|
||||
Use the following command to download your Humble Bundle Library:
|
||||
`hbd download --cookie-file cookies.txt --library-path "Downloaded Library" --progress`
|
||||
`hbd --cookie-file cookies.txt --library-path "Downloaded Library" --progress`
|
||||
|
||||
This directory structure will be used:
|
||||
`Downloaded Library/Purchase Name/Item Name/downloaded_file.ext`
|
||||
|
@ -1 +1 @@
|
||||
__version__ = '0.3.4'
|
||||
__version__ = '0.4.0'
|
||||
|
@ -1,4 +1,5 @@
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
import argparse
|
||||
|
||||
@ -13,19 +14,14 @@ logging.basicConfig(
|
||||
logging.getLogger('urllib3.connectionpool').setLevel(logging.WARNING)
|
||||
|
||||
|
||||
def cli():
|
||||
parser = argparse.ArgumentParser()
|
||||
subparsers = parser.add_subparsers(dest='action')
|
||||
subparsers.required = True
|
||||
def parse_args(args):
|
||||
if args[0].lower() == 'download':
|
||||
args = args[1:]
|
||||
raise DeprecationWarning("`download` argument is no longer used")
|
||||
|
||||
###
|
||||
# Download Library
|
||||
###
|
||||
parser_download = subparsers.add_parser(
|
||||
'download',
|
||||
help="Download content in your humble bundle library",
|
||||
)
|
||||
cookie = parser_download.add_mutually_exclusive_group(required=True)
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
cookie = parser.add_mutually_exclusive_group(required=True)
|
||||
cookie.add_argument(
|
||||
'-c', '--cookie-file', type=str,
|
||||
help="Location of the cookies file",
|
||||
@ -34,32 +30,32 @@ def cli():
|
||||
'-s', '--session-auth', type=str,
|
||||
help="Value of the cookie _simpleauth_sess. WRAP IN QUOTES",
|
||||
)
|
||||
parser_download.add_argument(
|
||||
parser.add_argument(
|
||||
'-l', '--library-path', type=str,
|
||||
help="Folder to download all content to",
|
||||
required=True,
|
||||
)
|
||||
parser_download.add_argument(
|
||||
parser.add_argument(
|
||||
'-t', '--trove', action='store_true',
|
||||
help="Only check and download Humble Trove content",
|
||||
)
|
||||
parser_download.add_argument(
|
||||
parser.add_argument(
|
||||
'-u', '--update', action='store_true',
|
||||
help=("Check to see if products have been updated "
|
||||
"(still get new products)"),
|
||||
)
|
||||
parser_download.add_argument(
|
||||
parser.add_argument(
|
||||
'-p', '--platform',
|
||||
type=str, nargs='*',
|
||||
help=("Only get content in a platform. Values can be seen in your "
|
||||
"humble bundle's library dropdown. Ex: -p ebook video"),
|
||||
)
|
||||
parser_download.add_argument(
|
||||
parser.add_argument(
|
||||
'--progress',
|
||||
action='store_true',
|
||||
help="Display progress bar for downloads",
|
||||
)
|
||||
filter_ext = parser_download.add_mutually_exclusive_group()
|
||||
filter_ext = parser.add_mutually_exclusive_group()
|
||||
filter_ext.add_argument(
|
||||
'-e', '--exclude',
|
||||
type=str, nargs='*',
|
||||
@ -71,27 +67,29 @@ def cli():
|
||||
type=str, nargs='*',
|
||||
help="Only download files with these extensions. Ex: -i pdf mobi",
|
||||
)
|
||||
parser_download.add_argument(
|
||||
parser.add_argument(
|
||||
'-k', '--keys',
|
||||
type=str, nargs='*',
|
||||
help=("The purchase download key. Find in the url on the "
|
||||
"products/bundle download page. Can set multiple"),
|
||||
)
|
||||
|
||||
cli_args = parser.parse_args()
|
||||
return parser.parse_args(args)
|
||||
|
||||
if cli_args.action == 'download':
|
||||
# Still keep the download action to keep compatibility
|
||||
from .download_library import DownloadLibrary
|
||||
DownloadLibrary(
|
||||
cli_args.library_path,
|
||||
cookie_path=cli_args.cookie_file,
|
||||
cookie_auth=cli_args.session_auth,
|
||||
progress_bar=cli_args.progress,
|
||||
ext_include=cli_args.include,
|
||||
ext_exclude=cli_args.exclude,
|
||||
platform_include=cli_args.platform,
|
||||
purchase_keys=cli_args.keys,
|
||||
trove=cli_args.trove,
|
||||
update=cli_args.update,
|
||||
).start()
|
||||
|
||||
def cli():
|
||||
cli_args = parse_args(sys.argv[1:])
|
||||
|
||||
from .download_library import DownloadLibrary
|
||||
DownloadLibrary(
|
||||
cli_args.library_path,
|
||||
cookie_path=cli_args.cookie_file,
|
||||
cookie_auth=cli_args.session_auth,
|
||||
progress_bar=cli_args.progress,
|
||||
ext_include=cli_args.include,
|
||||
ext_exclude=cli_args.exclude,
|
||||
platform_include=cli_args.platform,
|
||||
purchase_keys=cli_args.keys,
|
||||
trove=cli_args.trove,
|
||||
update=cli_args.update,
|
||||
).start()
|
||||
|
13
tests/test_cli.py
Normal file
13
tests/test_cli.py
Normal file
@ -0,0 +1,13 @@
|
||||
import pytest
|
||||
from humblebundle_downloader.cli import parse_args
|
||||
|
||||
|
||||
def test_old_action_format():
|
||||
with pytest.raises(DeprecationWarning):
|
||||
_ = parse_args(['download', '-l', 'some_path', '-c', 'fake_cookie'])
|
||||
|
||||
|
||||
def test_no_action():
|
||||
args = parse_args(['-l', 'some_path', '-c', 'fake_cookie'])
|
||||
assert args.library_path == 'some_path'
|
||||
assert args.cookie_file == 'fake_cookie'
|
Loading…
x
Reference in New Issue
Block a user