File: test.py

package info (click to toggle)
mkchromecast 0.3.7%2Bgit20170130-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 15,260 kB
  • ctags: 419
  • sloc: python: 3,659; makefile: 48
file content (23 lines) | stat: -rw-r--r-- 682 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python

# This file is part of mkchromecast.

from __future__ import print_function
import time
import pychromecast

cast = pychromecast.get_chromecast(friendly_name="CCA")
print("Connected to Chromecast")
mc = cast.media_controller
print("Playing BigBuckBunny.mp4 (video)")
mc.play_media('http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4', 'video/mp4')
time.sleep(15)
print("Stopping video and sleeping for 5 secs")
mc.stop()
time.sleep(5)
print("Playing Canon mp3 (audio)")
mc.play_media('http://www.stephaniequinn.com/Music/Canon.mp3', 'audio/mp3')
time.sleep(15)
print("Stopping audio and quitting app")
mc.stop()
cast.quit_app()