Hello community,
here is the log from the commit of package python-PyChromecast for openSUSE:Factory checked in at 2020-09-30 19:54:17
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-PyChromecast (Old)
and /work/SRC/openSUSE:Factory/.python-PyChromecast.new.4249 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-PyChromecast"
Wed Sep 30 19:54:17 2020 rev:15 rq:838626 version:7.5.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-PyChromecast/python-PyChromecast.changes 2020-09-22 21:12:21.071990811 +0200
+++ /work/SRC/openSUSE:Factory/.python-PyChromecast.new.4249/python-PyChromecast.changes 2020-09-30 19:54:34.836794860 +0200
@@ -1,0 +2,8 @@
+Wed Sep 30 02:51:51 UTC 2020 - Steve Kowalik
+
+- Update to 7.5.0:
+ * Allow passing additional media information through to play_media
+ * Add support for lists, playQueues, and playlists to Plex controller
+ * Misc spelling changes
+
+-------------------------------------------------------------------
Old:
----
PyChromecast-7.3.0.tar.gz
New:
----
PyChromecast-7.5.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-PyChromecast.spec ++++++
--- /var/tmp/diff_new_pack.FOjUOW/_old 2020-09-30 19:54:35.460795417 +0200
+++ /var/tmp/diff_new_pack.FOjUOW/_new 2020-09-30 19:54:35.460795417 +0200
@@ -19,7 +19,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-PyChromecast
-Version: 7.3.0
+Version: 7.5.0
Release: 0
Summary: Python module to talk to Google Chromecast
License: MIT
++++++ PyChromecast-7.3.0.tar.gz -> PyChromecast-7.5.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyChromecast-7.3.0/PKG-INFO new/PyChromecast-7.5.0/PKG-INFO
--- old/PyChromecast-7.3.0/PKG-INFO 2020-09-05 15:02:54.023595600 +0200
+++ new/PyChromecast-7.5.0/PKG-INFO 2020-09-27 10:39:25.288506000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: PyChromecast
-Version: 7.3.0
+Version: 7.5.0
Summary: Python module to talk to Google Chromecast.
Home-page: https://github.com/balloob/pychromecast
Author: Paulus Schoutsen
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyChromecast-7.3.0/PyChromecast.egg-info/PKG-INFO new/PyChromecast-7.5.0/PyChromecast.egg-info/PKG-INFO
--- old/PyChromecast-7.3.0/PyChromecast.egg-info/PKG-INFO 2020-09-05 15:02:53.000000000 +0200
+++ new/PyChromecast-7.5.0/PyChromecast.egg-info/PKG-INFO 2020-09-27 10:39:24.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: PyChromecast
-Version: 7.3.0
+Version: 7.5.0
Summary: Python module to talk to Google Chromecast.
Home-page: https://github.com/balloob/pychromecast
Author: Paulus Schoutsen
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyChromecast-7.3.0/pychromecast/__init__.py new/PyChromecast-7.5.0/pychromecast/__init__.py
--- old/PyChromecast-7.3.0/pychromecast/__init__.py 2020-09-05 15:02:47.000000000 +0200
+++ new/PyChromecast-7.5.0/pychromecast/__init__.py 2020-09-27 10:39:14.000000000 +0200
@@ -119,7 +119,7 @@
are (no longer) needed, pass the browser object to
pychromecast.discovery.stop_discovery().
- To only discover chromcast devices wihtout connecting to them, use
+ To only discover chromecast devices without connecting to them, use
discover_listed_chromecasts instead.
:param friendly_names: A list of wanted friendly names
@@ -193,14 +193,14 @@
are (no longer) needed, pass the browser object to
pychromecast.discovery.stop_discovery().
- To only discover chromcast devices wihtout connecting to them, use
+ To only discover chromecast devices without connecting to them, use
discover_chromecasts instead.
Parameters tries, timeout, retry_wait and blocking_app_launch controls the
behavior of the created Chromecast instances.
:param tries: Number of retries to perform if the connection fails.
- None for inifinite retries.
+ None for infinite retries.
:param timeout: A floating point number specifying the socket timeout in
seconds. None means to use the default which is 30 seconds.
:param retry_wait: A floating point number specifying how many seconds to
@@ -209,7 +209,7 @@
:param blocking: If True, returns a list of discovered chromecast devices.
If False, triggers a callback for each discovered chromecast,
and returns a function which can be executed to stop discovery.
- :param callback: Callback which is triggerd for each discovered chromecast when
+ :param callback: Callback which is triggered for each discovered chromecast when
blocking = False.
:param zeroconf_instance: An existing zeroconf instance.
"""
@@ -274,7 +274,7 @@
:param device: DeviceStatus with initial information for the device.
:type device: pychromecast.dial.DeviceStatus
:param tries: Number of retries to perform if the connection fails.
- None for inifinite retries.
+ None for infinite retries.
:param timeout: A floating point number specifying the socket timeout in
seconds. None means to use the default which is 30 seconds.
:param retry_wait: A floating point number specifying how many seconds to
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyChromecast-7.3.0/pychromecast/controllers/media.py new/PyChromecast-7.5.0/pychromecast/controllers/media.py
--- old/PyChromecast-7.3.0/pychromecast/controllers/media.py 2020-09-05 15:02:47.000000000 +0200
+++ new/PyChromecast-7.5.0/pychromecast/controllers/media.py 2020-09-27 10:39:14.000000000 +0200
@@ -500,6 +500,7 @@
subtitles_mime="text/vtt",
subtitle_id=1,
enqueue=False,
+ media_info=None,
):
"""
Plays media on the Chromecast. Start default media receiver if not
@@ -520,12 +521,14 @@
subtitles_mime: str - mimetype of subtitles.
subtitle_id: int - id of subtitle to be loaded.
enqueue: bool - if True, enqueue the media instead of play it.
+ media_info: dict - additional MediaInformation attributes not explicitly listed.
metadata: dict - media metadata object, one of the following:
GenericMediaMetadata, MovieMediaMetadata, TvShowMediaMetadata,
MusicTrackMediaMetadata, PhotoMediaMetadata.
Docs:
https://developers.google.com/cast/docs/reference/messages#MediaData
+ https://developers.google.com/cast/docs/reference/web_receiver/cast.framewor...
"""
# pylint: disable=too-many-locals
def app_launched_callback():
@@ -544,6 +547,7 @@
subtitles_mime,
subtitle_id,
enqueue,
+ media_info,
)
receiver_ctrl = self._socket_client.receiver_controller
@@ -564,13 +568,16 @@
subtitles_mime="text/vtt",
subtitle_id=1,
enqueue=False,
+ media_info=None,
):
# pylint: disable=too-many-locals
+ media_info = media_info or {}
media = {
"contentId": url,
"streamType": stream_type,
"contentType": content_type,
"metadata": metadata or {},
+ **media_info,
}
if title:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyChromecast-7.3.0/pychromecast/controllers/plex.py new/PyChromecast-7.5.0/pychromecast/controllers/plex.py
--- old/PyChromecast-7.3.0/pychromecast/controllers/plex.py 2020-09-05 15:02:47.000000000 +0200
+++ new/PyChromecast-7.5.0/pychromecast/controllers/plex.py 2020-09-27 10:39:14.000000000 +0200
@@ -42,7 +42,7 @@
transcoderVideoRemuxOnly=False,
transcoderAudio=True,
isVerifiedHostname=True,
- contentType=("video/mp4"),
+ contentType="video",
myPlexSubscription=True,
contentId=None,
streamType=STREAM_TYPE_BUFFERED,
@@ -52,7 +52,9 @@
username=None,
autoplay=True,
currentTime=0,
+ playQueue=None,
playQueueID=None,
+ startItem=None,
version="1.10.1.4602",
**kwargs
): # noqa: 501 pylint: disable=invalid-name, too-many-arguments, too-many-locals, protected-access, redefined-builtin
@@ -61,52 +63,62 @@
Args:
media (None, optional): a :class:`~plexapi.base.Playable
- type (str): default LOAD other possible is SHOWDETAILS
- requestId (int): The requestId, think chromecast uses this.
+ type (str): Default LOAD, SHOWDETAILS.
+ requestId (int): The requestId, Chromecasts may use this.
offset (int): Offset of the playback in seconds.
directPlay (bool): Default True
directStream (bool): Default True
- subtitleSize (int): Set the subtitle size, only seen 100 and 200 so far.
+ subtitleSize (int): Set the subtitle size, possibly only 100 & 200.
audioBoost (int): Default 100
transcoderVideo (bool): Default True
transcoderVideoRemuxOnly (bool): Default False
transcoderAudio (bool): Default True
isVerifiedHostname (bool): Default True
- contentType (str): default ('video/mp4'), ('audio/mp3') if audio
- myPlexSubscription (bool): Has the user a plexpass
- contentId (str): They key chromecast use to start playback.
+ contentType (str): Default 'video', 'audio'
+ myPlexSubscription (bool): True if user has a PlexPass.
+ contentId (str): The key Chromecasts use to start playback.
streamType (str): Default BUFFERED, LIVE
- port (int): pms port
- address (str): pms host, without scheme
- username (None): user name of the person that start the playback.
+ port (int): PMS port
+ address (str): PMS host, without scheme.
+ username (None): Username of the user that started 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
+ version (str): PMS version. Default 1.10.1.4602
+ startItem (:class:`~plexapi.media.Media`, optional): Media item in list/playlist/playqueue where playback should
+ start. Overrides existing startItem for playqueues if set.
**kwargs: To allow overrides, this will be merged with the rest of the msg.
Returns:
- dict: Returs a dict formatted correctly to start playback on a chromecast.
+ dict: Returs a dict formatted correctly to start playback on a Chromecast.
""" # noqa
if media is not None:
- # Let set som params for the user if they use plexapi.
- server_url = urlparse(media._server._baseurl)
- contentType = (
- ("video/mp4") if media.TYPE in ("movie", "episode") else ("audio/mp3")
- )
+ # Lets set some params for the user if they use plexapi.
+ server = media[0]._server if isinstance(media, list) else media._server
+ server_url = urlparse(server._baseurl)
protocol = server_url.scheme
address = server_url.hostname
port = server_url.port
- machineIdentifier = media._server.machineIdentifier
- playQueueID = media._server.createPlayQueue(media).playQueueID
- token = media._server._token
- username = media._server.myPlexUsername
- myPlexSubscription = media._server.myPlexSubscription
- contentId = media.key
-
- # Lets see if this helps
- # chrome cast seems to start playback
- # 5 sec before the offset.
+ machineIdentifier = server.machineIdentifier
+ token = server._token
+ username = server.myPlexUsername
+ myPlexSubscription = server.myPlexSubscription
+
+ if getattr(media, "TYPE", None) == "playqueue":
+ if startItem:
+ media = media.items
+ else:
+ playQueue = media
+
+ if playQueue is None:
+ playQueue = server.createPlayQueue(media, startItem=startItem)
+
+ playQueueID = playQueue.playQueueID
+ contentId = playQueue.selectedItem.key
+ contentType = playQueue.playQueueType
+ version = server.version
+
+ # Chromecasts seem to start playback 5 seconds before the offset.
if offset != 0:
currentTime = offset
@@ -146,7 +158,7 @@
},
}
- # Allow passing kwarg to the dict
+ # Allow passing of kwargs to the dict.
msg.update(kwargs)
return msg
@@ -178,18 +190,18 @@
callback_function=None,
inc=True,
): # pylint: disable=too-many-arguments
- """Wrapper the commands.
+ """Wrapper for the commands.
Args:
- msg (dict): the actual command that will be sent.
- namespace (None, optional): What namespace should se use to send this.
- inc_session_id (bool, optional): Include session id.
- callback_function (None, optional): If given the callback is exceuted
- after the command is executed.
+ msg (dict): The actual command that will be sent.
+ namespace (None, optional): What namespace should be used to send this.
+ inc_session_id (bool, optional): Include session ID.
+ callback_function (None, optional): If callback is provided it is
+ executed after the command.
inc (bool, optional): Increase the requestsId.
""" # noqa
self.logger.debug(
- "Sending msg %r %s %s %s %s",
+ "Sending msg %r %s %s %s %s.",
msg,
namespace,
inc_session_id,
@@ -217,38 +229,37 @@
)
def _inc_request(self):
- # is this needed? dunno if this is getting passed to plex
+ # Is this getting passed to Plex?
self.request_id += 1
return self.request_id
def channel_connected(self):
- """Called when media channel is connected. Will update status."""
+ """Updates status when a media channel is connected."""
self.update_status()
def receive_message(self, message, data: dict):
- """Called when a message from plex to our controller is received.
-
- I havnt seen any message for ut but lets keep for for now, the
- tests i have done is minimal.
+ """Called when a message from Plex to our controller is received.
+ I haven't seen any message for it, but lets keep for for now.
+ I have done minimal testing.
Args:
message (dict): Description
- data (dict): message.payload_utf8 interpreted as a JSON dict
+ data (dict): message.payload_utf8 interpreted as a JSON dict.
Returns:
- bool: True if the message is handled, False if not.
+ bool: True if the message is handled.
"""
if data[MESSAGE_TYPE] == TYPE_MEDIA_STATUS:
- self.logger.debug("(PlexController) MESSAGE RECEIVED: %r", data)
+ self.logger.debug("(PlexController) MESSAGE RECEIVED: %r.", data)
return True
return False
def update_status(self, callback_function_param=False):
- """Send message to update the status."""
+ """Send message to update status."""
self.send_message(
{MESSAGE_TYPE: TYPE_GET_STATUS}, callback_function=callback_function_param
)
@@ -274,10 +285,10 @@
self._send_cmd({MESSAGE_TYPE: TYPE_NEXT})
def seek(self, position, resume_state="PLAYBACK_START"):
- """Send seek command
+ """Send seek command.
Args:
- position (int): offset in seconds.
+ position (int): Offset in seconds.
resume_state (str, default): PLAYBACK_START
"""
self._send_cmd(
@@ -285,21 +296,21 @@
)
def rewind(self):
- """Rewind back to the start"""
+ """Rewind back to the start."""
self.seek(0)
def set_volume(self, percent):
- """Set the volume 1-100
+ """Set the volume in percent (1-100).
Args:
- percent (int): The wanted volume.
+ percent (int): Percent of volume to be set.
"""
self._socket_client.receiver_controller.set_volume(
float(percent / 100)
) # noqa: 501
def volume_up(self, delta=0.1):
- """Increment volume by 0.1 (or delta) unless it is already maxed.
+ """Increment volume by 0.1 (or delta) unless at max.
Returns the new volume.
"""
if delta <= 0:
@@ -309,7 +320,7 @@
return self.set_volume(self.status.volume_level + delta)
def volume_down(self, delta=0.1):
- """Decrement the volume by 0.1 (or delta) unless it is already 0.
+ """Decrement the volume by 0.1 (or delta) unless at 0.
Returns the new volume.
"""
if delta <= 0:
@@ -319,10 +330,10 @@
return self.set_volume(self.status.volume_level - delta)
def mute(self, status=None):
- """mute the sound, acts as on off.
+ """Toggle muting of audio.
Args:
- status (None, optional): override for on/off
+ status (None, optional): Override for on/off.
"""
if status is None:
status = not self.status.volume_muted
@@ -330,7 +341,7 @@
self._socket_client.receiver_controller.set_volume_muted(status)
def show_media(self, media=None, **kwargs):
- """Show the media on the screen"""
+ """Show media item's info on screen."""
msg = media_to_chromecast_command(
media, type=TYPE_DETAILS, requestId=self._inc_request(), **kwargs
)
@@ -341,12 +352,12 @@
self.launch(callback)
def quit_app(self):
- """Quit the plex app"""
+ """Quit the Plex app."""
self._socket_client.receiver_controller.stop_app()
@property
def status(self):
- """Get the chromecast playing status.
+ """Get the Chromecast's playing status.
Returns:
pychromecast.controllers.media.MediaStatus: Slightly modified status with patched
@@ -360,21 +371,18 @@
"""Reset playback.
Args:
- offset (None, optional): What time should the stream start again, if omitted
- the platback will start from current time.
- Setting it will override this behaviour.
- This is given in seconds.
+ offset (None, optional): Start playback from this offset in seconds,
+ otherwise playback will start from current time.
+
""" # noqa
if self._last_play_msg:
offset_now = self.status.adjusted_current_time
msg = deepcopy(self._last_play_msg)
- if offset is None:
- msg["media"]["customData"]["offset"] = offset_now
- msg["current_time"] = offset_now
- else:
- msg["media"]["customData"]["offset"] = offset
- msg["current_time"] = offset_now
+ msg["media"]["customData"]["offset"] = (
+ offset_now if offset is None else offset
+ )
+ msg["current_time"] = offset_now
self._send_cmd(
msg,
@@ -384,8 +392,8 @@
)
else:
self.logger.debug(
- "Cant reset the stream as _last_play_msg "
- "is not set by _send_start_play"
+ "Can not reset the stream, _last_play_msg "
+ "was not set with _send_start_play."
)
def _send_start_play(self, media=None, **kwargs):
@@ -408,30 +416,30 @@
)
def block_until_playing(self, media=None, timeout=None, **kwargs):
- """Block until this playing, typically usefull in a script
+ """Block until media is playing, typically useful in a script.
- another way to the the same is the check if the
- controllers is_active or use self.status.player_state
+ Another way to do the same is to check if the
+ controller is_active or by using self.status.player_state.
Args:
- media (None, optional): Can also be :class:`~plexapi.base.Playable
- if its not, you need to fill out all the kwargs.
- timeout (None, int): default None
- **kwargs: See media_to_chromecast_command docs string.
+ media (None, optional): Can also be :class:`~plexapi.base.Playable
+ if not, you need to fill out all the kwargs.
+ timeout (None, int): default None
+ **kwargs: See media_to_chromecast_command docs string.
""" # noqa
- # Incase media isnt playing
+ # In case media isnt playing.
self.play_media_event.clear()
self.play_media(media, **kwargs)
self.play_media_event.wait(timeout)
self.play_media_event.clear()
def play_media(self, media=None, **kwargs):
- """Start playback on the chromecast
+ """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.
+ if not, you need to fill out all the kwargs.
**kwargs: See media_to_chromecast_command docs string.
""" # noqa
self.play_media_event.clear()
@@ -457,14 +465,14 @@
# pylint: disable=too-many-public-methods
class PlexApiController(PlexController):
- """A controller that can use plexapi.."""
+ """A controller that can use PlexAPI."""
def __init__(self, pms):
super(PlexApiController, self).__init__()
self.pms = pms
def _get_current_media(self):
- """Get current media_item, media and part for pms."""
+ """Get current media_item, media, & part for PMS."""
key = int(self.status.content_id.split("/")[-1])
media_item = self.pms.fetchItem(key).reload()
media_idx = self.status.media_custom_data.get("mediaIndex", 0)
@@ -475,12 +483,12 @@
return media_item, media, part
def _change_track(self, track, type_="subtitle", reset_playback=True):
- """Sets a new default audio/subtitle track so mde select the correct track.
+ """Sets a new default audio/subtitle track.
Args:
- track (None): what track we should choose.
- type_ (str): what type of track
- reset_playback (bool, optional): Reset the playback after the track has
+ track (None): The chosen track.
+ type_ (str): The type of track.
+ reset_playback (bool, optional): Reset playback after the track has
been changed.
Raises:
@@ -495,11 +503,11 @@
method = part.audioStreams()
default = part.setDefaultAudioStream
else:
- raise ValueError("set type parmenter as subtitle or audio")
+ raise ValueError("Set type parameter as subtitle or audio.")
for track_ in method:
if track in (track_.index, track_.language, track_.languageCode):
- self.logger.debug("Change %s to %s", type_, track)
+ self.logger.debug("Change %s to %s.", type_, track)
default(track_)
break
@@ -508,15 +516,15 @@
self._reset_playback()
def enable_audiotrack(self, audio):
- """Enable a audiotrack.
+ """Enable an audiotrack.
Args:
- audio (str): could be index, language or languageCode.
+ audio (str): Can be index, language or languageCode.
"""
self._change_track(self, audio, "audio")
def disable_subtitle(self):
- """Disable a subtitle."""
+ """Disable a subtitle track."""
(
_,
__,
@@ -529,18 +537,18 @@
"""Enable a subtitle track.
Args:
- subtitle (str): could be index, language or languageCode.
+ subtitle (str): Can be index, language or languageCode.
"""
self._change_track(subtitle)
def play_media(self, media=None, **kwargs):
- """Start playback on the chromecast
+ """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.
+ if not, you need to fill out all the kwargs.
+ **kwargs: See media_to_chromecast_command docs string. `version` is set
+ to the version of the PMS reported by the API by default.
""" # noqa
args = {"version": self.pms.version}
args.update(kwargs)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyChromecast-7.3.0/pychromecast/socket_client.py new/PyChromecast-7.5.0/pychromecast/socket_client.py
--- old/PyChromecast-7.3.0/pychromecast/socket_client.py 2020-09-05 15:02:47.000000000 +0200
+++ new/PyChromecast-7.5.0/pychromecast/socket_client.py 2020-09-27 10:39:14.000000000 +0200
@@ -174,7 +174,7 @@
:param cast_type: The type of chromecast to connect to, see
dial.CAST_TYPE_* for types.
:param tries: Number of retries to perform if the connection fails.
- None for inifinite retries.
+ None for infinite retries.
:param timeout: A floating point number specifying the socket timeout in
seconds. None means to use the default which is 30 seconds.
:param retry_wait: A floating point number specifying how many seconds to
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyChromecast-7.3.0/setup.py new/PyChromecast-7.5.0/setup.py
--- old/PyChromecast-7.3.0/setup.py 2020-09-05 15:02:47.000000000 +0200
+++ new/PyChromecast-7.5.0/setup.py 2020-09-27 10:39:14.000000000 +0200
@@ -5,7 +5,7 @@
setup(
name="PyChromecast",
- version="7.3.0",
+ version="7.5.0",
license="MIT",
url="https://github.com/balloob/pychromecast",
author="Paulus Schoutsen",