audible-cli is a command line interface for the Audible package. https://github.com/mkb79/audible-cli
|mkb79 1bfbf72f66 doc: fix CHANGELOG.md||1 week ago|
|.github||2 months ago|
|docs||3 years ago|
|plugin_cmds||9 months ago|
|src||1 week ago|
|utils||1 year ago|
|.gitignore||1 year ago|
|CHANGELOG.md||1 week ago|
|LICENSE||3 years ago|
|MANIFEST.in||3 years ago|
|README.md||2 months ago|
|audible.spec||1 year ago|
|pyi_entrypoint.py||2 weeks ago|
|setup.cfg||3 years ago|
|setup.py||1 week ago|
|test.py||3 years ago|
audible-cli is a command line interface for the Audible package. Both are written with Python.
audible-cli needs at least Python 3.6 and Audible v0.6.0.
It depends on the following packages:
You can install audible-cli from pypi with
pip install audible-cli
or install it directly from GitHub with
git clone https://github.com/mkb79/audible-cli.git cd audible-cli pip install .
If you don't want to install
audible-cli on your machine, you can
find standalone exe files below or on the releases
page (including beta releases). At this moment Windows, Linux and macOS are supported.
On every execution, the binary code must be extracted. On Windows machines this can result in a long start time. If you use
audible-cli often, I would prefer the
directory package for Windows!
You can create them yourself this way
git clone https://github.com/mkb79/audible-cli.git cd audible-cli pip install .[pyi] # onefile output pyinstaller --clean -F --hidden-import audible_cli -n audible -c pyi_entrypoint # onedir output pyinstaller --clean -D --hidden-import audible_cli -n audible -c pyi_entrypoint
There are some limitations when using plugins. The binary maybe does not contain all the dependencies from your plugin script.
Tab completion can be provided for commands, options and choice values. Bash, Zsh and Fish are supported. More information can be found here.
audible-cli use an app dir where it expects all necessary files.
AUDIBLE_CONFIG_DIR environment variable is set, it uses the value
as config dir. Otherwise, it will use a folder depending on the operating
|Mac OS X||
The config data will be stored in the toml
It has a main section named
APP and sections for each profile created
audible-cli make use of profiles. Each profile contains the name of the corresponding auth file and the country code for the audible marketplace. If you have audiobooks on multiple marketplaces, you have to create a profile for each one with the same auth file.
In the main section of the config file, a primary profile is defined.
This profile is used, if no other is specified. You can call
audible -P PROFILE_NAME, to select another profile.
Like the config file, auth files are stored in the config dir too. If you
protected your auth file with a password call
audible -p PASSWORD, to
provide the password.
If the auth file is encrypted, and you don’t provide the password, you will be asked for it with a „hidden“ input field.
An option in the config file is separated by an underline. In the CLI prompt, an option must be entered with a dash.
The APP section supports the following options:
downloadcommand, a filename mode can be specified here. If not present, "ascii" will be used as default. To override these option, you can provide a mode with the
filename-modeoption of the download command.
audible quickstart command in your shell
to create your first config, profile and auth file.
runs on the interactive mode, so you have to answer multiple questions to finish.
If you have used
audible quickstart and want to add a second profile, you need to first create a new authfile and then update your config.toml file.
So the correct order is:
audible manage auth-file add
audible manage profile add
audible -h to show the help and a list of all available subcommands. You can show the help for each subcommand like so:
audible <subcommand> -h. If a subcommand has another subcommands, you csn do it the same way.
At this time, there the following buildin subcommands:
To download all of your audiobooks in the aaxc format use:
audible download --all --aaxc
To download all of your audiobooks after the Date 2022-07-21 in aax format use:
audible download --start-date "2022-07-21" --aax --all
There are 6 different verbosity levels:
By default, the verbosity level is set to
info. You can provide another level like so:
audible -v <level> <subcommand> ....
If you use the
download subcommand with the
--all flag there will be a huge output. Best practise is to set the verbosity level to
audible -v error download --all ...
AUDIBLE_PLUGIN_DIR environment variable is set, it uses the value
as location for the plugin dir. Otherwise, it will use a the
of the app dir. Read above how Audible-cli searches the app dir.
You can provide own subcommands and execute them with
All plugin commands must be placed in the plugin folder. Every subcommand must
have his own file. Every file have to be named
Each subcommand file must have a function called
cli as entrypoint.
This function has to be decorated with
Relative imports in the command files doesn't work. So you have to work with
absolute imports. Please take care about this. If you have any issues with
absolute imports please add your plugin path to the
PYTHONPATH variable or
add this lines of code to the beginning of your command script:
import sys import pathlib sys.path.insert(0, str(pathlib.Path(__file__).parent))
Examples can be found here.
If you want to develop a complete plugin package for
audible-cli you can
do this on an easy way. You only need to register your sub-commands or
subgroups to an entry-point in your setup.py that is loaded by the core
Example for a setup.py
from setuptools import setup setup( name="yourscript", version="0.1", py_modules=["yourscript"], install_requires=[ "click", "audible_cli" ], entry_points=""" [audible.cli_plugins] cool_subcommand=yourscript.cli:cool_subcommand another_subcommand=yourscript.cli:another_subcommand """, )
Commands will be added in the following order:
If a command is added, all further commands with the same name will be ignored. This enables you to "replace" build-in commands very easy.
If you want to add information about your add-on please open a PR or a new issue!