From 36316e69e576ca5851bef564ebaa6f0d0cc585f9 Mon Sep 17 00:00:00 2001 From: RemixDev Date: Fri, 15 May 2020 17:46:50 +0200 Subject: [PATCH] Added file option instead of an URL in the CLI Depending what you give it it will download accordingly --- deemix/__main__.py | 5 +++++ deemix/app/cli.py | 1 + 2 files changed, 6 insertions(+) diff --git a/deemix/__main__.py b/deemix/__main__.py index d49e706..3eff695 100644 --- a/deemix/__main__.py +++ b/deemix/__main__.py @@ -3,6 +3,7 @@ import click import deemix.app.cli as app from deemix.app.settings import initSettings +from os.path import isfile @click.command() @@ -11,6 +12,10 @@ from deemix.app.settings import initSettings def download(bitrate, url): settings = initSettings() 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!") diff --git a/deemix/app/cli.py b/deemix/app/cli.py index fdf34b5..a094ac2 100644 --- a/deemix/app/cli.py +++ b/deemix/app/cli.py @@ -35,4 +35,5 @@ def login(): def downloadLink(url, settings, bitrate=None): + url = url.strip() addToQueue(dz, sp, url, settings, bitrate)