diff --git a/remote.sh b/remote.sh index 6173903..d508e11 100644 --- a/remote.sh +++ b/remote.sh @@ -5,11 +5,23 @@ SSH_USER="username" SSH_PASSWORD="password" SMARTTV_IP="remote_ip" SMARTTV_SCRIPT="python3 smarttv.py" +SMARTTV_OPS_REBOOT="sudo reboot" +SMARTTV_OPS_AUDIO="pacmd set-default-sink alsa_output.pci-0000_00_1f.3.hdmi-stereo" # Function to execute Python script remotely -execute_remote() { - local command="$1" - sshpass -p "$SSH_PASSWORD" ssh "$SSH_USER@$SMARTTV_IP" "$SMARTTV_SCRIPT $command" +send_command() { + local COMMAND="$1" + sshpass -p "$SSH_PASSWORD" ssh "$SSH_USER@$SMARTTV_IP" "$SMARTTV_SCRIPT" "$COMMAND" +} + +# Function to reboot OPS remotely +ops_reboot() { + sshpass -p "$SSH_PASSWORD" ssh "$SSH_USER@$SMARTTV_IP" "$SMARTTV_OPS_REBOOT" +} + +# Function to change the Audio source of the OPS +change_ops_audio() { + sshpass -p "$SSH_PASSWORD" ssh "$SSH_USER@$SMARTTV_IP" "$SMARTTV_OPS_AUDIO" } # Check if a command is provided @@ -18,5 +30,24 @@ if [ $# -eq 0 ]; then exit 1 fi -# Call the function with the provided command -execute_remote "$1" +# Call the appropriate function based on the provided command +case "$1" in + send_command) + if [ $# -lt 2 ]; then + echo "Usage: $0 send_command " + exit 1 + fi + send_command "$2" + ;; + ops_reboot) + ops_reboot + ;; + change_ops_audio) + change_ops_audio + ;; + *) + echo "Unknown command: $1" + echo "Usage: $0 [additional arguments]" + exit 1 + ;; +esac