#!/bin/sh xset s off xset -dpms # xvdrplayer 0.0.1 (start-script for shmclient, tvtime, vdrtvtime, vdr-sxfe, xine or xineliboutput) # by Marc Wernecke - www.zulu-entertainment.de # 12.02.2009 #VDRIP=127.0.0.1 # 127.0.0.1 for localhost or any other ip for a vdr-server in your local-network #VDRPLAYER=xine # shmclient, tvtime, vdr-sxfe, xine, xineliboutput or xine-network DIALOG="Xdialog" [ -d "$HOME" -a "$HOME" != "/" ] || HOME=/etc [ -r $HOME/vdrplayer.conf ] && . $HOME/vdrplayer.conf function _vdr() { # Max waiting time in Seconds n=10 # Check if VDR is running if [ `ps -C vdr | grep -cw "vdr"` -eq 0 ]; then # test if vdr is running while [ `ps -C vdr | grep -cw "vdr"` -eq 0 ] && [ $n -gt 0 ]; do sleep 1 (( n=$n-1 )) [ $n -eq 0 ] && return 1 done fi return 0 } function _vdrip() { VDRIP=`$DIALOG --inputbox "VDR Server IP" 10 50 "127.0.0.1" 3>&1 1>&2 2>&3` [ $? != 0 ] && return 1 [ "$VDRIP" = "" ] && return 1 echo "VDRIP=$VDRIP" >> $HOME/vdrplayer.conf return 0 } function _shmclient() { CMD="--fullscreen" ShmClient $CMD return 0 } function _tvtime() { # chmod 666 /dev/rtc # echo 1024 > /proc/sys/dev/rtc/max-user-freq CMD="--fullscreen --display=$DISPLAY" tvtime $CMD sleep 2 tvtime-command MENU_EXIT return 0 } function _vdrtvtime() { # chmod 666 /dev/rtc # echo 1024 > /proc/sys/dev/rtc/max-user-freq svdrpsend.pl PLUG vdrtvtime start return 0 } function _vdrsxfe() { [ -n "$VDRIP" ] || _vdrip || return 1 CMD="--video=xv --fullscreen --post tvtime:method=LinearBlend,cheap_mode=1,pulldown=0,use_progressive_frame_flag=1" MRL="xvdr+tcp://$VDRIP" vdr-sxfe $CMD $MRL return 0 } function _xineliboutput() { [ -n "$VDRIP" ] || _vdrip || return 1 CMD="--fullscreen --hide-gui" MRL="xvdr+tcp://$VDRIP#nocache;demux:mpeg_block" xine $CMD "$MRL" return 0 } function _xine() { CMD="--fullscreen --hide-gui --post vdr --post vdr_audio" MRL="vdr:/tmp/vdr-xine/stream#demux:mpeg_pes" xine $CMD "$MRL" return 0 } function _xinenetwork() { [ -n "$VDRIP" ] || _vdrip || return 1 CMD="--fullscreen --hide-gui --post vdr --post vdr_audio" MRL="netvdr://$VDRIP#demux:mpeg_pes" xine $CMD "$MRL" return 0 } ### Main Script ############################################################################### _vdr || exit 1 # Check if VDR is running [ -n "`ps x | grep ShmClient`" ] && killall -q -9 ShmClient # If ShmClient is running, stop it [ -n "`ps x | grep tvtime`" ] && killall -q -9 tvtime # If tvtime is running, stop it [ -n "`ps x | grep vdr-sxfe`" ] && killall -q -9 vdr-sxfe # If vdr-sxfe is running, stop it [ -n "`ps cx | grep xine`" ] && killall -q -9 xine # If xine is running, stop it [ "$VDRPLAYER" = "vdrtvtime" ] && svdrpsend.pl PLUG vdrtvtime stop # Player if [ -n "$VDRPLAYER" ]; then case $VDRPLAYER in shmclient) _shmclient ;; tvtime) _tvtime ;; vdrtvtime) _vdrtvtime ;; vdr-sxfe) _vdrsxfe ;; xineliboutput) _xineliboutput ;; xine) _xine ;; xine-network) _xinenetwork ;; *) VDRPLAYER="" ;; esac fi # Dialog if [ -z "$VDRPLAYER" ]; then option=`$DIALOG --menu \ 'Aktiviere den Player, den du nutzen moechtest.' 0 0 8 \ '1' 'ShmClient (Softdevice)' \ '2' 'Tvtime (FF-Karte)' \ '3' 'vdrtvtime (tvtime als Plugin, FF-Karte)' \ '4' 'vdr-sxfe (Xineliboutput)' \ '5' 'Xine' \ '6' 'Xine (Xineliboutput)' \ '7' 'Xine-Network' 3>&1 1>&2 2>&3` [ $? != 0 ] && exit 1 VDRIP= case $option in 1) echo "VDRPLAYER=\"shmclient\"" > $HOME/vdrplayer.conf && _shmclient ;; 2) echo "VDRPLAYER=\"tvtime\"" > $HOME/vdrplayer.conf && _tvtime ;; 3) echo "VDRPLAYER=\"vdrtvtime\"" > $HOME/vdrplayer.conf && _vdrtvtime ;; 4) echo "VDRPLAYER=\"vdr-sxfe\"" > $HOME/vdrplayer.conf && _vdrsxfe ;; 5) echo "VDRPLAYER=\"xine\"" > $HOME/vdrplayer.conf && _xine ;; 6) echo "VDRPLAYER=\"xineliboutput\"" > $HOME/vdrplayer.conf && _xineliboutput ;; 7) echo "VDRPLAYER=\"xine-network\"" > $HOME/vdrplayer.conf && _xinenetwork ;; esac fi