mirror of
https://gitlab.com/RemixDev/deemix-gui-pyweb.git
synced 2025-01-14 10:35:15 +00:00
Fix new releases for some obscure channels
For example, Christian new release only has the items included in the main page, it doesn't include 'target' to link to more. Also add a general try/except so that an error on one channel doesn't kill the entire request.
This commit is contained in:
parent
885d3fb04e
commit
6ca647da33
12
app.py
12
app.py
|
@ -342,12 +342,18 @@ class deemix:
|
||||||
pattern = '^New.*releases$'
|
pattern = '^New.*releases$'
|
||||||
new_releases = next((x for x in channel_data['sections'] if re.match(pattern, x['title'])), None)
|
new_releases = next((x for x in channel_data['sections'] if re.match(pattern, x['title'])), None)
|
||||||
|
|
||||||
|
try:
|
||||||
if new_releases is None:
|
if new_releases is None:
|
||||||
return []
|
return []
|
||||||
|
elif 'target' in new_releases:
|
||||||
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']]
|
return [x['data'] for x in show_all['sections'][0]['items']]
|
||||||
return albums
|
elif 'items' in new_releases:
|
||||||
|
return [x['data'] for x in new_releases['items']]
|
||||||
|
else:
|
||||||
|
return []
|
||||||
|
except Exception:
|
||||||
|
return []
|
||||||
|
|
||||||
def newReleases(self, dz):
|
def newReleases(self, dz):
|
||||||
explore = dz.gw.get_page('channels/explore')
|
explore = dz.gw.get_page('channels/explore')
|
||||||
|
|
Loading…
Reference in a new issue