Skip to content

Instantly share code, notes, and snippets.

@tsu-nera
Last active February 9, 2018 14:56
Show Gist options
  • Save tsu-nera/9eb3718e70cb3c8adce71ab8f6523528 to your computer and use it in GitHub Desktop.
Save tsu-nera/9eb3718e70cb3c8adce71ab8f6523528 to your computer and use it in GitHub Desktop.
google-homeで時報
import pychromecast
def play_mp3(mp3_url):
cast.wait()
mc = cast.media_controller
mc.play_media(mp3_url, 'audio/mp3')
mc.block_until_active()
chromecast_name = "つーねらの部屋"
chromecasts = pychromecast.get_chromecasts()
cast = next(cc for cc in chromecasts if cc.device.friendly_name == chromecast_name)
play_mp3("https://ultra.zone/file/jihou-sine-3f.mp3")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment