speculatrix / tvh_epg

A very simple web based EPG for TVHeadend
GNU General Public License v3.0
27 stars 1 forks source link

Latest version of pychromecast +7.x.x, needs a change to tvh_epg #10

Closed dgilbert2 closed 3 years ago

dgilbert2 commented 3 years ago

I have found that updating to the latest version of pychromecast +7.x.x, prevents thv_epg from finding Chromecast devices. To fix this the code change below is needed in tvh_epg;

FROM- chromecasts = pychromecast.get_chromecasts() TO- chromecasts, browser = pychromecast.get_chromecasts()

Also, the code below is suggested to permit working with older pychromecast versions;

if isinstance(chromecasts , tuple) chromecasts, browser = chromecasts browser.close()

speculatrix commented 3 years ago

thanks for the correction, I will get on to this when I can, possible this evening (I'm on GMT).

dgilbert2 commented 3 years ago

Thanks for the update today Paul.

I found though that the latest version was causing python errors for me. I therefore had to make these changes to lines 546-552;

chromecasts = pychromecast.get_chromecasts()   #was chromecasts, browser = pychromecast.get_chromecasts()
if isinstance(chromecasts, tuple):
    chromecasts, browser = chromecasts
#browser.close()

#browser.close()

I'm not sure what emontnemery meant by the browser.close() lines but they are producing errors for me so I # out. Does not seem detrimental?

I've tested this now with old and new pychromecast versions and everything works :-)

dgilbert2 commented 3 years ago

Hi, reminder that the code below still needs to be updated in the master tvh_epg.py file;

chromecasts = pychromecast.get_chromecasts()   #was chromecasts, browser = pychromecast.get_chromecasts()
if isinstance(chromecasts, tuple):
    chromecasts, browser = chromecasts
#browser.close()

#browser.close()
speculatrix commented 3 years ago

Hi, I have applied the patch, I'll test it myself.

speculatrix commented 3 years ago

I can't make it work, I've tried various examples from https://github.com/home-assistant-libs/pychromecast/tree/master/examples

dgilbert2 commented 3 years ago

Try changing line 595 to;

chromecasts = pychromecast.get_chromecasts()

This should now work with old or new versions of pychromecast when I test on my system.

speculatrix commented 3 years ago

I redid it after finding a better example

speculatrix commented 3 years ago

p.s. you need to go into settings and ensure that the profiles for stream and chromecasting are set

dgilbert2 commented 3 years ago

Unfortunately I'm now finding that the latest version produces errors as attached html file, when trying to Chromecast.

To help, I've also attached the latest version of tvh_epg.py that I have which works on my side, and is also OK with old or new versions of Pychromecast.

tvh_epg files.zip

dgilbert2 commented 3 years ago

Sorry, couple more suggestions, I propose that the 'profile for streaming' in initial setting is set to "default" rather than blank, to avoid errors in VLC.

Also, I would have tripped up if I was new to all this with the Authentication setting being set to digest by default. Not sure how to get around this though or indeed why some setups need digest?

speculatrix commented 3 years ago

I made it suggest "default" as the streaming default, and "plain" as the default authentication.

I need to think about a better config editor, this is only just about better than editing the config file directly ;-)

speculatrix commented 3 years ago

I am using the latest pychromecast which I installed using pip.

root@mcintyre:~# pip3 list | grep -i pychr PyChromecast 8.0.0

I compared my latest ver with your and implemented the tuple check. There's definitely some significant changes to the API for pychromecast which are causing a headache!! Hopefully this version will work for you.

dgilbert2 commented 3 years ago

Hi

I've just tried the latest tvh_epg version and it works now on my setup, using pychromecast 8.0.0, without any changes, :-)

I did try the older pychromecast but that still produces the error as attached, whereas the version I posted works OK. However, does this matter? Providing you know the new requirement to upgrade pychromecast when you upgrade tvh_epg, happy days.

Thanks for all your work on tvh_epg, it is appreciated tmpkn31wyp7.zip .

speculatrix commented 3 years ago

I'm completely fine about not trying too hard to be backwards compatible, because it will be a losing battle.

speculatrix commented 3 years ago

I'll close this issue. Thanks for all your help.