Skip to content

Instantly share code, notes, and snippets.

@djmattyg007
Created July 19, 2020 04:19
Show Gist options
  • Save djmattyg007/39709d1c05a750f5167a19b8889dcc55 to your computer and use it in GitHub Desktop.
Save djmattyg007/39709d1c05a750f5167a19b8889dcc55 to your computer and use it in GitHub Desktop.
diff --git a/mopidy_iris/core.py b/mopidy_iris/core.py
index 720318f6..f376c93a 100755
--- a/mopidy_iris/core.py
+++ b/mopidy_iris/core.py
@@ -713,7 +713,7 @@ class IrisCore(pykka.ThreadingActor):
logger.debug(error)
return False
- def check_for_radio_update(self):
+ async def check_for_radio_update(self):
tracklistLength = self.core.tracklist.get_length().get()
if tracklistLength < 3 and self.radio["enabled"] == 1:
@@ -723,7 +723,7 @@ class IrisCore(pykka.ThreadingActor):
# We've run out of pre-fetched tracks, so we need to get more
# recommendations
if len(uris) < 3:
- uris = self.load_more_tracks()
+ uris = await self.load_more_tracks()
# Remove the next batch, and update our results
self.radio["results"] = uris[3:]
diff --git a/mopidy_iris/frontend.py b/mopidy_iris/frontend.py
index 87d4a585..d3e7539a 100755
--- a/mopidy_iris/frontend.py
+++ b/mopidy_iris/frontend.py
@@ -23,7 +23,9 @@ class IrisFrontend(pykka.ThreadingActor, CoreListener):
iris.stop()
def track_playback_ended(self, tl_track, time_position):
- iris.ioloop.add_callback(functools.partial(iris.check_for_radio_update))
+ if iris.ioloop:
+ iris.ioloop.add_callback(functools.partial(iris.check_for_radio_update))
def tracklist_changed(self):
- iris.ioloop.add_callback(functools.partial(iris.clean_queue_metadata))
+ if iris.ioloop:
+ iris.ioloop.add_callback(functools.partial(iris.clean_queue_metadata))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment