-
Notifications
You must be signed in to change notification settings - Fork 8
Multiple instances branch #35
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
Conversation
|
Otherwise @zehnm I checked after your branch on additional commands, there is something missing : the context menu feature is not in the list, so the command won't be available (and it simulates the long press ENTER so it is very useful) Also there is another PR with the addition of Kodi that is working on my side : to be added in apps.py line 24 Thank you for the hard work |
# Conflicts: # intg-androidtv/setup_flow.py # intg-androidtv/tv.py
|
I will check this after PR #34 is merged |
# Conflicts: # intg-androidtv/apps.py # intg-androidtv/driver.py # intg-androidtv/setup_flow.py # intg-androidtv/tv.py
zehnm
left a comment
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.
To start a code review please sync with main branch to resolve merge conflicts (from recently merged PR 34) and fix the linting issues first.
Done |
|
Please note : as I changed the name of certificate file names to handle multiple instances, in driver.py when it starts, first I check after all the certificate files if they exist, otherwise I rename them (done once). |
zehnm
left a comment
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.
This is just an initial code review, I'll check the functionality and certificate handling tomorrow.
Please also check and fix the linting issues. See https://github.com/unfoldedcircle/integration-androidtv/blob/main/docs/code_guidelines.md#tooling on how to check locally.
albaintor
left a comment
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.
Done
zehnm
left a comment
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 setup flow is currently broken due to invalid certificate path and a wrong comparison of already configured devices (see source comments). Please fix this, then I can merge it.
I'd like to simplify the certificate handling and centralize the filename & rename logic, but I can refactor this myself after this PR is merged. For now it's more important that the multi-device handling is working :-)
Currently the logic is spread out in tv.AndroidTv, setup_flow.handle_user_data_pin and driver.main For example using config.Devices.migrate for migrating old certificates, instead of doing it in main(), and simply passing the certfile & keyfile to use to AndroidTV. I'll investigate it further.
I am on it... |
I don't understand this comment : for device in config.devices.all():
# Migration of certificate/key files with identifier in name
_android_tv = tv.AndroidTv(api.config_dir_path, device.address, device.name, device.id)
if not os.path.exists(_android_tv.certfile):
current_certfile = os.path.join(api.config_dir_path, "androidtv_remote_cert.pem")
current_keyfile = os.path.join(api.config_dir_path, "androidtv_remote_key.pem")
try:
_LOG.info("Rename certificate file %s to %s", current_certfile, _android_tv.certfile)
os.rename(current_certfile, _android_tv.certfile)
_LOG.info("Rename key file %s to %s", current_keyfile, _android_tv.keyfile)
os.rename(current_keyfile, _android_tv.keyfile)
except OSError as ex:
_LOG.error("Error while migrating certificate files: %s", ex)
_add_configured_android_tv(device, connect=False)EDIT : ok you were mentioning the other bugs you listed above and that I just fixed. This is okay (for now) ? |
Don't worry, leave it as is and I can refactor it later so that all certificate file handling logic including migration is done in one place. I'll check your fixes now. |
zehnm
left a comment
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.
Almost there! One linting issue and workaround to restore in the setup flow.
Then it's ready to merge.
|
Ok committed ! |
zehnm
left a comment
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.
Looking good, thanks for your contribution!
I'll probably refactor the certificate handling or storage location of the certificate files before the next release.
|
This will require more fixes, the certificate file migration doesn't work from the last release version running on the remote. I'll create a new issue and fix it. |
|
This is strange it worked in the simulator but with an external driver |
Hi Markus,
I have developed the multiple instances based on previous work but this time in a dedicated branch (without the additional commands) -> the tricky thing for Android is the certificate & key files to be splitted.
As we don't know the mac address (which is the ID of the device) while connecting, the pair of files will be generated without the id in the name, and after pairing I renamed them with the macaddress inside the name.
This works on my side, but maybe a better/prettier solution could be found
Closes #14