LinHES Forums
http://forum.linhes.org/

Hulu script to kill screensaver
http://forum.linhes.org/viewtopic.php?f=24&t=20997
Page 1 of 1

Author:  Too Many Secrets [ Tue Apr 13, 2010 9:35 pm ]
Post subject:  Hulu script to kill screensaver

I couldn't get the screensaver to ever play nice with Hulu. Whatever I did, I'd get a blank screen while watching Hulu. So I found this and modified as below to pkill xscreensaver and then restart after closing huludesktop. Works a charm. Just copy the script, put in /usr/LH/bin/, chmod 755 and change the default Hulu "button" to call this mythhulu.sh script and enjoy! (There is still probably some 'junk dna' in the script, so feel free to improve as needed.)

mythhulu.sh

Code:
nosaver() {
# Make sure the screensaver is stoped
pkill xscreensaver
PID=$!
echo "$PID" >"$LOCK"
}


do_cleanup() {
# Simple cleanup function
kill -9 $(cat "$LOCK")
rm -f "$LOCK"
/usr/bin/xscreensaver -no-splash &
}

## Trap exit signals for cleanup
trap "{ do_cleanup ; exit 0; }" EXIT

##  Lets create/check a lockfile
LOCK=/tmp/mythhulu.lock
if [ -f "$LOCK" ]; then
  # Another instance is running. Lets confirm
  # Start with a short sleep incase a instance is still being loaded
  sleep 3
  HULU="$(ps ax |grep hulu |grep -v "grep")"
  if [ -n "$HULU" ]; then
    # A Hulu process was detected
    exit 0
  else
    # Stale lock file. Retouch
    rm -f "$LOCK"
    touch "$LOCK"
  fi
else
  touch "$LOCK"
fi


## Nope - Dont blank my TV shows ;-)
nosaver


## If xautomation tools are installed use then to
## move mouse far far off screen
CHECK_XTE=$(which xte)
[ -n "$CHECK_XTE" ] && xte 'mousemove 1000 1000'


##  Start HuluDesktop with elevated priority then exit
##  with its status
HULU_PRIO=0
nice -n $HULU_PRIO /usr/bin/huludesktop
exit $?


/usr/share/mythtv/is.xml

Code:
<mythmenu name="Internet Steams">
<button>
<type>STREAM</type>
<text>Hulu Desktop</text>
<action>EXEC /usr/LH/bin/mythhulu.sh</action>
</button>

</mythmenu>

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/