Added interface feedback when processing multiple links

This commit is contained in:
RemixDev 2020-10-14 23:22:21 +02:00
parent 2fdce7d137
commit a7bba342d3

View file

@ -8,6 +8,7 @@ from pathlib import Path
import json import json
from os import remove from os import remove
import eventlet import eventlet
import uuid
urlopen = eventlet.import_patched('urllib.request').urlopen urlopen = eventlet.import_patched('urllib.request').urlopen
logging.basicConfig(level=logging.INFO) logging.basicConfig(level=logging.INFO)
@ -369,6 +370,8 @@ class QueueManager:
if type(url) is list: if type(url) is list:
queueItem = [] queueItem = []
request_uuid = str(uuid.uuid4())
if interface: interface.send("startGeneratingItems", {'uuid': request_uuid, 'total': len(url)})
for link in url: for link in url:
item = parseLink(link) item = parseLink(link)
if not item: continue if not item: continue
@ -376,6 +379,7 @@ class QueueManager:
queueItem += item queueItem += item
else: else:
queueItem.append(item) queueItem.append(item)
if interface: interface.send("finishGeneratingItems", {'uuid': request_uuid, 'total': len(queueItem)})
if not len(queueItem): if not len(queueItem):
return False return False
else: else: