Open medains opened 2 years ago
I never forgot this idea but I'm missing the GUI to do so. @pathofleastresistor would you be interested in something like this? I could add service calls to add a track to the in-memory playlist but only if you would add the GUI. What do you think?
I'm open to it. Would be good to understand your design for how this works.
Im assuming that any "track" can be added to the current playlist. And then your service will do the magic.
I guess we need:
and optional:
is there a better word for "current_playlist" that makes clear that we're not modifying the playlist at youtube but only the one in the player?
So I've implemeted this one. It moves the track nr 6 to the second entry. It works fine, but I have to refresh the page after the call to see the new order, or click, next_track etc .. no surprise just wanted to mention it ..
service: ytube_music_player.call_method
data:
entity_id: media_player.ytube_music_player
command: move_track_within_queue
parameters: [5,1]
special: parameters: [5,-1] removes track 6 from the list .. all other negative numbers will produce an error, numbers > playlist length will naturally be limited to the end of the list
I've also added:
service: ytube_music_player.call_method
data:
entity_id: media_player.ytube_music_player
command: append_track_to_queue
parameters: ["BciS5krYL80",1]
adds Hotel California to position 2 in the List ..
See https://github.com/KoljaWindeler/ytube_music_player/commit/e8d93fe966bdfe25414c6373bfaceef208286a02
Great! Can you consider firing events that the frontend can subscribe to? This way I can know to fetch the playlist update. I think I can I just do an await if you can't.
Also - I think YouTube refers to it as "Up Next" or sometimes they call it a "queue".
I like queue .. I'll rename them tomorrow Regarding events: never done it but will check
it look like i'm firing events now https://github.com/KoljaWindeler/ytube_music_player/commit/7a0d0afdc16f9b341874ad6c8555f6011ad99569
Describe the solution you'd like When the player is playing a playlist, it sends individual "play this track" instructions to the media player. I would like to be able to add/remove entries from the current in-memory playlist without changing a playlist in my YTmusic account. This would allow a "jukebox-like" mode, where I can set up an interface to add songs to the current playlist without making permanent changes. This could be implemented fairly easily by adding to the in-memory playlist even when the player is in "track" mode, or adding a whole new playback mode to cover it. The two existing playlist manipulation services could manage any changes needed, so it wouldn't need a new service.
Describe alternatives you've considered This can be achieved by setting up a playlist that is constantly having songs added to and removed, but that's not so easy to set up - and if there's a problem with the removal then you're stuck.