Skip to content

Commit

Permalink
Shift libby subcommands up since it will likely be more popular from …
Browse files Browse the repository at this point in the history
…now on
  • Loading branch information
ping committed Feb 27, 2023
1 parent 99eee56 commit 5af3cac
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 41 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ python3 -m pip uninstall odmpy
```
usage: odmpy [-h] [--version] [-v] [-t TIMEOUT] [-r RETRIES]
[--noversioncheck]
{info,dl,ret,libby,libbyreturn,libbyrenew} ...
{libby,libbyreturn,libbyrenew,dl,ret,info} ...
Manage your OverDrive loans
Expand All @@ -65,14 +65,14 @@ options:
--noversioncheck Do not check if newer version is available.
Available commands:
{info,dl,ret,libby,libbyreturn,libbyrenew}
{libby,libbyreturn,libbyrenew,dl,ret,info}
To get more help, use the -h option with the command.
info Get information about a loan file
dl Download from a loan odm file.
ret Return a loan file.
libby Download audiobook/ebook/magazine loans via Libby.
libbyreturn Return loans via Libby.
libbyrenew Renew loans via Libby.
dl Download from an audiobook loan file (odm).
ret Return an audiobook loan file (odm).
info Get information about an audiobook loan file (odm).
Version 0.7.2. [Python 3.10.6-darwin] Source at https://github.com/ping/odmpy
```
Expand Down
71 changes: 35 additions & 36 deletions odmpy/odm.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,40 +459,6 @@ def run(
help="To get more help, use the -h option with the command.",
)

# odm info parser
parser_info = subparsers.add_parser(
OdmpyCommands.Information,
description="Get information about an audiobook loan file.",
help="Get information about an audiobook loan file",
)
parser_info.add_argument(
"-f",
"--format",
dest="format",
choices=["text", "json"],
default="text",
help="Format for output.",
)
parser_info.add_argument("odm_file", type=str, help="ODM file path.")

# odm download parser
parser_dl = subparsers.add_parser(
OdmpyCommands.Download,
description="Download from an audiobook loan file.",
help="Download from a audiobook loan file.",
formatter_class=argparse.RawTextHelpFormatter,
)
parser_dl.add_argument("odm_file", type=str, help="ODM file path.")
add_common_download_arguments(parser_dl)

# odm return parser
parser_ret = subparsers.add_parser(
OdmpyCommands.Return,
description="Return an audiobook loan file.",
help="Return an audiobook loan file.",
)
parser_ret.add_argument("odm_file", type=str, help="ODM file path.")

# libby download parser
parser_libby = subparsers.add_parser(
OdmpyCommands.Libby,
Expand Down Expand Up @@ -581,6 +547,40 @@ def run(
)
add_common_libby_arguments(parser_libby_renew)

# odm download parser
parser_dl = subparsers.add_parser(
OdmpyCommands.Download,
description="Download from an audiobook loan file (odm).",
help="Download from an audiobook loan file (odm).",
formatter_class=argparse.RawTextHelpFormatter,
)
parser_dl.add_argument("odm_file", type=str, help="ODM file path.")
add_common_download_arguments(parser_dl)

# odm return parser
parser_ret = subparsers.add_parser(
OdmpyCommands.Return,
description="Return an audiobook loan file (odm).",
help="Return an audiobook loan file (odm).",
)
parser_ret.add_argument("odm_file", type=str, help="ODM file path.")

# odm info parser
parser_info = subparsers.add_parser(
OdmpyCommands.Information,
description="Get information about an audiobook loan file (odm).",
help="Get information about an audiobook loan file (odm).",
)
parser_info.add_argument(
"-f",
"--format",
dest="format",
choices=["text", "json"],
default="text",
help="Format for output.",
)
parser_info.add_argument("odm_file", type=str, help="ODM file path.")

args = parser.parse_args(custom_args)

if injected_stream_handler:
Expand Down Expand Up @@ -631,8 +631,7 @@ def run(
OdmpyCommands.LibbyReturn,
OdmpyCommands.LibbyRenew,
):
client_title = "Libby Interactive Client"
logger.info(client_title)
logger.info("odmpy Interactive Client for Libby")
logger.info("-" * 70)

libby_client = LibbyClient(
Expand Down

0 comments on commit 5af3cac

Please sign in to comment.