forked from Mirrors/humblebundle-downloader
Deprecate the download argument. Fixes #38
This commit is contained in:
@@ -40,7 +40,7 @@ pypi-package:
|
|||||||
tag:
|
tag:
|
||||||
stage: release
|
stage: release
|
||||||
only:
|
only:
|
||||||
- master
|
- main
|
||||||
script:
|
script:
|
||||||
- *write_permission
|
- *write_permission
|
||||||
- export VERSION=$(echo $(python -c "import humblebundle_downloader._version as v; print(v.__version__)"))
|
- export VERSION=$(echo $(python -c "import humblebundle_downloader._version as v; print(v.__version__)"))
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
# Change log
|
# 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
|
### 0.3.4
|
||||||
- Merged in [PR 35](https://github.com/xtream1101/humblebundle-downloader/pull/35) to fix some trove games not downloading
|
- 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
|
### 2. Downloading your library
|
||||||
Use the following command to download your Humble Bundle 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:
|
This directory structure will be used:
|
||||||
`Downloaded Library/Purchase Name/Item Name/downloaded_file.ext`
|
`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 os
|
||||||
|
import sys
|
||||||
import logging
|
import logging
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
@@ -13,19 +14,14 @@ logging.basicConfig(
|
|||||||
logging.getLogger('urllib3.connectionpool').setLevel(logging.WARNING)
|
logging.getLogger('urllib3.connectionpool').setLevel(logging.WARNING)
|
||||||
|
|
||||||
|
|
||||||
def cli():
|
def parse_args(args):
|
||||||
parser = argparse.ArgumentParser()
|
if args[0].lower() == 'download':
|
||||||
subparsers = parser.add_subparsers(dest='action')
|
args = args[1:]
|
||||||
subparsers.required = True
|
raise DeprecationWarning("`download` argument is no longer used")
|
||||||
|
|
||||||
###
|
parser = argparse.ArgumentParser()
|
||||||
# Download Library
|
|
||||||
###
|
cookie = parser.add_mutually_exclusive_group(required=True)
|
||||||
parser_download = subparsers.add_parser(
|
|
||||||
'download',
|
|
||||||
help="Download content in your humble bundle library",
|
|
||||||
)
|
|
||||||
cookie = parser_download.add_mutually_exclusive_group(required=True)
|
|
||||||
cookie.add_argument(
|
cookie.add_argument(
|
||||||
'-c', '--cookie-file', type=str,
|
'-c', '--cookie-file', type=str,
|
||||||
help="Location of the cookies file",
|
help="Location of the cookies file",
|
||||||
@@ -34,32 +30,32 @@ def cli():
|
|||||||
'-s', '--session-auth', type=str,
|
'-s', '--session-auth', type=str,
|
||||||
help="Value of the cookie _simpleauth_sess. WRAP IN QUOTES",
|
help="Value of the cookie _simpleauth_sess. WRAP IN QUOTES",
|
||||||
)
|
)
|
||||||
parser_download.add_argument(
|
parser.add_argument(
|
||||||
'-l', '--library-path', type=str,
|
'-l', '--library-path', type=str,
|
||||||
help="Folder to download all content to",
|
help="Folder to download all content to",
|
||||||
required=True,
|
required=True,
|
||||||
)
|
)
|
||||||
parser_download.add_argument(
|
parser.add_argument(
|
||||||
'-t', '--trove', action='store_true',
|
'-t', '--trove', action='store_true',
|
||||||
help="Only check and download Humble Trove content",
|
help="Only check and download Humble Trove content",
|
||||||
)
|
)
|
||||||
parser_download.add_argument(
|
parser.add_argument(
|
||||||
'-u', '--update', action='store_true',
|
'-u', '--update', action='store_true',
|
||||||
help=("Check to see if products have been updated "
|
help=("Check to see if products have been updated "
|
||||||
"(still get new products)"),
|
"(still get new products)"),
|
||||||
)
|
)
|
||||||
parser_download.add_argument(
|
parser.add_argument(
|
||||||
'-p', '--platform',
|
'-p', '--platform',
|
||||||
type=str, nargs='*',
|
type=str, nargs='*',
|
||||||
help=("Only get content in a platform. Values can be seen in your "
|
help=("Only get content in a platform. Values can be seen in your "
|
||||||
"humble bundle's library dropdown. Ex: -p ebook video"),
|
"humble bundle's library dropdown. Ex: -p ebook video"),
|
||||||
)
|
)
|
||||||
parser_download.add_argument(
|
parser.add_argument(
|
||||||
'--progress',
|
'--progress',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help="Display progress bar for downloads",
|
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(
|
filter_ext.add_argument(
|
||||||
'-e', '--exclude',
|
'-e', '--exclude',
|
||||||
type=str, nargs='*',
|
type=str, nargs='*',
|
||||||
@@ -71,17 +67,19 @@ def cli():
|
|||||||
type=str, nargs='*',
|
type=str, nargs='*',
|
||||||
help="Only download files with these extensions. Ex: -i pdf mobi",
|
help="Only download files with these extensions. Ex: -i pdf mobi",
|
||||||
)
|
)
|
||||||
parser_download.add_argument(
|
parser.add_argument(
|
||||||
'-k', '--keys',
|
'-k', '--keys',
|
||||||
type=str, nargs='*',
|
type=str, nargs='*',
|
||||||
help=("The purchase download key. Find in the url on the "
|
help=("The purchase download key. Find in the url on the "
|
||||||
"products/bundle download page. Can set multiple"),
|
"products/bundle download page. Can set multiple"),
|
||||||
)
|
)
|
||||||
|
|
||||||
cli_args = parser.parse_args()
|
return parser.parse_args(args)
|
||||||
|
|
||||||
|
|
||||||
|
def cli():
|
||||||
|
cli_args = parse_args(sys.argv[1:])
|
||||||
|
|
||||||
if cli_args.action == 'download':
|
|
||||||
# Still keep the download action to keep compatibility
|
|
||||||
from .download_library import DownloadLibrary
|
from .download_library import DownloadLibrary
|
||||||
DownloadLibrary(
|
DownloadLibrary(
|
||||||
cli_args.library_path,
|
cli_args.library_path,
|
||||||
|
|||||||
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'
|
||||||
Reference in New Issue
Block a user