forked from MoeFwacky/remote
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremote-functions.sh
More file actions
161 lines (134 loc) · 9.11 KB
/
remote-functions.sh
File metadata and controls
161 lines (134 loc) · 9.11 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#!/bin/bash
source remote_token.sh
function_id=$1
channel_number=$2
button_press_sound () {
aplay -q "$button_down" &
}
button_depress_sound () {
aplay -q "$button_up" &
}
reboot_all () {
curl -d '{"jsonrpc": "2.0", "method": "GUI.ShowNotification", "params": { "title": "REBOOTING ALL DEVICES", "message": "Please Stand By", "displaytime": 20000}, "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
stop_all_channels
ssh -i "$rsa" "$server_user""@""$server_ip" sudo reboot now
ssh -i "$rsa" "$client_user""@""$client_ip" reboot now
if [[ "$is_ps_remote_device" == @("Y"|"y"|"Yes"|"yes"|"YES") ]]
then
ssh -i "$rsa" "$controller_user""@""$controller_ip" -t "sudo reboot now"
fi
sudo reboot now
while [ true ]; do button_press_sound; done;
}
shutdown_all () {
curl -d '{"jsonrpc": "2.0", "method": "GUI.ShowNotification", "params": { "title": "SHUTTING DOWN", "message": "Please Stand By", "displaytime": 20000}, "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
stop_all_channels
ssh -i "$rsa" "$server_user"@"$server_ip" sudo shutdown now
ssh -i "$rsa" "$client_user"@"$client_ip" shutdown now
if [[ "$is_ps_remote_device" == @("Y"|"y"|"Yes"|"yes"|"YES") ]]
then
ssh -i "$rsa" "$controller_user"@"$controller_ip" -t "sudo shutdown now"
fi
}
reset_status_screen () {
sudo service lightdm restart
}
channel_up () {
if [[ "$is_ps_remote_device" == @("Y"|"y"|"Yes"|"yes"|"YES") ]]
then
ssh -i "$rsa" "$controller_user"@"$controller_ip" -t "cd $ps && bash nohup ./channelup.sh"
else
"$ps" && bash ./channelup.sh
fi
curl -d '{"jsonrpc": "2.0", "method": "GUI.ShowNotification", "params": { "title": "CHANNEL UP", "message": "Executing...", "displaytime": 20000}, "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
}
channel_down () {
if [[ "$is_ps_remote_device" == @("Y"|"y"|"Yes"|"yes"|"YES") ]]
then
ssh -i "$rsa" "$controller_user"@"$controller_ip" -t "cd $ps && bash nohup ./channeldown.sh"
else
cd "$ps" && bash ./channeldown.sh
fi
curl -d '{"jsonrpc": "2.0", "method": "GUI.ShowNotification", "params": { "title": "CHANNEL DOWN", "message": "Executing...", "displaytime": 20000}, "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
}
channel () {
curl -d '{"jsonrpc": "2.0", "method": "GUI.ShowNotification", "params": { "title": "'"${channel_number}"'", "message": "Starting Channel '"$channel_number"'", "displaytime": 15000}, "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
if [[ "$is_ps_remote_device" == @("Y"|"y"|"Yes"|"yes"|"YES") ]]
then
ssh -i "$rsa" "$controller_user"@"$controller_ip" -t "cd $ps && bash nohup ./manual.sh $channel_number"
else
cd "$ps" && bash ./manual.sh "$channel_number"
fi
}
rasplex_back () {
curl -d '{"jsonrpc": "2.0", "method": "GUI.ShowNotification", "params": { "title": "Button Press", "message": "BACK", "displaytime": 5000}, "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
curl -d '{"jsonrpc": "2.0", "method": "Input.Back", "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
}
rasplex_fullscreen () {
curl -d '{"jsonrpc": "2.0", "method": "GUI.ShowNotification", "params": { "title": "Button Press", "message": "FULLSCREEN", "displaytime": 5000}, "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
curl -d '{"jsonrpc": "2.0", "method": "GUI.SetFullscreen", "params": { "fullscreen": "toggle"}, "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
}
rasplex_up () {
curl -d '{"jsonrpc": "2.0", "method": "GUI.ShowNotification", "params": { "title": "Button Press", "message": "UP", "displaytime": 5000}, "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
curl -d '{"jsonrpc": "2.0", "method": "Input.Up", "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
}
rasplex_down () {
curl -d '{"jsonrpc": "2.0", "method": "GUI.ShowNotification", "params": { "title": "Button Press", "message": "DOWN", "displaytime": 5000}, "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
curl -d '{"jsonrpc": "2.0", "method": "Input.Down", "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
}
rasplex_left () {
curl -d '{"jsonrpc": "2.0", "method": "GUI.ShowNotification", "params": { "title": "Button Press", "message": "LEFT", "displaytime": 5000}, "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
curl -d '{"jsonrpc": "2.0", "method": "Input.Left", "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
}
rasplex_right () {
curl -d '{"jsonrpc": "2.0", "method": "GUI.ShowNotification", "params": { "title": "Button Press", "message": "RIGHT", "displaytime": 5000}, "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
curl -d '{"jsonrpc": "2.0", "method": "Input.Right", "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
}
rasplex_select () {
curl -d '{"jsonrpc": "2.0", "method": "GUI.ShowNotification", "params": { "title": "Button Press", "message": "SELECT", "displaytime": 5000}, "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
curl -d '{"jsonrpc": "2.0", "method": "Input.Select", "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
}
rasplex_volumeup () {
curl -d '{"jsonrpc": "2.0", "method": "Application.SetVolume", "params": { "volume": "increment"}, "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
}
rasplex_volumedown () {
curl -d '{"jsonrpc": "2.0", "method": "Application.SetVolume", "params": { "volume": "decrement"}, "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
}
rasplex_mute () {
curl -d '{"jsonrpc": "2.0", "method": "Application.SetMute", "params": { "mute": "toggle"}, "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
}
rasplex_show_info () {
curl -d '{"jsonrpc": "2.0", "method": "Input.Info", "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
}
rasplex_detail_info () {
curl -d '{"jsonrpc": "2.0", "method": "Input.ShowCodec", "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
}
rasplex_screenshot () {
curl -d '{"jsonrpc": "2.0", "method": "Input.ExecuteAction", "params": { "action": "screenshot"}, "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
curl -d '{"jsonrpc": "2.0", "method": "GUI.ShowNotification", "params": { "title": "Saved Screenshot", "message": " ", "displaytime": 1500}, "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
}
rasplex_close_dialogue () {
curl -d '{"jsonrpc": "2.0", "method": "GUI.ShowNotification", "params": { "title": "Button Press", "message": "CLOSE DIALOGUE", "displaytime": 5000}, "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
curl -d '{"jsonrpc": "2.0", "method": "Input.Home", "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
}
rasplex_audio_language () {
curl -d '{"jsonrpc": "2.0", "method": "GUI.ShowNotification", "params": { "title": "Button Press", "message": "AUDIO LANGUAGE", "displaytime": 5000}, "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
curl -d '{"jsonrpc": "2.0", "method": "Player.SetAudioStream", "params": { "playerid": 1, "stream": "next"}, "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
}
rasplex_next_subtitle () {
curl -d '{"jsonrpc": "2.0", "method": "GUI.ShowNotification", "params": { "title": "Button Press", "message": "SUBTITLE NEXT", "displaytime": 5000}, "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
curl -d '{"jsonrpc": "2.0", "method": "Input.ExecuteAction", "params": { "action": "cyclesubtitle"}, "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
}
rasplex_showsubtitles () {
curl -d '{"jsonrpc": "2.0", "method": "GUI.ShowNotification", "params": { "title": "Button Press", "message": "TOGGLE SUBTITLES", "displaytime": 5000}, "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
curl -d '{"jsonrpc": "2.0", "method": "Input.ExecuteAction", "params": { "action": "showsubtitles"}, "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
}
stop_all_channels () {
curl -d '{"jsonrpc": "2.0", "method": "GUI.ShowNotification", "params": { "title": "STOPPING PSEUDO CHANNEL", "message": "Please Stand By...", "displaytime": 5000}, "id": 1}' -H "Content-Type: application/json" -X POST http://$client_ip:3005/jsonrpc
if [[ "$is_ps_remote_device" == @("Y"|"y"|"Yes"|"yes"|"YES") ]]
then
ssh -i "$rsa" "$controller_user"@"$controller_ip" -t "cd $ps && bash nohup ./stop-all-channels.sh"
else
cd "$ps" && bash ./stop-all-channels.sh
fi
}