Chromecast_DIAL
is a python library talking to a chromecast via the old DIAL
protocol.
The protocol seems poorly supported on ChromeCasts, and only allows submitting YouTube videos.
The application supports a small command line interface for querying and posting to devices on the local netowrk.
For a more feature-complete library, see pychromecast
The source code benefits heavily form pydial
.
Discover devices on the local network:
python3 -m chromecast_dial --discover
You can also interact with a single device if you know the IP:
python3 -m chromecast_dial --ip 127.0.0.2
Or work with the first device that responds:
python3 -m chromecast_dial --use-first
Post a YouTube video request on all devices:
python3 -m chromecast_dial --video Dgxz0kZ2dp4
Stop the default app (YouTube
):
python3 -m chromecast_dial --stop
Stop another app:
python3 -m chromecast_dial --stop --app Netflix
Since nothing else is supported, you will probably see No app running
.
With no arguments, the program scan the status of the default app (YouTube
) on all devices:
python3 -m chromecast_dial
You can change queried app with --app
:
python3 -m chromecast_dial --app Netflix
But you will probably get a App not found
.
A table of registered applications can be found on the DIAL registry
To only get configuration end-points, use --fast-scan
. This will not query devices for names:
python3 -m chromecast_dial --fast-scan
Here is an example script to discover the first device and submit a video to it:
from chromecast_dial import *
urls = discover(use_first=True)
cast = get_chromecasts(urls)[0]
cast.post_youtube_video('Dgxz0kZ2dp4')
This code uses the DIAL
protocol, which is not well supported, and not many feature can be provided with it.
There are a few other things that can be implemented:
- Setting video start time
&t=3m20s
, looping. - Extra device info through
/setup/eureka_info
- Restarting throught posting to
/setup/reboot -d ‘{“params”:”now”}’
There appears to be no way to pause videos with the DIAL
protocol.