AAX is supported!
This commit is contained in:
parent
0fc3a838d4
commit
2ecca95d21
6 changed files with 160 additions and 47 deletions
26
src/knock.py
26
src/knock.py
|
@ -3,15 +3,17 @@
|
|||
import subprocess, magic, shutil, click
|
||||
from pathlib import Path
|
||||
from getpass import getpass
|
||||
from handle_acsm import handle_acsm
|
||||
from xdg import xdg_config_home
|
||||
|
||||
from handle_acsm import handle_acsm
|
||||
from handle_aax import handle_aax
|
||||
|
||||
__version__ = "1.0.0-alpha"
|
||||
|
||||
@click.version_option()
|
||||
@click.command()
|
||||
@click.argument(
|
||||
"file",
|
||||
"path",
|
||||
type=click.Path(
|
||||
exists=True,
|
||||
file_okay=True,
|
||||
|
@ -20,23 +22,27 @@ __version__ = "1.0.0-alpha"
|
|||
resolve_path=True
|
||||
)
|
||||
)
|
||||
def main(file):
|
||||
file = Path(file)
|
||||
def main(path):
|
||||
path = Path(path)
|
||||
|
||||
# make the config dir if it doesn't exist
|
||||
(xdg_config_home() / 'knock').mkdir(parents=True, exist_ok=True)
|
||||
xdg_config_home().joinpath('knock').mkdir(parents=True, exist_ok=True)
|
||||
|
||||
file_type = file.suffix[1:].upper()
|
||||
path_type = path.suffix[1:].upper()
|
||||
|
||||
if file_type == 'ACSM':
|
||||
if path_type == 'ACSM':
|
||||
click.echo('Received an ACSM (Adobe) file...')
|
||||
handle_acsm(file)
|
||||
handle_acsm(path)
|
||||
elif path_type == 'AAX':
|
||||
click.echo('Received an AAX (Audible) file...')
|
||||
handle_aax(path)
|
||||
else:
|
||||
click.echo(f'Error: Files of type {file.suffix[1:].upper()} are not supported.\n', err=True)
|
||||
click.echo(f'Error: Files of type {path_type} are not supported.\n', err=True)
|
||||
click.echo('Only the following file types are currently supported:', err=True)
|
||||
click.echo(' * ACSM (Adobe)\n')
|
||||
click.echo(' * AAX (Audible)\n')
|
||||
click.echo('Please open a feature request at:', err=True)
|
||||
click.echo(f' https://github.com/BentonEdmondson/knock/issues/new?title=Support%20{file_type}%20Files&labels=enhancement', err=True)
|
||||
click.echo(f' https://github.com/BentonEdmondson/knock/issues/new?title=Support%20{path_type}%20Files&labels=enhancement', err=True)
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue