Mac: GoogleHome通知

Contents

python-googlehome-player

https://github.com/mtatsuma/python-googlehome-player.git

を参考しながら進める。

Architecture

google_home_download_from_gtts

How to use

chen@Hong-Mac-mini Python % git clone https://github.com/mtatsuma/python-googlehome-player.git
Cloning into ‘python-googlehome-player’…
remote: Enumerating objects: 34, done.
remote: Counting objects: 100% (34/34), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 34 (delta 14), reused 28 (delta 11), pack-reused 0
Unpacking objects: 100% (34/34), done.
chen@Hong-Mac-mini Python % cd python-googlehome-player
chen@Hong-Mac-mini python-googlehome-player % ls -al

必要のパッケージのインストール

chen@Hong-Mac-mini python-googlehome-player % pip3 install -r requirements.txt
Collecting beautifulsoup4==4.8.2
  Downloading beautifulsoup4-4.8.2-py3-none-any.whl (106 kB)
     |████████████████████████████████| 106 kB 2.6 MB/s
Collecting casttube==0.2.0
  Downloading casttube-0.2.0-py3-none-any.whl (4.2 kB)
Collecting certifi==2019.11.28
  Downloading certifi-2019.11.28-py2.py3-none-any.whl (156 kB)
     |████████████████████████████████| 156 kB 13.1 MB/s
Requirement already satisfied: chardet==3.0.4 in /usr/local/lib/python3.8/site-packages (from -r requirements.txt (line 4)) (3.0.4)
Collecting Click==7.0
  Downloading Click-7.0-py2.py3-none-any.whl (81 kB)
     |████████████████████████████████| 81 kB 9.1 MB/s
Collecting gTTS==2.1.0
  Downloading gTTS-2.1.0-py3-none-any.whl (25 kB)
Collecting gTTS-token==1.1.3
  Downloading gTTS-token-1.1.3.tar.gz (3.4 kB)
Collecting idna==2.8
  Downloading idna-2.8-py2.py3-none-any.whl (58 kB)
     |████████████████████████████████| 58 kB 3.5 MB/s
Collecting ifaddr==0.1.6
  Downloading ifaddr-0.1.6.tar.gz (6.5 kB)
ERROR: Could not find a version that satisfies the requirement pkg-resources==0.0.0 (from -r requirements.txt (line 10)) (from versions: none)
ERROR: No matching distribution found for pkg-resources==0.0.0 (from -r requirements.txt (line 10))
ここでエラー発生
chen@Hong-Mac-mini python-googlehome-player % pip3 install pkg-resources
ERROR: Could not find a version that satisfies the requirement pkg-resources (from versions: none)
ERROR: No matching distribution found for pkg-resources
ネットで見つかった解決策は、pkg-resources==0.0.0 文を消すこと。

喋りする

chen@Hong-Mac-mini python-googlehome-player % python play.py
Enter language (English: en or Japanese: ja): ja
Enter Google Home name or IP: 192.168.86.106
You are ready to speak!
Start typing …
>> こんにちは
>> お元気ですか?
>> いいですね
>> bye
次は、顔認識の結果を音声で知らせる機能を作りたい。