Skip to content

Instantly share code, notes, and snippets.

@dardo82
Last active September 24, 2015 18:20
Show Gist options
  • Save dardo82/9cbdeac78de35ebc9466 to your computer and use it in GitHub Desktop.
Save dardo82/9cbdeac78de35ebc9466 to your computer and use it in GitHub Desktop.
RAIreplay on AppleTV
#!/bin/sh
echo "Che trasmissione vuoi vedere?"
read SHOW
echo "Su che canale?"
read CHAN
echo "Quanti giorni fa è stata trasmessa?"
read DAYS
DATE=$(date -v-${DAYS}d +%Y_%m_%d)
JSON="http://www.rai.it/dl/portale/html/palinsesti/replaytv/static/${CHAN}_$DATE.html"
H264=$(curl -s $JSON | grep -A7 -m2 "$SHOW" | grep \"h264\" | cut -d\" -f4)
MP4=$(curl -s -I $H264 | grep mp4 | cut -d\ -f2 | tr -d \\r)
URLENC=$(curl -s -G -w %{url_effective} --data-urlencode $MP4 "" | cut -c 3-)
open "airflick://"; sleep 10
open "airflick://play-media?MediaLocation=$URLENC"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment