Difference between revisions of "XBMC remote control script for streams"
(updated script: added language and quality) |
(projectified page) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | {{Project | ||
+ | |State=Completed | ||
+ | |Members=xopr | ||
+ | |Description=Automate stuff | ||
+ | }} | ||
=== synopsis === | === synopsis === | ||
[[User:Xopr|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: | [[User:Xopr|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: | ||
Line 14: | Line 19: | ||
=== code === | === code === | ||
− | It's a bash script and uses | + | It's a bash script and uses approximately 20x10 characters so you can place it next to your stream schedule |
<pre> | <pre> | ||
− | |||
#!/bin/bash | #!/bin/bash | ||
# IP address of Raspbian/OPENELEC/XBMC box | # IP address of Raspbian/OPENELEC/XBMC box |
Latest revision as of 11:04, 31 August 2015
Project: XBMC remote control script for streams | |
---|---|
Featured: | |
State | Completed |
Members | xopr |
GitHub | No GitHub project defined. Add your project here. |
Description | Automate stuff |
Picture | |
No project picture! Fill in form Picture or Upload a jpeg here |
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 x. exit l. Language q. Quality Input(n:hq): _
code
It's a bash script and uses approximately 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]_[QUALITY] LANG=native MENU_LANG=n QUALITY=hq MENU_QUALITY=hq # ld hq hd ############### 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\nx. exit\nl. Language\nq. Quality\n\0337" while [[ $KEY != "x" ]]; do echo -en "\0338" # restore cursor # Clear line and print previous entry echo -en "\033[KInput($MENU_LANG:$MENU_QUALITY): $KEY" read -n1 -s KEY case $KEY in 1|2|g|6) RESULT=${STREAM//'[KEY]'/$KEY} RESULT=${RESULT//'[LANG]'/$LANG} RESULT=${RESULT//'[QUALITY]'/$QUALITY} 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;; l|L) if [[ $MENU_LANG == n ]]; then LANG=translated;MENU_LANG=t else LANG=native;MENU_LANG=n fi;; q|Q) if [[ $MENU_QUALITY == hd ]]; then QUALITY=lq;MENU_QUALITY=lq elif [[ $MENU_QUALITY == lq ]]; then QUALITY=hq;MENU_QUALITY=hq else QUALITY=hd;MENU_QUALITY=hd fi;; x|X) break;; *) KEY=;; esac done echo -en "\0338\033[9A\033[J" # Clean up 9 lines