@@ -195,10 +195,11 @@ def sendCommand(self, command, proxy=None, **params):
195195
196196 # Workaround for ptp. See https://github.com/pkkid/python-plexapi/issues/244
197197 t = time .time ()
198- if t - self ._last_call >= 80 and self .product in ('ptp' , 'Plex Media Player' ):
199- url = '/player/timeline/poll?wait=0&commandID=%s' % self ._nextCommandId ()
200- query (url , headers = headers )
198+ if command == 'timeline/poll' :
201199 self ._last_call = t
200+ elif t - self ._last_call >= 80 and self .product in ('ptp' , 'Plex Media Player' ):
201+ self ._last_call = t
202+ self .timeline ()
202203
203204 params ['commandID' ] = self ._nextCommandId ()
204205 key = '/player/%s%s' % (command , utils .joinArgs (params ))
@@ -485,15 +486,6 @@ def playMedia(self, media, offset=0, **params):
485486 if mediatype == "audio" :
486487 mediatype = "music"
487488
488- if self .product != 'OpenPHT' :
489- try :
490- self .sendCommand ('timeline/subscribe' , port = server_port , protocol = 'http' )
491- except : # noqa: E722
492- # some clients dont need or like this and raises http 400.
493- # We want to include the exception in the log,
494- # but it might still work so we swallow it.
495- log .exception ('%s failed to subscribe ' % self .title )
496-
497489 playqueue = media if isinstance (media , PlayQueue ) else self ._server .createPlayQueue (media )
498490 self .sendCommand ('playback/playMedia' , ** dict ({
499491 'machineIdentifier' : self ._server .machineIdentifier ,
@@ -548,7 +540,7 @@ def setStreams(self, audioStreamID=None, subtitleStreamID=None, videoStreamID=No
548540
549541 # -------------------
550542 # Timeline Commands
551- def timeline (self , wait = 1 ):
543+ def timeline (self , wait = 0 ):
552544 """ Poll the current timeline and return the XML response. """
553545 return self .sendCommand ('timeline/poll' , wait = wait )
554546
@@ -559,7 +551,7 @@ def isPlayingMedia(self, includePaused=False):
559551 includePaused (bool): Set True to treat currently paused items
560552 as playing (optional; default True).
561553 """
562- for mediatype in self .timeline (wait = 0 ):
554+ for mediatype in self .timeline ():
563555 if mediatype .get ('state' ) == 'playing' :
564556 return True
565557 if includePaused and mediatype .get ('state' ) == 'paused' :
0 commit comments