mirror of
https://gitlab.com/RemixDev/deemix-gui-pyweb.git
synced 2024-12-26 17:36:08 +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
16
app.py
16
app.py
|
@ -342,13 +342,19 @@ class deemix:
|
|||
pattern = '^New.*releases$'
|
||||
new_releases = next((x for x in channel_data['sections'] if re.match(pattern, x['title'])), None)
|
||||
|
||||
if new_releases is None:
|
||||
try:
|
||||
if new_releases is None:
|
||||
return []
|
||||
elif 'target' in new_releases:
|
||||
show_all = dz.gw.get_page(new_releases['target'])
|
||||
return [x['data'] for x in show_all['sections'][0]['items']]
|
||||
elif 'items' in new_releases:
|
||||
return [x['data'] for x in new_releases['items']]
|
||||
else:
|
||||
return []
|
||||
except Exception:
|
||||
return []
|
||||
|
||||
show_all = dz.gw.get_page(new_releases['target'])
|
||||
albums = [x['data'] for x in show_all['sections'][0]['items']]
|
||||
return albums
|
||||
|
||||
def newReleases(self, dz):
|
||||
explore = dz.gw.get_page('channels/explore')
|
||||
music_section = next((x for x in explore['sections'] if x['title'] == 'Music'), None)
|
||||
|
|
Loading…
Reference in a new issue