Beamer

From VoidWarranties - Hackerspace Antwerp, Belgium
Revision as of 20:44, 27 November 2014 by Bob The Builder (Talk | contribs)
Jump to: navigation, search


Beamer
What:
We have a new beamer with lot's of cool features including a webinterface. Let's have some fun!
Event.png
Participants:
Koen
Category:
Coding
Locations:
Den Bunker


Standig up to push a button went you want to turn on the beamer is a terrible amount of work. Thus having a convient script that can do this from your command line will make your life infinatly better. So here it is. Just download it and chmod it and never leave your couch spot ungarded.

#!/bin/bash

USERNAME=user1
PASSWORD=panasonic

ON=0
STANDBY=1
COOLING=2

Status=-1

StatusHTML=$(curl --silent --user $USERNAME:$PASSWORD "http://192.168.42.77/cgi-bin/proj_ctl.cgi?key=6&lang=e&osd=on")

case $StatusHTML in
	*Standby*)
		Status=$STANDBY
		;;
	*ON*)
		Status=$ON
		;;
	*Cooling*)
		Status=$COOLING
		;;
esac

case $1 in
	ON|on)
		case $Status in
			$STANDBY)
				echo "Turning beamer ON."
				#beamer on
				curl --silent --user $USERNAME:$PASSWORD "http://192.168.42.77/cgi-bin/proj_ctl.cgi?key=pow_on&lang=e&osd=on" > /dev/null
				;;
			$ON)
				echo "Beamer allready on."
				;;
			$COOLING)
				echo "Cannot turn beamer back on while it is cooling down."
				exit 1
				;;
		esac	
		;;
	OFF|off)
		case $Status in
			$STANDBY|$COOLING)
				echo "Beamer allready turned off."
				;;
			$ON)
				echo "Turning beamer OFF"
				#beamer off
				curl --silent --user $USERNAME:$PASSWORD "http://192.168.42.77/cgi-bin/proj_ctl.cgi?key=pow_off&lang=e&osd=on" > /dev/null
				;;
		esac
		;;
	STATUS|status|Status)
		case $Status in
			$STANDBY)
				echo "Beamer is off"
				;;
			$ON)
				echo "Beamer is on."
				;;
			$COOLING)
				echo "Beamer is cooling down."
				;;
		esac
		;;
	*)
		echo "VoidWarranties beamer control script"
		echo ""
		echo "To turn on the beamer run: ./beamer ON"
		echo "To turn off the beamer run: ./beamer OFF"
		echo "To display current status run: ./beamer STATUS"
		;;
esac
exit 0

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox
Content Creation
Belgian Spaces