Hi, I’m a Python Newbie and I wrote some code to collect info about the song that is being played on Mopidy.
The problem is that I need to know when the song starts. Can anyone show me an example of mopidy.core.CoreListener?
I need something like this:
On track_playback_started(tl_track)
info() # where info() is my function
Thank you Jodal. I’m not sure if I understood the code. But mostly it fetchs informations about the song if I’m not wrong. But I don’t see where the code “knows” that the track is changed. That’s the only thing I need. Something that tells me “Hey, I started playing a new track, you can now run your code”.
That code knows that the track is changed because that method is only called by Mopidy when a track starts playback. For that call from Mopidy to your extension to happen, you must:
make a frontend extension,
with an actor class, and
that actor class must subclass mopidy.core.CoreListener.