Skip to content

Instantly share code, notes, and snippets.

@neuro-sys
Last active November 8, 2019 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neuro-sys/90128e67f162562fa64cb62c528594fa to your computer and use it in GitHub Desktop.
Save neuro-sys/90128e67f162562fa64cb62c528594fa to your computer and use it in GitHub Desktop.
Screencast to AirPlay from Linux
#!/bin/bash
# Install avahi suite and make sure avahi-daemon is running
# Script will try to download airplay.jar jmdns.jar into /usr/local/lib, from
# https://github.com/jamesdlow/open-airplay/
if [[ ! -f "/usr/local/lib/airplay.jar" ]]; then
sudo curl -o /usr/local/lib/airplay.jar -O -L https://github.com/jamesdlow/open-airplay/releases/download/0.1.1/airplay.jar
fi;
if [[ ! -f "/usr/local/lib/jmdns.jar" ]]; then
sudo curl -o /usr/local/lib/jmdns.jar -O -L https://github.com/jamesdlow/open-airplay/blob/master/Java/lib/jmdns.jar
fi;
function do_scan() {
echo "Scanning..."
avahi-browse _airplay._tcp --resolve
}
function do_connect() {
echo "Connecting to $1"
java -cp "/usr/local/lib/airplay.jar:/usr/local/lib/jmdns.jar" com.jameslow.AirPlay -h $1:7000 -d
}
while true; do
case $1 in
scan)
do_scan
exit
;;
connect)
do_connect $2
exit
;;
*)
printf "Usage: $0 command\n"
printf "Command:\n"
printf " $0 scan Scans available devices in network\n"
printf " $0 connect [ip-address] Streams\n"
exit
;;
esac
shift
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment