Closed arcnmx closed 3 years ago
Hm, I'm thinking of a way to be able to distinguish between expired url vs other failures. Maybe we can make YtdlInputStream to get another url when the inner stream failed, if a certain amount of time has passed?
Including any sort of time-sensitive code seems like something to avoid, it will probably be messy. It looks like the expiry time is encoded into the URL (a quick test shows they're valid for 6 hours?), but we can't really count on that...
Maybe if we're lucky it errors out with a sensible status code like 408/410/??? that can be used to trigger a retry?
EDIT: youtube looks like 403 Forbidden once it expires... So if we can't consistently tell then we might have to set up some sort of error counter that's cleared any time a request succeeds / data is received... and retry at least once on failures?
Parsing URL/response probably won't work for every single extractors youtube-dl support so probably not the best idea.
I guess a retry counter is the best we can do.
I've made YtdlInputStream inhertit from ProxyInputStream in https://github.com/Rio6/MPD/tree/ytdl. I'll add the retry counter later.
Update: the code for retrying is pushed too
I paused a song for 11 hours and itstill plays as expected. Let's call this issue done.
BTW, it might be good to do another rebase, we're lots of commits behind again :)
Sorry I've been dead for ages, will try to get to that over the next few days. I've been using it all year and am pretty happy with how it's been working! I'll check if there's anything major to update to, and also put up a 0.22.7 branch too.
Occasionally a short while after resuming playback, mpd will suddenly skip to the next track. Presumably this happens because the input stream's URL has expired in the time since it was paused. The plugin should be able to detect and recover from these failures - but still be able to bail out on persistent failures of course. mpv seems to have similar logic built in?
Also, move to
ProxyInputStream
if possible.