Created
September 17, 2009 18:28
-
-
Save zenlor/188629 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # | |
| # | |
| # rai.tv - mplayer per rai.tv :P | |
| # | |
| #~$> ./rai.tv.sh http://www.rai.tv/dl/RaiTV/programmi/media/ContentItem-6b72f482-f5bf-4d28-bb1a-f04d1f99a984.html?p=0 | |
| # | |
| #cheers :) | |
| # | |
| PLIST= | |
| MMS= | |
| MPFLAGS='-cache 2048' | |
| function getit () | |
| { | |
| PLIST=$( | |
| wget -O - $1 2>/dev/null | \ | |
| awk '/http:\/\/mediapolis\.rai\.it\/relinker.*\=+[a-zA-Z0-9]*/{ | |
| where= match($0, /http:\/\/mediapolis\.rai\.it\/relinker.*\=+[a-zA-Z0-9]*/); | |
| strlen = length-1-where; | |
| mystr = substr($0,where,strlen); | |
| print mystr; | |
| }'); | |
| echo got my PLIST: $PLIST | |
| echo going to fetch my MMS:// | |
| MMS=$( | |
| wget -O - $PLIST 2>/dev/null | \ | |
| awk '/mms:\/\//{ | |
| foo = match($0, /mms:\/\//); | |
| bar = match($0, /\.wmv/); | |
| strlen = bar-foo+4; | |
| mystr = substr($0, foo, strlen); | |
| print mystr; | |
| }'); | |
| } | |
| while getopts 's:' OPTION | |
| do | |
| case $OPTION in | |
| s) | |
| SAVE=1 | |
| FILENAME="$OPTARG" | |
| MPFLAGS="$MPFLAGS -dumpstream -dumpfile $FILENAME " | |
| ;; | |
| ?) | |
| printf "Usage: %s: [-s filename] args\n" $(basename $0) >&2 | |
| exit 2 | |
| ;; | |
| esac | |
| done | |
| shift $(($OPTIND -1 )) | |
| ## Let's call our handy function ^^ | |
| printf "fetching and parsing the URL\n" | |
| getit $1 | |
| printf "Hello Playlist: %s\n" $MMS | |
| mplayer $(echo $MPFLAGS $MMS) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment