|
1 | | -# Chromecast |
2 | | - |
3 | | -Implements a basic number of the google chromecast commands. Other than the basic commands, it also allows you to play media files from your computer either individually or in a playlist; the `playlist` command will look at all the files in a folder and play them sorted by numerically. |
4 | | - |
5 | | -## Media Content Playable |
6 | | - |
7 | | -Can play / load a local media file on your chromecast. |
8 | | - |
9 | | -``` |
10 | | -Supported Media formats: |
11 | | - - MP3 |
12 | | - - AVI |
13 | | - - MKV |
14 | | - - MP4 |
15 | | - - WebM |
16 | | - - FLAC |
17 | | -``` |
18 | | - |
19 | | -If an unknown file is found, it will use `ffmpeg` to transcode it to MP4, and stream it to the chromecast. |
20 | | - |
21 | | -## Play Local Media Files |
22 | | - |
23 | | -We are able to play local media files by creating a http server that will stream the media file to the cast device. |
24 | | - |
25 | | -## Cast DNS Lookup |
26 | | - |
27 | | -A DNS multicast is used to determine the Chromecast and Google Home devices. |
28 | | - |
29 | | -The cast DNS entry is also cached, this means that if you pass through the device name, `-n <name>`, or the |
30 | | -device uuid, `-u <uuid>`, the results will be cached and it will connect to the chromecast device instanly. |
31 | | - |
32 | | -## Usage |
33 | | -``` |
34 | | -# View available cast devices. |
35 | | -$ go-chromecast ls |
36 | | -Found 2 cast devices |
37 | | -1) device="Chromecast" device_name="MarieGotGame?" address="192.168.0.115:8009" status="" uuid="b380c5847b3182e4fb2eb0d0e270bf16" |
38 | | -2) device="Google Home Mini" device_name="Living Room Speaker" address="192.168.0.52:8009" status="" uuid="b87d86bed423a6feb8b91a7d2778b55c" |
39 | | -
|
40 | | -# Status of a cast device. |
41 | | -$ go-chromecast status |
42 | | -Found 2 cast dns entries, select one: |
43 | | -1) device="Chromecast" device_name="MarieGotGame?" address="192.168.0.115:8009" status="" uuid="b380c5847b3182e4fb2eb0d0e270bf16" |
44 | | -2) device="Google Home Mini" device_name="Living Room Speaker" address="192.168.0.52:8009" status="" uuid="b87d86bed423a6feb8b91a7d2778b55c" |
45 | | -Enter selection: 1 |
46 | | -Idle (Backdrop), volume=1.00 muted=false |
47 | | -
|
48 | | -# Specify a cast device name. |
49 | | -$ go-chromecast status -n "Living Room Speaker" |
50 | | -Idle, volume=0.17 muted=false |
51 | | -
|
52 | | -# Specify a cat device by ip address. |
53 | | -$ go-chromecast status -a 192.168.0.52 |
54 | | -Idle, volume=0.17 muted=false |
55 | | -
|
56 | | -# Specify a cast device uuid. |
57 | | -$ go-chromecast status -u b87d86bed423a6feb8b91a7d2778b55c |
58 | | -Idle (Default Media Receiver), volume=0.17 muted=false |
59 | | -
|
60 | | -# Load a local media file (can play both audio and video). |
61 | | -$ go-chromecast load ~/Downloads/SampleAudio_0.4mb.mp3 |
62 | | -Found 2 cast dns entries, select one: |
63 | | -1) device="Chromecast" device_name="MarieGotGame?" address="192.168.0.115:8009" status="" uuid="b380c5847b3182e4fb2eb0d0e270bf16" |
64 | | -2) device="Google Home Mini" device_name="Living Room Speaker" address="192.168.0.52:8009" status="" uuid="b87d86bed423a6feb8b91a7d2778b55c" |
65 | | -Enter selection: 2 |
66 | | -
|
67 | | -# Status of cast device running an audio file. |
68 | | -$ go-chromecast status |
69 | | -Found 2 cast dns entries, select one: |
70 | | -1) device="Chromecast" device_name="MarieGotGame?" address="192.168.0.115:8009" status="" uuid="b380c5847b3182e4fb2eb0d0e270bf16" |
71 | | -2) device="Google Home Mini" device_name="Living Room Speaker" address="192.168.0.52:8009" status="Default Media Receiver" uuid="b87d86bed423a6feb8b91a7d2778b55c" |
72 | | -Enter selection: 2 |
73 | | -Default Media Receiver (PLAYING), unknown, time remaining=8s/28s, volume=1.00, muted=false |
74 | | -
|
75 | | -# Play a playlist of media files. |
76 | | -$ go-chromecast playlist ~/playlist_test/ -n "Living Room Speaker" |
77 | | -Attemping to play the following media: |
78 | | -- /home/jonathan/playlist_test/SampleAudio_0.4mb.mp3 |
79 | | -- /home/jonathan/playlist_test/sample_1.mp3 |
80 | | -
|
81 | | -# Select where to start a playlist from. |
82 | | -$ go-chromecast playlist ~/playlist_test/ -n "Living Room Speaker" --select |
83 | | -Will play the following items, select where to start from: |
84 | | -1) /home/jonathan/playlist_test/SampleAudio_0.4mb.mp3: last played "2018-11-25 11:17:25 +0000 GMT" |
85 | | -2) /home/jonathan/playlist_test/sample_1.mp3: last played "2018-11-25 11:17:28 +0000 GMT" |
86 | | -Enter selection: 2 |
87 | | -Attemping to play the following media: |
88 | | -- /home/jonathan/playlist_test/sample_1.mp3 |
89 | | -
|
90 | | -# Start a playlist from the start, ignoring if you have previously played that playlist. |
91 | | -$ go-chromecast playlist ~/playlist_test/ -n "Living Room Speaker" --continue=false |
92 | | -
|
93 | | -# Pause the playing media. |
94 | | -$ go-chromecast pause |
95 | | -
|
96 | | -# Continue playing the currently playing media. |
97 | | -$ go-chromecast play |
98 | | -
|
99 | | -# Play the next item in a playlist. |
100 | | -$ go-chromecast next |
101 | | -
|
102 | | -# Play the previous item in a playlist. |
103 | | -$ go-chromecast previous |
104 | | -
|
105 | | -# Rewind the currently playing media by x seconds. |
106 | | -$ go-chromecast rewind 30 |
107 | | -
|
108 | | -# Go forward in the currently playing media by x seconds. |
109 | | -$ go-chromecast seek 30 |
110 | | -
|
111 | | -# View what a cast device is sending out. |
112 | | -$ go-chromecast watch |
113 | | -``` |
114 | | - |
115 | | -## Playlist |
116 | | - |
117 | | -There is support for playing media items as a playlist. |
118 | | - |
119 | | -If playing from a playlist, you are able to pass though the `--select` flag, and this will allow you to select |
120 | | -the media to start playing from. This is useful if you have already played some of the media and want to start |
121 | | -from one you haven't played yet. |
122 | | - |
123 | | -A cache is kept of played media, so if you are playing media from a playlist, it will check to see what |
124 | | -media files you have recently played and play the next one from the playlist. `--continue=false` can be passed |
125 | | -through and this will start the playlist from the start. |
126 | | - |
127 | | -## Watching a Device |
128 | | - |
129 | | -If you would like to see what a device is sending, you are able to `watch` the protobuf messages being sent from your device: |
130 | | - |
131 | | -``` |
132 | | -$ go-chromecast watch |
133 | | -``` |
134 | | - |
135 | | -### Text To Speech |
136 | | - |
137 | | -Experimental text-to-speech support has been added. This uses (Google |
138 | | -Cloud's Text-to-Speech)[https://cloud.google.com/text-to-speech/] to |
139 | | -turn text into an mp3 audio file, this is then streamed to the device. |
140 | | - |
141 | | -Text-to-speech api needs to be enabled https://console.cloud.google.com/flows/enableapi?apiid=texttospeech.googleapis.com and a google service account is required https://console.cloud.google.com/apis/credentials/serviceaccountkey |
142 | | - |
143 | | -``` |
144 | | -$ go-chromecast tts <message> --google-service-account=/path/to/service/account.json |
145 | | -``` |
146 | | - |
147 | | - |
148 | | -## User Interface |
149 | | - |
150 | | - |
151 | | - |
152 | | -A basic terminal user-interface is provided, that supports the following controls: |
153 | | -* Quit: "q" |
154 | | -* Play/Pause: SPACE |
155 | | -* Volume: - / + |
156 | | -* Mute/Unmute: "m" |
157 | | -* Seek (15s): <- / -> |
158 | | -* Previous/Next: PgUp / PgDn |
159 | | -* Stop: "s" |
160 | | - |
161 | | -It can be run in the following ways: |
162 | | - |
163 | | -### Standalone |
164 | | - |
165 | | -If you just want to remote-control a chromecast that is already playing something: |
166 | | - |
167 | | -``` |
168 | | -$ go-chromecast ui |
169 | | -``` |
170 | | - |
171 | | -### Playlist |
172 | | - |
173 | | -Use the UI in combination with the `playlist` command (detailed above): |
174 | | - |
175 | | -``` |
176 | | -$ go-chromecast --with-ui playlist /path/to/directory |
177 | | -``` |
178 | | - |
179 | | -### Load |
180 | | - |
181 | | -Use the UI in combination with the `load` command (detailed above): |
182 | | - |
183 | | -``` |
184 | | -$ go-chromecast --with-ui load /path/to/file.flac |
185 | | -``` |
186 | | - |
187 | | -## Installing |
188 | | - |
189 | | -### Install binaries |
190 | | -https://github.com/vishen/go-chromecast/releases |
191 | | - |
192 | | -### Install the usual Go way: |
193 | | - |
194 | | -``` |
195 | | -$ go get -u github.com/vishen/go-chromecast |
196 | | -``` |
197 | | - |
198 | | -## Commands |
199 | | - |
200 | | -``` |
201 | 1 | Control your Google Chromecast or Google Home Mini from the |
202 | 2 | command line. |
203 | 3 |
|
204 | 4 | Usage: |
| 5 | + go-chromecast [flags] |
205 | 6 | go-chromecast [command] |
206 | 7 |
|
207 | 8 | Available Commands: |
@@ -229,10 +30,10 @@ Flags: |
229 | 30 | -n, --device-name string chromecast device name |
230 | 31 | --disable-cache disable the cache |
231 | 32 | -h, --help help for go-chromecast |
232 | | - -i, --iface string Network interface to use |
| 33 | + -i, --iface string Network interface to use when looking for a local address to use for the http server |
233 | 34 | -p, --port string Port of the chromecast device if 'addr' is specified (default "8009") |
234 | 35 | -u, --uuid string chromecast device uuid |
| 36 | + -v, --version display command version |
235 | 37 | --with-ui run with a UI |
236 | 38 |
|
237 | 39 | Use "go-chromecast [command] --help" for more information about a command. |
238 | | -``` |
0 commit comments