Divide and manage multiple download links directly in the library

This commit is contained in:
RemixDev 2020-06-19 11:08:07 +02:00
parent c8875483bc
commit dd45835039
2 changed files with 14 additions and 4 deletions

View File

@ -251,6 +251,16 @@ def addToQueue(dz, sp, url, settings, bitrate=None, interface=None):
global currentItem, queueList, queue global currentItem, queueList, queue
if not dz.logged_in: if not dz.logged_in:
return "Not logged in" return "Not logged in"
if type(url) is list:
queueItem = []
for link in url:
logger.info("Generating queue item for: "+link)
item = generateQueueItem(dz, sp, link, settings, bitrate, interface=interface)
if type(item) is list:
queueItem += item
else:
queueItem.append(item)
else:
logger.info("Generating queue item for: "+url) logger.info("Generating queue item for: "+url)
queueItem = generateQueueItem(dz, sp, url, settings, bitrate, interface=interface) queueItem = generateQueueItem(dz, sp, url, settings, bitrate, interface=interface)
if type(queueItem) is list: if type(queueItem) is list:
@ -263,9 +273,9 @@ def addToQueue(dz, sp, url, settings, bitrate=None, interface=None):
continue continue
if interface: if interface:
interface.send("addedToQueue", slimQueueItem(x)) interface.send("addedToQueue", slimQueueItem(x))
logger.info(f"[{x['uuid']}] Added to queue.")
queue.append(x['uuid']) queue.append(x['uuid'])
queueList[x['uuid']] = x queueList[x['uuid']] = x
logger.info(f"[{x['uuid']}] Added to queue.")
else: else:
if 'error' in queueItem: if 'error' in queueItem:
logger.error(f"[{url}] {queueItem['error']}") logger.error(f"[{url}] {queueItem['error']}")

View File

@ -7,7 +7,7 @@ README = (HERE / "README.md").read_text()
setup( setup(
name="deemix", name="deemix",
version="1.0.22", version="1.0.23",
description="A barebone deezer downloader library", description="A barebone deezer downloader library",
long_description=README, long_description=README,
long_description_content_type="text/markdown", long_description_content_type="text/markdown",