python-plexapi icon indicating copy to clipboard operation
python-plexapi copied to clipboard

AttributeError when interacting with Sonos timelines

Open nesati opened this issue 6 months ago • 0 comments

Describe the Bug

Traceback (most recent call last):
  File "/home/user/bug_report.py", line 10, in <module>
    for timeline in client.timelines():
                    ~~~~~~~~~~~~~~~~^^
  File "/home/user/miniconda3/envs/shadowloop/lib/python3.13/site-packages/plexapi/client.py", line 578, in timelines
    if t - self._timeline_cache_timestamp > 1:
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'PlexSonosClient' object has no attribute '_timeline_cache_timestamp'

Code Snippets

from plexapi.myplex import MyPlexAccount
from plexapi.server import PlexServer

baseurl = 'http://plexserver:32400'
token = '2ffLuB84dqLswk9skLos'
account = MyPlexAccount(token=token)
server = PlexServer(baseurl, token)

for client in account.sonos_speakers():
    for timeline in client.timelines():
        if timeline.key is not None:
            item = server.library.fetchItem(timeline.key)
            print(client.machineIdentifier, client.title, item)

Expected Behavior

I expect it to work like normal PlexClient without the exception

Additional Context

No response

Operating System and Version

Manjaro

Plex Media Server Version

1.41.6.9685

Python Version

3.13

PlexAPI Version

4.17.0

nesati avatar May 14 '25 11:05 nesati