Thread Rating:
  • 0 Vote(s) - 0 Average
[LINUX] Simple Python help needed to open / close Hulu Desktop?
Hey all -

After several days of frustration, I'm finally throwing in the towel and reaching out to the XBMC forum for a bit of programming help.

Basically, I'm hoping to recreate SophT's mod (which I was successfully able to do on my Windows 7 machine) using only Python scripts. As you can see, he used AHK files which aren't available in Linux.

What I need is a Python script that does the following:

- Upon click, launches Hulu Desktop
- After Hulu Desktop is opened, closes XBMC
- Waits until it recognizes Hulu Desktop is closed
- When Hulu Desktop is closed, runs XBMC

I have already modified my favorite skin (Alaska) to change "Programs" to read "Hulu Desktop" and successfully launch the following Python script:

Quote:import os

The problem is, this only opens Hulu Desktop and leaves XBMC running in the background. Not only does this hog CPU cycles on my little Acer Aspire Revo 1600, but it means that the remote button presses are being registered in XBMC, causing all kinds of havoc. And sadly, I don't know enough Python to be able to perform the tasks I want and my search throughout the internet has gotten me no where.

Any solutions and/or a nicely written script I can copy/paste? Big Grin
I'm sure there's a better solution out there, but I use irexec to kill xbmc and launch huludesktop. I'm pretty sure you'll need a window manager for this, and I use fluxbox. So with irexec running, I use the color buttons of my MCE style remote to run scripts like /usr/local/bin/yellowHulu
killall xbmc.bin
killall Boxee
killall firefox
killall huludesktop
killall npviewer.bin
sleep 1
huludesktop -f &

And I added this section to ~/.lircrc
        remote = mceusb
        button = Yellow
        prog   = irexec
        repeat = 0
        config = yellowHulu

I edited ~/.fluxbox/startup to launch a program called irexecstart which contains

#test to see if an instance of irxevent is already running

if ps -ef|grep -v grep|grep irexec
# do nothing
echo IRexec is running

# start irexec
irexec -d &


And of course there is a similar set which kills huludesktop and starts XBMC.
Forgot to mention that I'm running XBMC on top of Ubuntu 9.10 Wink So the window manager aspect is covered.

And while this is a great way to launch Hulu Desktop and kill XBMC using a dedicated button on the remote, the goal is to modify the skin so that upon click it will automatically run a script (aka seamless integration with XBMC).

I decided to change my approach and write a Python script which then calls an executable Bash code:

import subprocess
def app():"/home/xbmc/.xbmc/", executable="bash", shell=True)

if __name__ == '__main__':

^^ This calls which I made executable by chmod +x

fuction func1
    killall xbmc.bin
    sleep 1
    huludesktop &


This successfully kills XBMC, waits 1 second, then launches Hulu Desktop (halfway there!). Now does anyone know the how I can get the Bash script to wait for Hulu Desktop to close and relaunch XBMC?

killall xbmc.bin
sleep 2
xbmc &

Here, just do this to wait for hulu to finish and then launch xbmc. This script works fine if launched from the command line.

I'm having problems launching the bash script from a plugin. I have put the python, bash script and a .tbn file into a folder to make a plugin but when it is launched the xbmc plugin screen stays visible and I can't see hulu. (Hulu does work and xbmc isn't running, but the display is frozen.)

I will report back if I find out what is causing this, until then input is welcomed.
is there a crash log telling you anything?

how are you launching the initial python script? as far as i know, xbmc launches python plugins using its own internal python.

so maybe the bash script is getting killed because it kills its parent, your plugin, by killing xbmc. does that make sense? if not already, it might be worth launching the bash script using the program launcher so it won't die when xbmc's python engine dies.
I use the instructions here
It even works without a desktop loaded (I autolaunch xbmc using startx and a modified .xiniitc)

[LINUX] Simple Python help needed to open / close Hulu Desktop?00