-
-
Notifications
You must be signed in to change notification settings - Fork 104
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
Added touch gesture to companion protocol #2402
Conversation
Hi, I have added the new interface and its implementation including the facadeAppleTV class and brought a fix to my code. atv = await pyatv.connect(config, loop)
feature = atv.features.get_feature(FeatureName.TouchGesture)
print("Feature : "+feature.state.name)
await atv.touchgestures.touch_gesture(900, 900, 10, 10, 1000) I have added an additional method in the new interface. This method above is kind of a helper function. But if one wants to simulate a customized gesture there is the touch_event also (I'm thinking of a slider in a UI that would generate events constantly based on slider position) |
Hi, amazing work you've done here! Have been waiting for this for so long. Do you think it would be possible to have this working for real time gestures, just like the way it works for the Siri Remote and in control center on iOS? I have no idea how such an interface would work or even look like though, but that would be very awesome. Everything looks exceptionally good by the way and I hope @postlund can take a look at this soon |
Hi, I had a great help from @postlund or else I couldn't find out how to reproduce the streams. As written above I implemented different methods :
I didn't implement tap/double tap although this is possible as I think that those commands are already available in the library |
Touchpad.tool.1.mp4I have made a tool to simulate the touchpad gestures and the right algorithm behind |
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.
A few comment but it looks very good, nice addition! 👍
A section in the |
One last thing that I forgot about... Some kind of basic tests for the added API methods are needed. Only a "good case" is needed, just to ensure we verify something. Should be fairly easy to add in https://github.com/postlund/pyatv/blob/master/tests/protocols/companion/test_companion_functional.py |
Yes I will add that |
I don't think this is possible : touch events are sent with no feedback by Appletv |
I have implanted fake "server sides" of each protocol. So you can just store the events and verify what you received. No interaction with an Apple TV is used (it's just unit tests). |
Ok got it, I am on it |
Hi, |
As an example : # Horizontal touch gesture from left to right in 200ms
atvremote.py --id <appletvid> touch=0,0,800,0,200
# Touch click
atvremote.py --id <appletvid> touch_click |
I'll try to look at it tonight, great work so far! Also remember that we should add some developer documentation as well at some point, in case someone wants to use it (a subpage here https://pyatv.dev/development/). |
Yes I a little new to python's coding (since this year), however I found your code very well organized apart all the offered features for all-in-one library. |
|
Hi, |
@albaintor I don't think you managed to push any changes? |
Are you sure ? I have pushed everything on my side |
@albaintor I just noted that there are no pushed changes after my last comment according to the PR. There are also still checks that are failing, you can check that below. |
Hi I think I know what is going on : something is wrong on the build action The black command fails with the new "match case" code in tests/fake_device/companion.py EDIT : |
Ah, I don't want to drop support for older Python versions just because of this. Just revert to an if-statement instead. You can use |
Hi, this is all done including linting |
As long as the linting fails, you must fix it. You can suppress too-many-branches and you probably have to move the existing suppression for logging.TRAFFIC. |
It should be okay this time |
All tests passed ! |
Yes! 🥳 |
Hi, I have added the implementation of touch gestures and updated the documentation.
I have tested it successfully.
To test it :