beedaddy/radiorec

Question about auto-reconnect

fa7ecc1f76 opened this issue · 11 comments

Hi there,

did you do anything in regards to re-connection handling? I couldn't really find anything in the code.
I'm not sure if urllib.request does something in these regards. So if the stream disconnects for whatever reason, the recording should not stop before the recording duration set.

Best regards,
J

You're right, there's no reconnection handling in the code. I don't know if/when I have some time to check what could be done here...

No worries, I just wanted to know. Still great to have. Maybe I find some time myself. Having a wrapper around mplayer currently, opening it via pty and checking if died before the recording is complete.

I think using the urllib3 would be a good idea, urllib3 can automatically retry idempotent requests.
did a bit of searching and found this: https://dev.to/zenulabidin/python-http-at-lightspeed-part-2-urllib3-and-requests-476

Do you fixed the Problem @fa7ecc1f76 ?
i have the same problem, but unfortunately I don't know how to fix it exactly.

Hi @lastsamurai26 -

yes, but I didn't commit the changes here, kept it as a local private branch. Until I have time to raise a pull request here, I can send the changes I've made to you. I will get in touch this weekend latest.

that would be excellent :-)

This is it, you need to rename it to .py again of course. I recommend a diff with the current version and you'll see what I did.

radiorec.py.txt

yes, I will do a diff patch. Thanks for the help :)

@lastsamurai26 feel free to use the code and contribute it to this project or anywhere else. I don't really have time currently.

:-) i've pulled your changes :)

Cool. Feel free to take over from here.