deemix-py/deemix/__main__.py

31 lines
853 B
Python
Raw Normal View History

2020-02-17 16:46:18 +01:00
#!/usr/bin/env python3
import click
2020-04-08 00:19:27 +02:00
import deemix.app.cli as app
from deemix.app.settings import initSettings
from os.path import isfile
@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')
@click.argument('url', nargs=-1, required=True)
2020-05-20 19:52:01 +02:00
def download(bitrate, local, url):
settings = initSettings(local)
app.login()
if isfile(url[0]):
filename = url[0]
with open(filename) as f:
url = f.readlines()
for u in url:
app.downloadLink(u, settings, bitrate)
click.echo("All done!")
2020-05-20 19:52:01 +02:00
if local:
2020-05-20 16:36:01 +02:00
click.echo(settings['downloadLocation']) #folder name output
2020-05-25 14:04:40 +02:00
def main():
download()
2020-02-17 16:46:18 +01:00
if __name__ == '__main__':
2020-05-25 14:04:40 +02:00
main()