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