mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2025-05-07 20:38:41 +00:00
Fix radio generator too many requests; logging some parts
This commit is contained in:
parent
ae1cba2e98
commit
74f9a732ef
3 changed files with 11 additions and 3 deletions
|
@ -64,6 +64,10 @@ def post_radio_session(requested_radio):
|
|||
|
||||
def get_track_radio(radio_session):
|
||||
r = s.post(f'https://{instance}/api/v1/radios/tracks/',json=radio_session)
|
||||
return r.json()
|
||||
try:
|
||||
r.raise_for_status()
|
||||
return r.json()
|
||||
except:
|
||||
logger.exception('Radio: get next track failed')
|
||||
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ def radio_generator(radio_session_id):
|
|||
break
|
||||
count_t += 1
|
||||
if count_t >= 60:
|
||||
count_t = 0
|
||||
radio_get_track(radio_session_id)
|
||||
logger.info('Radio generator stopped')
|
||||
|
||||
|
@ -100,7 +101,8 @@ def radio_load(id_radio=None, type_radio='custom'):
|
|||
|
||||
def radio_get_track(radio_session_id):
|
||||
radio_context = get_track_radio({'session': radio_session_id})
|
||||
|
||||
if not radio_context:
|
||||
return
|
||||
if radio_context == "Radio doesn't have more candidates":
|
||||
return
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue