XBMC remote control script for streams
synopsis
Xopr needed a quick way of 'zapping' through the streams of the 30C3 congress (also see no nerd left behind), so he wrote a remote control for his OpenELEC (XBMC, but it might work on RaspBMC as well) to open a predefined stream with one keypress from within a console:
CCC OPENELEC remote 1. Room one 2. Room two 4. Room G 6. Room six q. quit n. Native t. Translated Input(native): _
code
It's a bash script and uses pproximately 20x10 characters so you can place it next to your stream schedule
#!/bin/bash # IP address of Raspbian/OPENELEC/XBMC box IP=192.168.2.11 # Base stream url where [KEY] and [LANG] are replaced STREAM=rtmp://rtmp.streaming.media.ccc.de:1935/stream/saal[KEY]_[LANG]_hq LANG=native ############### if [[ $* == -h || $* == -? || $* == --help ]]; then echo -e "\tusage: $0\n\n\twill trigger openelec links for ccc\n" exit 0 fi # print menu and save cursor (menu including input is 20x10 chars) echo -en "CCC OPENELEC remote\n\n1. Room one\n2. Room two\n4. Room G\n6. Room six\nq. quit\nn. Native\nt. Translated\n\0337" while [[ $key != "q" ]]; do echo -en "\0338" # restore cursor # Clear line and print previous entry echo -en "\033[KInput($LANG): $key" read -n1 -s key case $key in 1|2|g|6) RESULT=${STREAM//'[KEY]'/$key} RESULT=${RESULT//'[LANG]'/$LANG} wget -q "http://${IP}/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22Player.Open%22,%22params%22:{%22item%22:{%22file%22:%22${RESULT}%22}}}" -O /dev/null;; n|N) LANG=native;; t|T) LANG=translated;; esac done echo -en "\0338\033[9A\033[J" # Clean up 9 lines