-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_goto_media_player.sh
48 lines (37 loc) · 860 Bytes
/
example_goto_media_player.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
set -e
cd $(dirname $0)
if [ "$1" = "" ]; then
echo "Usage: $0 <TV_IP>"
exit 1
fi
if ! [ -e 'auth_cookie' ]; then
echo 'auth_cookie not found. Run ./auth.sh first.'
exit 1
fi
declare -A commandmap
commandmap[DIGITAL]="AAAAAgAAAJcAAAAyAw=="
commandmap[EXIT]="AAAAAQAAAAEAAABjAw=="
commandmap[HOME]="AAAAAQAAAAEAAABgAw=="
commandmap[DOWN]="AAAAAQAAAAEAAAB1Aw=="
commandmap[UP]="AAAAAQAAAAEAAAB0Aw=="
commandmap[LEFT]="AAAAAQAAAAEAAAA0Aw=="
commandmap[CONFIRM]="AAAAAQAAAAEAAABlAw=="
commandmap[ENTER]="AAAAAQAAAAEAAAALAw=="
tv_ip=$1
remote() {
echo -n "$1: "
./send_command.sh $tv_ip ${commandmap[$1]}
}
# get into known state
remote 'DIGITAL'
sleep 4
echo 'Waiting for TV to boot fully…'
sleep 30
remote 'HOME'
sleep 6
# select 'media player in lower left corner'
remote 'DOWN'
remote 'DOWN'
remote 'LEFT'
remote 'CONFIRM'