mirror of
https://gitlab.com/RemixDev/deemix-gui-pyweb.git
synced 2024-12-28 02:16:16 +00:00
Added general exception catch when tring to connect to deezer
This commit is contained in:
parent
1e9e28ec2c
commit
34b93de62c
10
app.py
10
app.py
|
@ -96,7 +96,11 @@ class deemix:
|
||||||
|
|
||||||
def checkDeezerAvailability(self):
|
def checkDeezerAvailability(self):
|
||||||
print("Pinging deezer.com...")
|
print("Pinging deezer.com...")
|
||||||
body = requests.get("https://www.deezer.com/", headers={'Cookie': 'dz_lang=en; Domain=deezer.com; Path=/; Secure; hostOnly=false;'}).text
|
try:
|
||||||
|
body = requests.get("https://www.deezer.com/", headers={'Cookie': 'dz_lang=en; Domain=deezer.com; Path=/; Secure; hostOnly=false;'}).text
|
||||||
|
except Exception as e:
|
||||||
|
self.isDeezerAvailable = False
|
||||||
|
print(f"deezer.com not reached! {str(e)}")
|
||||||
title = body[body.find('<title>')+7:body.find('</title>')]
|
title = body[body.find('<title>')+7:body.find('</title>')]
|
||||||
self.isDeezerAvailable = title.strip() != "Deezer will soon be available in your country."
|
self.isDeezerAvailable = title.strip() != "Deezer will soon be available in your country."
|
||||||
print(f"deezer.com reached: {'Available' if self.isDeezerAvailable else 'Not Available'}")
|
print(f"deezer.com reached: {'Available' if self.isDeezerAvailable else 'Not Available'}")
|
||||||
|
@ -340,7 +344,7 @@ class deemix:
|
||||||
|
|
||||||
if new_releases is None:
|
if new_releases is None:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
show_all = dz.gw.get_page(new_releases['target'])
|
show_all = dz.gw.get_page(new_releases['target'])
|
||||||
albums = [x['data'] for x in show_all['sections'][0]['items']]
|
albums = [x['data'] for x in show_all['sections'][0]['items']]
|
||||||
return albums
|
return albums
|
||||||
|
@ -369,7 +373,7 @@ class deemix:
|
||||||
albums = [a for a in pool.imap(albumDetailsWorker, [x['ALB_ID'] for x in recent_releases])]
|
albums = [a for a in pool.imap(albumDetailsWorker, [x['ALB_ID'] for x in recent_releases])]
|
||||||
|
|
||||||
return albums
|
return albums
|
||||||
|
|
||||||
# Queue functions
|
# Queue functions
|
||||||
def addToQueue(self, dz, url, bitrate=None, interface=None, ack=None):
|
def addToQueue(self, dz, url, bitrate=None, interface=None, ack=None):
|
||||||
if ';' in url:
|
if ';' in url:
|
||||||
|
|
2
webui
2
webui
|
@ -1 +1 @@
|
||||||
Subproject commit 08064146d5242dadcece4cd0fbb910e7f302bad0
|
Subproject commit fd564547279dbcb8ff1eaf08afe728291e640b62
|
Loading…
Reference in a new issue