blob: 35e9571e91dbd8e458545c5bf20b55b19587725a (
plain) (
blame)
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
|
#!/bin/sh
if [ -z "${SSH_ORIGINAL_COMMAND}" ]; then
echo "please specify a command!"
exit 1
fi
command=$(echo "${SSH_ORIGINAL_COMMAND}" | awk '{print($1)}')
arg=$(echo "${SSH_ORIGINAL_COMMAND}" | awk '{print($2)}')
case "$command" in
list)
ls --hide "lost+found" -1 /srv/media
;;
play)
media_file="/srv/media/$(basename "$arg")"
if [ -e "$media_file" ]; then
echo '{"command": ["loadfile", "'"$media_file"'"]}' | socat - /var/lib/player/ctl.sock
else
echo "file '$media_file' not found!"
exit 1
fi
;;
stop)
echo '{"command": ["playlist-remove", "current"]}' | socat - /var/lib/player/ctl.sock
;;
*)
echo "invalid command: '$command'"
exit 1
;;
esac
|