2020-02-17 16:46:18 +01:00
|
|
|
#!/usr/bin/env python3
|
2020-02-23 22:51:16 +01:00
|
|
|
import click
|
2020-04-17 12:31:47 +02:00
|
|
|
|
2020-08-15 23:03:05 +02:00
|
|
|
from deemix.app.cli import cli
|
2020-05-15 17:46:50 +02:00
|
|
|
from os.path import isfile
|
2020-04-17 12:31:47 +02:00
|
|
|
|
2020-02-23 22:51:16 +01:00
|
|
|
@click.command()
|
|
|
|
@click.option('-b', '--bitrate', default=None, help='Overwrites the default bitrate selected')
|
2020-05-20 17:02:24 +02:00
|
|
|
@click.option('-l', '--local', is_flag=True, help='Downloads in a local folder insted of using the default')
|
2020-05-15 00:06:40 +02:00
|
|
|
@click.argument('url', nargs=-1, required=True)
|
2020-05-20 19:52:01 +02:00
|
|
|
def download(bitrate, local, url):
|
2020-08-15 23:03:05 +02:00
|
|
|
app = cli(local)
|
2020-04-17 12:31:47 +02:00
|
|
|
app.login()
|
2020-06-19 20:14:20 +02:00
|
|
|
url = list(url)
|
2020-05-15 17:46:50 +02:00
|
|
|
if isfile(url[0]):
|
|
|
|
filename = url[0]
|
|
|
|
with open(filename) as f:
|
|
|
|
url = f.readlines()
|
2020-08-15 23:03:05 +02:00
|
|
|
app.downloadLink(url, bitrate)
|
2020-04-17 12:31:47 +02:00
|
|
|
click.echo("All done!")
|
2020-05-20 19:52:01 +02:00
|
|
|
if local:
|
2020-08-15 23:03:05 +02:00
|
|
|
click.echo(app.set.settings['downloadLocation']) #folder name output
|
2020-04-17 12:31:47 +02:00
|
|
|
|
2020-02-17 16:46:18 +01:00
|
|
|
if __name__ == '__main__':
|
2020-08-14 20:31:37 +02:00
|
|
|
download()
|