Open ritiek opened 7 years ago
I don't see why not. You should be able to download the track to your hard drive and then pipe it to your media player in loop mode. Mpsyt isn't really necessary, though, if you do it that way. You could just use youtube-dl directly (if you know the id).
That too but I was hoping if this could be done directly with mpsyt.
It's not currently possible. Probably the best way to address this would be better player integration, so mpv (or another player) is not re-spawned, but kept open and looping. In that case it would maintain whatever buffer it does for such cases; I'm not sure if it would be the whole video.
I just tested with mpv
, running it with --loop-file
preserves the buffer and also other options like playback speed and volume.
I was able to make some rough changes to player.py in 0cab3a4705a65ba1fd1b7126bb9e0fb04a548f8d and now options and song cache are preserved when using repeat mode in mpv
player.
These options, especially preserving the song cache are very helpful on my limited bandwith. :heart:
Let me know if this is seems okay with you, @ids1024, I'll study the code base a little more and make PR for this if you say so. :smile:
Does that break if you try to repeat a range of tracks instead of just one?
Yes, did not that test that but unfortunately it does. It just plays the first song in loop.
Setting --loop-file
only when len(songlist) == 1
should fix that (though it would only work when playing a single track, obviously).
Then it should be fine to merge as a temporary solution; a more robust solution that prevents mpv from stopping during a playlist and sending tracks to it while it plays etc. would help with this and other things. That's probably not entirely trivial to do though (although I haven't tried, so maybe not too bad).
I am not sure if this is possible but It would be nice if mps-youtube could save the video/track temporarily side-by-side when using repeat mode, so it could just read from the saved file every time track starts over again. The track otherwise has to be downloaded again every time it starts over.