-
Notifications
You must be signed in to change notification settings - Fork 381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for DRTV app as a custom controller #646
base: master
Are you sure you want to change the base?
Conversation
pychromecast/controllers/drtv.py
Outdated
print(msg) | ||
self.send_message(msg, inc_session_id=True, callback_function=callback_function) | ||
|
||
def _get_drtokens(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guidance on whether this approach to retrieving tokens is acceptable is welcome :-)
It should work with Selenium as an optional dependency in this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this is not OK.
Make the token a mandatory input parameter to quick_play instead if it's needed for all media.
What's the lifetime of the tokens?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tokens are mandatory for all media. The stated lifetime of the tokens is 12 hours; there seems to be some grace period, but I have been unable to ascertain how much.
I'm mostly worried about the user experience, if having to provide a hardcoded token that then regularly expires. Of course we could leave it up to the consumer of this API, i.e. somewhere inside Home Assistant, to do the token maintenance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe code for getting the token etc. would fit in well in https://github.com/Eerovil/castextensions, @Eerovil wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the meantime I have pushed a commit to make the tokens a mandatory parameter in the controller, but left the Selenium way in the example code.
I also dug a bit deeper in the JWTs, and found a parameter in there indicating the tokens are valid for 1 month.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe code for getting the token etc. would fit in well in https://github.com/Eerovil/castextensions, @Eerovil wdyt?
Castextensions isn't maintained and most of the functionality for half the apps is mostly broken... But yes, this would fit nicely.
Notably, the app requires two JWTs ("session tokens") to allow playback. These can either be retrieved from a browser and given (expiry seem to not be critical), or alternatively retrieval of an anonymous token using Selenium will be attempted.
That's fine. |
Should be pretty trivial, just needs the Python module |
Notably, the app requires two JWTs ("session tokens") to allow playback. These
can either be retrieved from a browser and given (expiry seem to not be
critical), or alternatively retrieval of an anonymous token using Selenium will
be attempted.