stigger / trakt-for-appletv

Trakt.tv scrobbler for Apple TV
49 stars 7 forks source link

unable to connect #25

Closed pippo73 closed 1 year ago

pippo73 commented 1 year ago

Hello all, I'm trying this app. I've installed the app with the pip command. After that I've started the second command. The track part ended ok, but it seems the part of the apple tv has some problems.

trakt-for-appletv-master$ python3 ./tvscrobbler.py
Navigate to https://trakt.tv/oauth/authorize?client_id=XXXXXXXXXXXX
Authorization code: XXXX
Enter code displayed by Apple TV: 9443
Traceback (most recent call last):
  File "/home/z-lmutt/Trakt-for-appletv/trakt-for-appletv-master/./tvscrobbler.py", line 32, in <module>
    asyncio.run(launch(ScrobblingRemoteProtocol(load_config())))
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/home/z-lmutt/Trakt-for-appletv/trakt-for-appletv-master/./tvscrobbler.py", line 25, in launch
    await tv_protocol.connect(atv)
  File "/home/z-lmutt/Trakt-for-appletv/trakt-for-appletv-master/scrobbling.py", line 62, in connect
    await super().connect(atv)
  File "/home/z-lmutt/Trakt-for-appletv/trakt-for-appletv-master/media_remote.py", line 38, in connect
    self.atv = await pyatv.connect(atv, loop)
  File "/home/z-lmutt/.local/lib/python3.10/site-packages/pyatv/__init__.py", line 90, in connect
    for setup_data in proto_methods.setup(
  File "/home/z-lmutt/.local/lib/python3.10/site-packages/pyatv/protocols/airplay/__init__.py", line 218, in setup
    if not remote_control.is_supported(service):
  File "/home/z-lmutt/.local/lib/python3.10/site-packages/pyatv/protocols/airplay/remote_control.py", line 48, in is_supported
    return float(version) >= 13.0
ValueError: could not convert string to float: '16.4.1'
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f8e78678dc0>

I get the following error.

Could you help me please?

$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.2 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

$ python3 --version
Python 3.10.6
stigger commented 1 year ago

Please try updating pyatv to 0.9.3

pippo73 commented 1 year ago

I have tried to upgrade to 0.9.3

$ python3 ./tvscrobbler.py
Traceback (most recent call last):
  File "/home/z-lmutt/Trakt-for-appletv/trakt-for-appletv-master/./tvscrobbler.py", line 2, in <module>
    import pyatv
  File "/home/z-lmutt/.local/lib/python3.10/site-packages/pyatv/__init__.py", line 14, in <module>
    from pyatv.core.facade import FacadeAppleTV
  File "/home/z-lmutt/.local/lib/python3.10/site-packages/pyatv/core/__init__.py", line 5, in <module>
    from mypy_extensions import VarArg
ModuleNotFoundError: No module named 'mypy_extensions'

I've tried also to update to the latest version of the package

$ pip install pyatv --upgrade
[..]
Installing collected packages: pyatv
  Attempting uninstall: pyatv
    Found existing installation: pyatv 0.9.3
    Uninstalling pyatv-0.9.3:
      Successfully uninstalled pyatv-0.9.3
Successfully installed pyatv-0.10.3
z-lmutt@tatulli:~/Trakt-for-appletv/trakt-for-appletv-master$ python3 ./tvscrobbler.py
Navigate to https://trakt.tv/oauth/authorize?client_id=dc705f550f50706bdd7bd55db120235cc68899dbbfb4fbc171384c1c1d30d7d4&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code
Authorization code: 200fa095
Enter code displayed by Apple TV: 8723
ready!
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f3caa196b00>
Traceback (most recent call last):
  File "/home/z-lmutt/Trakt-for-appletv/trakt-for-appletv-master/./tvscrobbler.py", line 32, in <module>
    asyncio.run(launch(ScrobblingRemoteProtocol(load_config())))
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/home/z-lmutt/Trakt-for-appletv/trakt-for-appletv-master/./tvscrobbler.py", line 25, in launch
    await tv_protocol.connect(atv)
  File "/home/z-lmutt/Trakt-for-appletv/trakt-for-appletv-master/scrobbling.py", line 64, in connect
    protocol.add_listener(self.message_received, ProtocolMessage.SET_STATE_MESSAGE)
AttributeError: 'MrpProtocol' object has no attribute 'add_listener'
stigger commented 1 year ago

@pippo73 Pushed a fix, should work with the newer pyatv versions now.