/usr/lib/python3/dist-packages/PyChromecast-0.8.1.egg-info/PKG-INFO is in python3-pychromecast 0.8.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | Metadata-Version: 1.1
Name: PyChromecast
Version: 0.8.1
Summary: Python module to talk to Google Chromecast.
Home-page: https://github.com/balloob/pychromecast
Author: Paulus Schoutsen
Author-email: paulus@paulusschoutsen.nl
License: MIT
Description: pychromecast |Build Status|
===========================
.. |Build Status| image:: https://travis-ci.org/balloob/pychromecast.svg?branch=master
:target: https://travis-ci.org/balloob/pychromecast
Library for Python 2 and 3 to communicate with the Google Chromecast. It
currently supports:
- Auto discovering connected Chromecasts on the network
- Start the default media receiver and play any online media
- Control playback of current playing media
- Implement Google Chromecast api v2
- Communicate with apps via channels
- Easily extendable to add support for unsupported namespaces
- Multi-room setups with Audio cast devices
*Check out [Home Assistant](https://home-assistant.io) for a ready-made solution using PyChromecast for controlling and automating your Chromecast or Cast-enabled device like Google Home.*
Dependencies
------------
PyChromecast depends on the Python packages requests, protobuf and
zeroconf. Make sure you have these dependencies installed using
``pip install -r requirements.txt``
Some users running Python 2.7 have `reported`_ that they had to upgrade
their version of pip using ``pip install --upgrade pip`` before they
were able to install the latest version of the dependencies.
.. _reported: https://github.com/balloob/pychromecast/issues/47#issuecomment-107822162
How to use
----------
.. code:: python
>> from __future__ import print_function
>> import time
>> import pychromecast
>> chromecasts = pychromecast.get_chromecasts()
>> [cc.device.friendly_name for cc in chromecasts]
['Dev', 'Living Room', 'Den', 'Bedroom']
>> cast = next(cc for cc in chromecasts if cc.device.friendly_name == "Living Room")
>> # Wait for cast device to be ready
>> cast.wait()
>> print(cast.device)
DeviceStatus(friendly_name='Living Room', model_name='Chromecast', manufacturer='Google Inc.', api_version=(1, 0), uuid=UUID('df6944da-f016-4cb8-97d0-3da2ccaa380b'), cast_type='cast')
>> print(cast.status)
CastStatus(is_active_input=True, is_stand_by=False, volume_level=1.0, volume_muted=False, app_id=u'CC1AD845', display_name=u'Default Media Receiver', namespaces=[u'urn:x-cast:com.google.cast.player.message', u'urn:x-cast:com.google.cast.media'], session_id=u'CCA39713-9A4F-34A6-A8BF-5D97BE7ECA5C', transport_id=u'web-9', status_text='')
>> mc = cast.media_controller
>> mc.play_media('http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4', 'video/mp4')
>> mc.block_until_active()
>> print(mc.status)
MediaStatus(current_time=42.458322, content_id=u'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4', content_type=u'video/mp4', duration=596.474195, stream_type=u'BUFFERED', idle_reason=None, media_session_id=1, playback_rate=1, player_state=u'PLAYING', supported_media_commands=15, volume_level=1, volume_muted=False)
>> mc.pause()
>> time.sleep(5)
>> mc.play()
Adding support for extra namespaces
-----------------------------------
Each app that runs on the Chromecast supports namespaces. They specify a
JSON-based mini-protocol. This is used to communicate between the
Chromecast and your phone/browser and now Python.
Support for extra namespaces is added by using controllers. To add your own namespace to a current chromecast instance you will first have to define your controller. Example of a minimal controller:
.. code:: python
from pychromecast.controllers import BaseController
class MyController(BaseController):
def __init__(self):
super(MyController, self).__init__(
"urn:x-cast:my.super.awesome.namespace")
def receive_message(self, message, data):
print("Wow, I received this message: {}".format(data))
return True # indicate you handled this message
def request_beer(self):
self.send_message({'request': 'beer'})
After you have defined your controller you will have to add an instance to a Chromecast object: `cast.register_handler(MyController())`. When a message is received with your namespace it will be routed to your controller.
For more options see the `BaseController`_. For an example of a fully implemented controller see the `MediaController`_.
.. _BaseController: https://github.com/balloob/pychromecast/blob/master/pychromecast/controllers/__init__.py
.. _MediaController: https://github.com/balloob/pychromecast/blob/master/pychromecast/controllers/media.py
Exploring existing namespaces
-------------------------------
So you've got PyChromecast running and decided it is time to add support to your favorite app. No worries, the following instructions will have you covered in exploring the possibilities.
The following instructions require the use of the `Google Chrome browser`_ and the `Google Cast plugin`_.
* In Chrome, go to `chrome://net-internals/#capture`
* Enable the checkbox 'Include the actual bytes sent/received.'
* Open a new tab, browse to your favorite application on the web that has Chromecast support and start casting.
* Go back to the tab that is capturing events and click on stop.
* From the dropdown click on events. This will show you a table with events that happened while you were recording.
* In the filter box enter the text `Tr@n$p0rt`. This should give one SOCKET connection as result: the connection with your Chromecast.
* Go through the results and collect the JSON that is exchanged.
* Now write a controller that is able to mimic this behavior :-)
.. _Google Chrome Browser: https://www.google.com/chrome/
.. _Google Cast Plugin: https://chrome.google.com/webstore/detail/google-cast/boadgeojelhgndaghljhdicfkmllpafd
Ignoring CEC Data
-----------------
The Chromecast typically reports whether it is the active input on the device
to which it is connected. This value is stored inside a cast object in the
following property.
.. code:: python
cast.status.is_active_input
Some Chromecast users have reported CEC incompatibilities with their media
center devices. These incompatibilities may sometimes cause this active input
value to be reported improperly.
This active input value is typically used to determine if the Chromecast
is idle. PyChromecast is capable of ignoring the active input value when
determining if the Chromecast is idle in the instance that the
Chromecast is returning erroneous values. To ignore this CEC detection
data in PyChromecast, append a `Linux style wildcard`_ formatted string
to the IGNORE\_CEC list in PyChromecast like in the example below.
.. code:: python
pychromecast.IGNORE_CEC.append('*') # Ignore CEC on all devices
pychromecast.IGNORE_CEC.append('Living Room') # Ignore CEC on Chromecasts named Living Room
Maintainers
-----------
- Jan Borsodi (`@am0s`_)
- Ryan Kraus (`@rmkraus`_)
- Paulus Schoutsen (`@balloob`_, original author)
Thanks
------
I would like to thank `Fred Clift`_ for laying the socket client ground
work. Without him it would not have been possible!
.. _Linux style wildcard: http://tldp.org/LDP/GNU-Linux-Tools-Summary/html/x11655.htm
.. _@am0s: https://github.com/am0s
.. _@rmkraus: https://github.com/rmkraus
.. _@balloob: https://github.com/balloob
.. _Fred Clift: https://github.com/minektur
Platform: any
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|