Is it possible to send a press and hold button press for the left and right buttons?
For example, Philo requires you to press and hold the right side of the touchpad to skip to live TV and I believe I've seen other press and hold commands (i.e. select button, left/right, etc)
It's not possible yet, but planned sometime in the near future, see #472. Currently I don't have as much time as I used to, so development pace will be a bit lower (also as I'm focusing on another feature currently).
I will aim to add support for this in 0.7.0, so it will be a priority in near time. Cannot give any details when in comes to "when", it be at some point when I have time. But just to let you know.
Fantastic! I'll look forward to it. Thanks again!
This will now be supported in #688. You can test like this:
$ atvremote ... left=X
Where X=0 for single tap, X=1 for double tap and X=2 for holding. It is supported for arrow keys, select, menu and home. It would be great if you could try this out before I merge it!
@sofakng Do you by any chance have some time to test the change I made? Would be great to have it merged if it works.
Sure thing, I'll give it a test today and report back. Thanks so much for making the change!
@sofakng Did you manage to try this out? Want to merge it so badly 馃槈
Hey, I'm really sorry this got lost in my list!
How can I test the changes?
I've been trying to re-compile/use the sources from Git but I can't seem to make them work.
What's the easiest way for me to pull the changes and run it?
No worries: life 馃槉 You should be able to follow the latter part from:
https://pyatv.dev/documentation/#specific-branch-or-a-pull-request
With <id> set to 688.
I'm having issues with pyatv finding my AppleTV now... (re: multicast issues on my network?)
However, I was able to send one command:
atvremote --id <REDACTED> --mrp-credentials "<REDACTED>" select=2
...and it gave me an error:
Traceback (most recent call last):
File "c:\program files\python38\lib\site-packages\pyatv\scripts\atvremote.py", line 641, in _run_application
return await cli_handler(loop)
File "c:\program files\python38\lib\site-packages\pyatv\scripts\atvremote.py", line 455, in cli_handler
return await _handle_commands(args, config, loop)
File "c:\program files\python38\lib\site-packages\pyatv\scripts\atvremote.py", line 551, in _handle_commands
ret = await _handle_device_command(args, cmd, atv, loop)
File "c:\program files\python38\lib\site-packages\pyatv\scripts\atvremote.py", line 578, in _handle_device_command
return await _exec_command(atv.remote_control, cmd, True, *cmd_args)
File "c:\program files\python38\lib\site-packages\pyatv\scripts\atvremote.py", line 607, in _exec_command
value = await tmp(*args)
TypeError: select() takes 1 positional argument but 2 were given
I'm trying to cleanup any previous versions of pyatv to make sure it's running the 688 build.
I have re-written the scanning code from scratch more or less, so it can be a product of that. Does it work ok when running the latest released version? Also, could you attach some debug logs when scanning (I.e. atvremote --debug scan)?
Based on the error you get, it's probably not the correct version. Try pip uninstall pyatv until you font have any version installed. Then try to install again.
OK - I've uninstalled (pip3 uninstall pyatv) and here is the re-install log:
C:\Windows\system32>pip3 install git+https://github.com/postlund/pyatv.git@refs/pull/688/head
```
Collecting git+https://github.com/postlund/pyatv.git@refs/pull/688/head
Cloning https://github.com/postlund/pyatv.git (to revision refs/pull/688/head) to c:userssofakngappdatalocaltemppip-req-build-2bq7kqn4
Running command git clone -q https://github.com/postlund/pyatv.git 'C:UserssofakngAppDataLocalTemppip-req-build-2bq7kqn4'
WARNING: Did not find branch or tag 'refs/pull/688/head', assuming revision or ref.
Running command git fetch -q https://github.com/postlund/pyatv.git refs/pull/688/head
Running command git checkout -q 675d303a068e5e320b4b6b8b6dc2f6d93f9e41aa
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing wheel metadata ... done
Requirement already satisfied: protobuf>=3.6.0 in c:program filespython38libsite-packages (from pyatv==0.6.1) (3.12.2)
Requirement already satisfied: aiozeroconf>=0.1.8 in c:program filespython38libsite-packages (from pyatv==0.6.1) (0.1.8)
Requirement already satisfied: srptools>==0.2.0 in c:program filespython38libsite-packages (from pyatv==0.6.1) (1.0.0)
Requirement already satisfied: cryptography>=2.6 in c:program filespython38libsite-packages (from pyatv==0.6.1) (2.9.2)
Requirement already satisfied: netifaces>=0.10.0 in c:program filespython38libsite-packages (from pyatv==0.6.1) (0.10.9)
Requirement already satisfied: aiohttp<5,>=3.1.0 in c:program filespython38libsite-packages (from pyatv==0.6.1) (3.6.2)
Requirement already satisfied: six>=1.9 in c:program filespython38libsite-packages (from protobuf>=3.6.0->pyatv==0.6.1) (1.15.0)
Requirement already satisfied: setuptools in c:program filespython38libsite-packages (from protobuf>=3.6.0->pyatv==0.6.1) (41.2.0)
Requirement already satisfied: cffi!=1.11.3,>=1.8 in c:program filespython38libsite-packages (from cryptography>=2.6->pyatv==0.6.1) (1.14.0)
Requirement already satisfied: async-timeout<4.0,>=3.0 in c:program filespython38libsite-packages (from aiohttp<5,>=3.1.0->pyatv==0.6.1) (3.0.1)
Requirement already satisfied: attrs>=17.3.0 in c:program filespython38libsite-packages (from aiohttp<5,>=3.1.0->pyatv==0.6.1) (19.3.0)
Requirement already satisfied: yarl<2.0,>=1.0 in c:program filespython38libsite-packages (from aiohttp<5,>=3.1.0->pyatv==0.6.1) (1.4.2)
Requirement already satisfied: multidict<5.0,>=4.5 in c:program filespython38libsite-packages (from aiohttp<5,>=3.1.0->pyatv==0.6.1) (4.7.6)
Requirement already satisfied: chardet<4.0,>=2.0 in c:program filespython38libsite-packages (from aiohttp<5,>=3.1.0->pyatv==0.6.1) (3.0.4)
Requirement already satisfied: pycparser in c:program filespython38libsite-packages (from cffi!=1.11.3,>=1.8->cryptography>=2.6->pyatv==0.6.1) (2.20)
Requirement already satisfied: idna>=2.0 in c:program filespython38libsite-packages (from yarl<2.0,>=1.0->aiohttp<5,>=3.1.0->pyatv==0.6.1) (2.10)
Building wheels for collected packages: pyatv
Building wheel for pyatv (PEP 517) ... done
Created wheel for pyatv: filename=pyatv-0.6.1-py3-none-any.whl size=280583 sha256=5a243d3f73e6b03235a8d03b59f74116deaef957aef7b26c5cda8fba57ff0f8d
Stored in directory: C:UserssofakngAppDataLocalTemppip-ephem-wheel-cache-v0xjncsewheels630d4ca01b714247d45bf9edf68da73ec9ec4cd9ffadc36595f19278
Successfully built pyatv
Installing collected packages: pyatv
Successfully installed pyatv-0.6.1
...and here is the scan log:
C:Windowssystem32>atvremote scan --debug
```2020-07-01 09:54:11 DEBUG: Sending multicast DNS request to 224.0.0.251:5353 (Data=35ff012000040000000000000b5f6170706c6574762d7632045f746370056c6f63616c0000ff80010b5f746f7563682d61626c65045f746370056c6f63616c0000ff80010e5f6d6564696172656d6f74657476045f746370056c6f63616c0000ff8001085f616972706c6179045f746370056c6f63616c0000ff8001)
2020-07-01 09:54:12 DEBUG: Sending multicast DNS request to 224.0.0.251:5353 (Data=35ff012000040000000000000b5f6170706c6574762d7632045f746370056c6f63616c0000ff80010b5f746f7563682d61626c65045f746370056c6f63616c0000ff80010e5f6d6564696172656d6f74657476045f746370056c6f63616c0000ff8001085f616972706c6179045f746370056c6f63616c0000ff8001)
2020-07-01 09:54:13 DEBUG: Sending multicast DNS request to 224.0.0.251:5353 (Data=35ff012000040000000000000b5f6170706c6574762d7632045f746370056c6f63616c0000ff80010b5f746f7563682d61626c65045f746370056c6f63616c0000ff80010e5f6d6564696172656d6f74657476045f746370056c6f63616c0000ff8001085f616972706c6179045f746370056c6f63616c0000ff8001)
Scan Results
========================================
Ok, now it seems to install correctly. Might be the case that scanning is not working on windows or something, will have to investigate that (I don't have any windows machines though, so it's a bit tricky). Can you try with unicast scanning in the meanwhile,
Because I assume scanning works with latest version on pypi, no?
OK - It looks like unicast is working:
C:\Windows\system32>atvremote -s 192.168.10.103 scan
Scan Results
========================================
Name: Home Theater
Model/SW: 4K tvOS 13.4.6 build 17L570
Address: 192.168.10.103
MAC: (REDACTED)
Identifiers:
- (REDACTED)
- (REDACTED)
Services:
- Protocol: MRP, Port: 49152, Credentials: None
- Protocol: AirPlay, Port: 7000, Credentials: None
I've tested holding the select button on the home screen (select=2) and the icons enter 'jiggle mode' so that works. The reason I initially requested support was because of the Philo TV app but I no longer pay for it.
Can you think of anything specifically I can test?
For me that is good enough, it at least shows that something works. So I can most likely merge this now 馃憤
Thanks so much for the work on this!