Skip to content

Commit

Permalink
Fix plex controller (#389)
Browse files Browse the repository at this point in the history
* Fix Plex controller playback by updating version string

* Override play_media in PlexApiController to patch in PMS version

Co-authored-by: Davy Hollevoet <davy@natox.be>
  • Loading branch information
davyhollevoet and Davy Hollevoet authored Jul 2, 2020
1 parent f3f8449 commit ac426ba
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion pychromecast/controllers/plex.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def media_to_chromecast_command(
autoplay=True,
currentTime=0,
playQueueID=None,
version="1.10.1.4602",
**kwargs
): # noqa: 501 pylint: disable=invalid-name, too-many-arguments, too-many-locals, protected-access, redefined-builtin
"""Create the message that chromecast requires. Use pass of plexapi media object or
Expand Down Expand Up @@ -80,6 +81,7 @@ def media_to_chromecast_command(
username (None): user name of the person that start the playback.
autoplay (bool): Auto play after the video is done.
currentTime (int): Set playback from this time. default 0
version (str): pms version. Default 1.10.1.4602
**kwargs: To allow overrides, this will be merged with the rest of the msg.
Returns:
Expand Down Expand Up @@ -126,7 +128,7 @@ def media_to_chromecast_command(
"transcoderVideo": transcoderVideo,
"transcoderVideoRemuxOnly": transcoderVideoRemuxOnly,
"transcoderAudio": transcoderAudio,
"version": "1.4.3.3433",
"version": version,
"myPlexSubscription": myPlexSubscription,
"isVerifiedHostname": isVerifiedHostname,
"protocol": protocol,
Expand Down Expand Up @@ -530,3 +532,16 @@ def enable_subtitle(self, subtitle):
subtitle (str): could be index, language or languageCode.
"""
self._change_track(subtitle)

def play_media(self, media=None, **kwargs):
"""Start playback on the chromecast
Args:
media (None, optional): Can also be :class:`~plexapi.base.Playable
if its not, you need to fill out all the kwargs.
**kwargs: See media_to_chromecast_command docs string. `version` is by default set to the
version of the PMS reported by the API.
""" # noqa
args = {"version": self.pms.version}
args.update(kwargs)
super().play_media(media, **args)

0 comments on commit ac426ba

Please sign in to comment.