Added scrollbar to download list
This commit is contained in:
parent
83a221c4b7
commit
ba6078e34d
|
@ -7,9 +7,10 @@ from deemix.utils.spotifyHelper import get_trackid_spotify, get_albumid_spotify
|
|||
import os.path
|
||||
from os import makedirs, remove
|
||||
from requests import get
|
||||
from requests.exceptions import HTTPError
|
||||
from requests.exceptions import HTTPError, ConnectionError
|
||||
from tempfile import gettempdir
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from time import sleep
|
||||
import re
|
||||
|
||||
TEMPDIR = os.path.join(gettempdir(), 'deezloader-imgs')
|
||||
|
@ -30,8 +31,11 @@ def downloadImage(url, path):
|
|||
if not os.path.isfile(path):
|
||||
with open(path, 'wb') as f:
|
||||
try:
|
||||
f.write(get(url, headers={'User-Agent': USER_AGENT_HEADER}).content)
|
||||
f.write(get(url, headers={'User-Agent': USER_AGENT_HEADER}, timeout=30).content)
|
||||
return path
|
||||
except ConnectionError:
|
||||
sleep(2)
|
||||
return downloadImage(url, path)
|
||||
except HTTPError:
|
||||
print("Couldn't download Image")
|
||||
remove(path)
|
||||
|
|
|
@ -145,22 +145,31 @@ def generateQueueItem(dz, url, settings, bitrate=None, albumAPI=None):
|
|||
def addToQueue(dz, url, settings, bitrate=None, socket=None):
|
||||
global currentItem, currentJob, queueList, queue
|
||||
queueItem = generateQueueItem(dz, url, settings, bitrate)
|
||||
if 'error' in queueItem:
|
||||
if socket:
|
||||
socket.emit("message", queueItem['error'])
|
||||
return None
|
||||
if queueItem['uuid'] in list(queueList.keys()):
|
||||
print("Already in queue!")
|
||||
if socket:
|
||||
socket.emit("message", "Already in queue!")
|
||||
return None
|
||||
if type(queueItem) is list:
|
||||
for x in queueItem:
|
||||
if 'error' in x:
|
||||
if socket:
|
||||
socket.emit("message", x['error'])
|
||||
return None
|
||||
if x['uuid'] in list(queueList.keys()):
|
||||
print("Already in queue!")
|
||||
if socket:
|
||||
socket.emit("message", "Already in queue!")
|
||||
return None
|
||||
if socket:
|
||||
socket.emit("addedToQueue", x)
|
||||
queue.append(x['uuid'])
|
||||
queueList[x['uuid']] = x
|
||||
else:
|
||||
if 'error' in queueItem:
|
||||
if socket:
|
||||
socket.emit("message", queueItem['error'])
|
||||
return None
|
||||
if queueItem['uuid'] in list(queueList.keys()):
|
||||
print("Already in queue!")
|
||||
if socket:
|
||||
socket.emit("message", "Already in queue!")
|
||||
return None
|
||||
if socket:
|
||||
socket.emit("addedToQueue", queueItem)
|
||||
queue.append(queueItem['uuid'])
|
||||
|
|
Loading…
Reference in New Issue