Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include auto play #329

Open
Mabenan opened this issue Feb 18, 2022 · 2 comments
Open

Include auto play #329

Mabenan opened this issue Feb 18, 2022 · 2 comments

Comments

@Mabenan
Copy link

Mabenan commented Feb 18, 2022

I known that this is a a complex one as it isnt solved with a simple api call neither by spotify nor by mopidy. But i would really like to have it. So this is will be more of a discussion thread how it should behave and how we can integrate it.

The talk is about the spotify (or any other big music streaming service) auto play. Which is basicaly a never ending queue of tracks based on the tracks already listen to in the session.

Spotify has a recommandation api which we can maybe use to find next tracks

@djmattyg007
Copy link
Contributor

The way you would need to implement this is by having something that, when turned on, automatically fetched X number of tracks from somewhere (eg. a recommendation API) on a timer. Implementing this from within Mopidy is complicated for (at least) a couple of reasons.

First, there's no real kind of scheduled events system. I've dreamt for a long time of integrating APScheduler, ideally backed by some kind of database for persistence. This would also allow things like alarm clocks to be implemented.

Second, Mopidy's architecture makes it very difficult for extensions to talk to each other. Yes, there's a Spotify backend with a library provider, and it exists at runtime. Unfortunately there's no proper way to access it, so that I can avoid duplicating a bunch of code in another extension to power this functionality. Essentially, there's no service layer. There's just frontends and backends, with no capability for shared functionality at runtime that operates within the actor framework.

If you're interested, I've written a bit more on this subject in an issue in the main Mopidy repo:

mopidy/mopidy#1992

Ultimately, you may find that implementing something like this will be significantly easier to do outside of Mopidy. You could write a script that queries the Spotify API yourself, retrieves a list of URIs, and pass them to Mopidy using its own API.

@Mabenan
Copy link
Author

Mabenan commented Feb 19, 2022

I dont think we need a timer for this. I think it would be enough to determine the next tracks when the tracklist has come to the last or the last 2 tracks.

So the sxample of behaviour would be:

User adds tracks to a tracklist lets say 5 tracks.
The music is playing and when the playing reach the last track. The new feauture will automatically add 5 or so tracks to the tracklist.

Im not familiar with the life cycles in mopidy but when it is possible to listen on the track changes of the playback we could implement something that checks on each track change if we reached the end of the tracklist and add the next track.

Of course this feature would come with limitations:
The random funktion would not work as it means the tracklist would falsly reach the end of the tracklist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants