From 34b93de62cce4840ab4e4b660ce48d879231275d Mon Sep 17 00:00:00 2001 From: RemixDev Date: Wed, 30 Dec 2020 15:21:33 +0100 Subject: [PATCH] Added general exception catch when tring to connect to deezer --- app.py | 10 +++++++--- webui | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app.py b/app.py index ed78341..1040964 100644 --- a/app.py +++ b/app.py @@ -96,7 +96,11 @@ class deemix: def checkDeezerAvailability(self): 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('')+7:body.find('')] self.isDeezerAvailable = title.strip() != "Deezer will soon be available in your country." print(f"deezer.com reached: {'Available' if self.isDeezerAvailable else 'Not Available'}") @@ -340,7 +344,7 @@ class deemix: if new_releases is None: return [] - + show_all = dz.gw.get_page(new_releases['target']) albums = [x['data'] for x in show_all['sections'][0]['items']] return albums @@ -369,7 +373,7 @@ class deemix: albums = [a for a in pool.imap(albumDetailsWorker, [x['ALB_ID'] for x in recent_releases])] return albums - + # Queue functions def addToQueue(self, dz, url, bitrate=None, interface=None, ack=None): if ';' in url: diff --git a/webui b/webui index 0806414..fd56454 160000 --- a/webui +++ b/webui @@ -1 +1 @@ -Subproject commit 08064146d5242dadcece4cd0fbb910e7f302bad0 +Subproject commit fd564547279dbcb8ff1eaf08afe728291e640b62