#!/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 exec ./play "$media_file" else echo "file '$media_file' not found!" exit 1 fi ;; stop) killall mpv ;; *) echo "invalid command: '$command'" exit 1 ;; esac