diff options
Diffstat (limited to 'abs/core/LinHES-system')
-rwxr-xr-x | abs/core/LinHES-system/LinHES-session | 331 | ||||
-rwxr-xr-x | abs/core/LinHES-system/PKGBUILD | 11 | ||||
-rw-r--r-- | abs/core/LinHES-system/myth_status.py | 76 | ||||
-rw-r--r-- | abs/core/LinHES-system/myth_status.sh | 3 | ||||
-rw-r--r-- | abs/core/LinHES-system/set_windowmanager.sh | 100 |
5 files changed, 515 insertions, 6 deletions
diff --git a/abs/core/LinHES-system/LinHES-session b/abs/core/LinHES-system/LinHES-session index 815c3d5..39a60b0 100755 --- a/abs/core/LinHES-system/LinHES-session +++ b/abs/core/LinHES-system/LinHES-session @@ -2,17 +2,344 @@ . /etc/profile . /etc/systemconfig +if [ -e /etc/X11/WINDOWMANAGER ] +then + . /etc/X11/WINDOWMANAGER +fi + xhost +local: xhost +127.0.0.1 xset -dpms s off + export MALLOC_CHECK_=0 -#start fluxbox + + + +# # Run any scripting that applies to special hardware. These brand-specific commands that run +# # after Tweaker will, of course, override generic or hardware-specific settings. +# SpecialHardwareCommands() { +# special_hardware_file=/myth/.special_hardware_type +# special_hardware=`cat $special_hardware_file` +# +# case $special_hardware in +# dragon*) +# sudo -E twk_audio.pl --implement digital +# sudo -E twk_dragon.pl --implement all +# ;; +# ausdragon*) +# ;; +# *) +# # there are no brand-specific commands for configuring whatever +# # special hardware the user chose +# ;; +# esac +# } + + + +. /etc/osd_cat.cfg || { + color=yellow + outline=2 + outlinecolour=black + shadow=0 + shadowcolour=black + font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*" +} + +function msg(){ + echo -e "$1" | osd_cat --pos=middle --align=center --offset=200 --delay=5 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font & +} + + +function unclutter(){ + if [ -e /etc/unclutter ] + then + . /etc/unclutter.cfg + else + idle=1 + jitter=200 + fi + + /usr/X11R6/bin/unclutter -root -idle $idle -jitter $jitter -noevents & +} + +function keylaunch(){ + if [ -f /usr/bin/keylaunch ] + then +# MHOME=`cat /etc/passwd | grep "mythtv" | cut -d":" -f6` + if [ ! -e $HOME/.keylaunchrc ] + then + echo "setting symlink for keylaunch" + ln -s /etc/keylaunchrc $HOME/.keylaunchrc + fi + /usr/bin/keylaunch & + fi + +} + + +function load_nvidia_settings(){ + lsmod |cut -f1 -d" " |grep -q nvidia + if [ $? = 0 ] + then + /usr/bin/nvidia-settings --load-config-only + fi +} + +function run_tilda(){ + + + if [ -f /usr/bin/tilda ] + then + if [ ! -e ~/.tilda/config_0 ] + then + mkdir -p ~/.tilda/ + fi + + width=`/usr/bin/xwininfo -root|grep Width | awk '{ print $2}'` + height=`/usr/bin/xwininfo -root|grep Height | awk '{ print $2}'` + center=$[width/2] + sixtypercent=`echo "scale=0; ( $width*.6) / 1" |bc` + quarter_height=`echo "scale=0; ($height*.35) /1" |bc` + + + if [ $sixtypercent -lt 700 ] + then + sixtypercent=700 + fi + + if [ $quarter_height -lt 350 ] + then + quarter_height=350 + fi + startloc=`echo "scale=0 ; (${center}-(${sixtypercent})/2) / 1" |bc` + + + sed -e "s/^max_width.*$/max_width = $sixtypercent/" \ + -e "s/^max_height.*$/max_height = $quarter_height/" \ + -e "s/^x_pos.*$/x_pos = $startloc/g" /etc/tilda_config > ~/.tilda/config_0 + + /usr/bin/tilda -h & + + fi +} + + +function mouse_move(){ + #move mouse to corner + xdotool mousemove 0 0 +} + + +function start_screensaver(){ + + if [ x"$Screensavertype" = "xgscreensaver" ] + then + gnome-screensaver & + elif [ x"$Screensavertype" = "xxscreensaver" ] + then + xscreensaver -no-splash & + fi +} + +function show_help_tip(){ + + if [ x$ShowTips = "x1" ] + then + msg "Alt+h for help" & + fi +} + +function update_apple_trailers(){ + #update apple trailers + if [[ x$RunFrontend = x1 && -f ~/.configure ]] + then + /usr/bin/php -q /usr/bin/myth_trailers_grabber > /home/mythtv/appletrailer.xml && /usr/bin/fix_aple_url.sh 2>/dev/null & + fi +} + + +function first_configure(){ + if [ x$STARTUP_STYLE = xmythvantage ] + then + first_configure_mv + else + first_configure_default + fi +} + + +function first_configure_default(){ + if [ ! $SystemType = "Frontend_only" ] + then + if [ -f ~/.configure ] + then + # Run Tweaker, which applies generic and hardware-specific settings + if [ ! -f ~/.no_meth ] + then + #remove tweaker cause it's broken and duplicates entries + #sudo -E tweaker.pl + #/bin/rm /tmp/fps # ??? clean up a temp file that will eventually be obsolete anyway + # Run any brand-specific commands, if necessary. + SpecialHardwareCommands + else + rm -f ~/.no_meth + fi + + sudo sv stop mythbackend + /usr/LH/bin/dtheme.sh + xterm -fn *18* -e sudo taskset -c 0 /usr/bin/mythtv-setup + sudo sv start mythbackend + sudo chown -R mythtv.mythtv /home/mythtv + nice -n 19 mythfilldatabase --quiet & + msg "Guide data is being loaded. \n Until this completes\n some shows will appear as unknown \n in the program guide." + rm ~/.configure + fi + fi +} + + +function first_configure_mv(){ + if [ ! $SystemType = "Frontend_only" ] + then + if [ ! -f ~/.configured ] + then + autocard.py -g & + MythVantage -b + #/root/autocard.py -g & + #/usr/local/bin/mythinstall -b + + #0 yes + #1 yes/autodetech + #2 no + STATUS=$? + if [ ! $STATUS = 2 ] + then + /usr/bin/backend_control.sh stop BE 127.0.0.1 + /usr/local/bin/mythtv-setup + /usr/bin/backend_control.sh start BE 127.0.0.1 + fi + touch ~/.configured + fi + fi +} + +function start_myth() { + if [ x"$UseMythWelcome" = "x1" ] + then + STARTCMD="/usr/bin/mythwelcome" + else + STARTCMD="/usr/bin/mythfrontend -d -l /var/log/mythtv/mythfrontend.log" + fi + + echo "=====================================================================" + echo "Starting $STARTCMD" + firstboot.sh & + + #continue on with starting mythtv + + if [ x$STARTUP_STYLE = xmythvantage ] + then + start_myth_mv + else + start_myth_default + fi + + } + + +function start_myth_default(){ + + if [ -f /tmp/nomfe ] + then + exit 0 + else + if [ -f /tmp/debug ] + then + echo "using gbd/debug" + gdb /usr/bin/mythfrontend -x $MV_ROOT/mfegdbcommands.txt + mv gdb.txt gdb.txt.mythfrontend + sleep 10 + else + killall -9 irexec + /usr/bin/irexec -d + $STARTCMD 2>&1 & + fi + fi + + + + +} + + +function start_myth_mv(){ + + while [ x = x ] + do + if [ -f /tmp/nomfe ] + then + sleep 120 + else + if [ -f /tmp/debug ] + then + + echo "using gbd/debug" + gdb /usr/local/bin/mythfrontend -x $MV_ROOT/mfegdbcommands.txt + bash -c "osdClient.pl localhost 5000 'Restart: mdb.txt.mythfrontend:::SYS' "& + mv gdb.txt gdb.txt.mythfrontend + sleep 10 + + else + killall -9 irexec + /usr/bin/irexec & + $STARTCMD 2>&1 + fi + fi + echo "_______________________________________________________" + done + + + } + + +function set_background() +{ + echo "Setting the background" + + } + + if [ x$WM = "x" ] then fluxbox > /var/log/fluxbox.log 2>&1 else - $WM 2>&1 + #if using mythvantage style, start the WM right away + # this is done so that starting mythtv can loop. + + if [ x$STARTUP_STYLE = xmythvantage ] + then + $WM & + fi + mouse_move + keylaunch + set_background + unclutter + load_nvidia_settings + run_tilda + start_screensaver + show_help_tip + #update_apple_trailers + first_configure + start_myth + + # start windowmanger + if [ x$STARTUP_STYLE != xmythvantage ] + then + $WM + fi + fi diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD index 9baad6e..df31953 100755 --- a/abs/core/LinHES-system/PKGBUILD +++ b/abs/core/LinHES-system/PKGBUILD @@ -1,14 +1,14 @@ pkgname=LinHES-system pkgver=2 -pkgrel=7 +pkgrel=11 arch=('i686') MVDIR=$startdir/pkg/usr/LH BINDIR=$startdir/pkg/usr/bin install=LinHES.install pkgdesc="scripts and things related to having an automated system" -depends=(linhes-sounds xdotool fluxbox windowmaker) +depends=(linhes-sounds xdotool fluxbox tilda keylaunch python_aosd) backup=(etc/modprobe.d/alsa-base) -binfiles="LinHES-start optimize_mythdb.py myth_mtc.py myth_mtc.sh LinHES-run firstboot.sh load-modules-mythvantage.sh unclutter-toggle.sh tvterm.sh myth_mtc.lr smolt.cron mythfrontend-start" +binfiles="LinHES-start optimize_mythdb.py myth_mtc.py myth_mtc.sh LinHES-run firstboot.sh load-modules-mythvantage.sh unclutter-toggle.sh tvterm.sh myth_mtc.lr smolt.cron mythfrontend-start set_windowmanager.sh myth_status.py myth_status.sh" source=(LinHES-session LinHES-profile.sh $binfiles alsa-base) @@ -37,7 +37,7 @@ build() { mkdir $startdir/pkg/etc/logrotate.d cp $startdir/myth_mtc.lr $startdir/pkg/etc/logrotate.d } -md5sums=('c5f31e92bd94ffd8c5c67e544bbffd07' +md5sums=('2836a90e5d191faae80fad37025a5c9b' '5881bdb43d578ec3a79d1f77ea58a3db' 'a875ee97f86e46f34a741c2bc455f894' '76b2637cac0452b3acdbeeb4e8a5474b' @@ -51,4 +51,7 @@ md5sums=('c5f31e92bd94ffd8c5c67e544bbffd07' 'f1870a9522c79e6b248fcbf81dec3280' 'abe887472a170bd1a8e6da6a7b7e93e4' '752488eb8bfb672ce0e4c924f7faf3d1' + 'dae4dfb638b11c8c79fb1424a60b762a' + '361bf81a6a117d61c3bc32dda91c4cb9' + 'ce72aad1fc66c575f863d4bfbf65ce16' 'eb879fee9603a05d5420d4ce8ed9e450') diff --git a/abs/core/LinHES-system/myth_status.py b/abs/core/LinHES-system/myth_status.py new file mode 100644 index 0000000..ce95c3e --- /dev/null +++ b/abs/core/LinHES-system/myth_status.py @@ -0,0 +1,76 @@ +#!/usr/bin/python2 +from MythTV import MythBE,MythDB,MythLog +import datetime,time,sys +try: + be=MythBE() + db = MythDB() +except: + print "Couldn't connect to MythTV service for status" + sys.exit(1) + +cursor = db.cursor() +now = datetime.datetime.now() +next_start_diff=0 + +def formatTD(td): + hours = td.seconds // 3600 + minutes = (td.seconds % 3600) // 60 + seconds = td.seconds % 60 + return '%s hours, %s minutes, %s seconds' % (hours, minutes, seconds) + + + +a=be.getRecorderList() +header="#"*60 +print header +print "\n" +print "Tuner Status: " +print "--------------" +for i in a: + cmd="select cardtype,hostname from capturecard where cardid=%s;" %i + + cursor.execute(cmd) + results=cursor.fetchall() + type = results[0][0] + hostname = results[0][1] + id = i + c=be.getCurrentRecording(i) + if c.title == None: + current_recording = "Idle" + else: + current_recording = "Recording %s" %c.title + print " Tuner %s (%s) on %s : %s " %(id, type, hostname, current_recording) + +print "" +print "Upcoming Recordings:" +print "--------------------" +a=be.getUpcomingRecordings() +for i in a: + title_chan="%s (%s)" %(i.title, i.channame) + print " %s - %s - %-50s " %(i.starttime,i.hostname, title_chan) + #start_time=time.strptime(str(i.starttime), "%Y-%m-%d %H:%M:%S") + + diff = i.starttime - now +# print diff.seconds + if diff.seconds < next_start_diff or next_start_diff == 0: + next_start_diff = diff.seconds + +print " " +print "Conflicted Recordings:" +print "----------------------" +a=be.getConflictedRecordings() +for i in a: + title_chan="%s (%s)" %(i.title, i.channame) + print " %s - %-50s " %(i.starttime,title_chan) + +print "" +print "" +if next_start_diff == 0: + ur="No recordings are scheduled" +else: + d=(datetime.timedelta(seconds=next_start_diff)) + ur=formatTD(d) +print "The next recording starts in:\n %s" %(ur) + + + diff --git a/abs/core/LinHES-system/myth_status.sh b/abs/core/LinHES-system/myth_status.sh new file mode 100644 index 0000000..bc986ec --- /dev/null +++ b/abs/core/LinHES-system/myth_status.sh @@ -0,0 +1,3 @@ +#!/bin/bash +MYTHCONFDIR=/usr/share/mythtv /usr/LH/bin/myth_status.py + diff --git a/abs/core/LinHES-system/set_windowmanager.sh b/abs/core/LinHES-system/set_windowmanager.sh new file mode 100644 index 0000000..5c1150d --- /dev/null +++ b/abs/core/LinHES-system/set_windowmanager.sh @@ -0,0 +1,100 @@ +#!/bin/bash +# Script to change the windowmanger used when starting the frontend. +# If a style is given, it will change which & how programs will start. +# +# +windowmanager="$1" +style="$2" + + +function outmsg(){ + echo + echo "Changing windowmanger to $1" + } + +function stylemsg(){ + echo "Startup path will use $1 style" + } + +if [ x$windowmanager = x ] +then + echo + echo "Usage: " + echo " set_windowmanger.sh WINDOWMANAGER STARTUP_STYLE" + echo + echo "Valid WINDOWMANAGER options are:" + echo " default" + echo " enlightenment" + echo " fluxbox" + echo " windowmaker" + echo " place_custom_startup_here" + echo + echo "Valid STARTUP_STYLE options are:" + echo " default" + echo " mythvantage" + echo + echo "If STARTUP_STYLE is not given, then the default will be used." + echo + echo "Example: " + echo " set_windowmanger.sh enlightenment mythvantage" + echo + + + exit 0 +fi + + +case ${windowmanager} in + + default) + outmsg "default/fluxbox" + outline="fluxbox" + echo "" > /etc/X11/WINDOWMANAGER + exit 0 + ;; + + enlightenment) + outmsg "enlightenment" + outline="e16 -P /data/e16_config_dir/" + ;; + + windowmaker) + outmsg "window maker" + outline_2="export GNUSTEP_USER_ROOT=/data/GNUstep" + + outline="wmaker" + ;; + + *) + outline=$windowmanager + outmsg "$outline" + ;; + +esac + + + +case ${style} in + + mythvantage) + + STYLE="mythvantage" + stylemsg MythVantage + ;; + *) + STYLE="$style" + stylemsg "Default" + ;; + +esac + + +echo WM=\"${outline}\" > /etc/X11/WINDOWMANAGER +echo "STARTUP_STYLE=$STYLE" >> /etc/X11/WINDOWMANAGER +echo ${outline_2} >> /etc/X11/WINDOWMANAGER + + + + + + |