Giter Club home page Giter Club logo

pychromecast's Introduction

pychromecast

Allows to remote control the Chromecast from Python. It currently supports:

  • Auto discovering connected Chromecasts on the network
  • Read Chromecast device status
  • Read application status
  • Read the status of the current content being played*
  • Control content: play, pause, change volume, mute or skip*

*: only supported by apps that support the RAMP-protocol.

Dependencies

PyChromecast depends on the Python packages requests and ws4py. Make sure you have these dependencies installed using pip install -r requirements.txt

How to use

>> import time
>> import pychromecast

>> cast = pychromecast.PyChromecast()
>> print cast.device
DeviceStatus(friendly_name='Living Room', model_name='Eureka Dongle', manufacturer='Google Inc.', api_version=(1, 0))

>> print cast.app
AppStatus(app_id='YouTube', description='YouTube TV', state='running', options={'allowStop': 'true'}, service_url='http://192.168.1.9:8008/connection/YouTube', service_protocols=['ramp'])

>> time.sleep(1)  # sleep 1s so RAMP connection has time to init

>> ramp = cast.get_protocol(pychromecast.PROTOCOL_RAMP)
>> ramp
RampSubprotocol(Epic sax guy 10 hours, 810.4/36001, playing)

>> ramp.pause()

Websocket protocol

Most apps can be communicated with using a websocket. For their own apps Google uses the RAMP protocol to control the media and give information on current running feedback.

At this point in time the RAMP protocol is the only protocol that is implemented. Except for Netflix all major applications on the Chromecast speak the RAMP protocol (ie YouTube, Google Music, HBO, HULU).

Known issues

Since Google has opened up the Chromecast SDK not all apps seem to be reachable using the DIAL-api. Therefore not all apps are exposed via the app attribute.

pychromecast's People

Contributors

balloob avatar jaapz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.