Xbmc Launch Pnds


When I get home I will download latest pnd
Change plugin
And see what happens...
 
Caine said:
Maybe a silly question, but did you try pressing the '\' key (without the quotes)?

<edit>By the way, the action 199 called in the webserver api is toggle fullscreen</edit>
<edit2>Maybe to clarify it a bit, manually pressing '\' is the equivalent of calling xbmc.executehttpapi("Action(199)")</edit2>
I did'nt knew about the shortcut... but it dont do anything :(


xbmc.executebuiltin('System.Exec'... should also toggle fullscreen too but dont :(
 
Last edited by a moderator:
Maybe it's because xbmc is running without a window manager? I'm probably totally wrong and noobish :D

I bet if you could start xbmc in windowed mode then the minimize commands would work. maybe,,,
 
HackModford said:
Maybe it's because xbmc is running without a window manager? I'm probably totally wrong and noobish :D
Started from xfce, xbmc is running with one (no sure about minimenu)

HackModford said:
I bet if you could start xbmc in windowed mode then the minimize commands would work. maybe
yep
 
Last edited by a moderator:
LOL great...

I tried editing the plugin with your changes but I now get an error when it tries to start the launcher addon.
 
HackModford said:
LOL great...

I tried editing the plugin with your changes but I now get an error when it tries to start the launcher addon.
havee a look within :
.../pandora/appdata/xbmc/.xbmc/temp/xbmc.log

you'll found the Python error there.


Or reinstall the plugins and start again :p
 
Last edited by a moderator:
This time I manually edited it... still don't work. Can you PM me the python file you edited?

I think I messed it up... I see now that there's just two lines I should comment out with a #

xbmc.executehttpapi("Action(199)")

I decided to redownload the plugin (since I lost the original)

and got version 1.04
http://code.google.com/p/xbmc-launcher/downloads/detail?name=Launcher1.04.zip&can=2&q=

I cannot find the code line that freezes xbmc anymore :/

I'm going to install it to see if it makes a difference

Edit: my bad... that's an older version

edit
k edited py

And it launched a pnd :D

But I have no sound (I tried picodrive) and where the emulator would be black I can see xbmc in the background :/

And the controls still control xbmc (I think I forget the xbmc quit line you added)

Cool 8)

Edit: K so I added the line for xbmc to quit but it still doesn't quit :/

But I feel like we're alot closer :D

I'm gonna see if I can start an app via pnd_run as an argument...

Edit:

Oooh... when I add pnd_run as an argument for a pnd (direct standalone not the emulator launcher) I get the prompt asking me if I'm sure I want to set the clockspeed to 800 (xbmc always warns me about this) but then get put straight back into minimenu/xcfe4 (or whatever you call it)
 
Now I feel smart :p

I changed this line here

Code:
os.system("%s %s &" % (launcher["application"], launcher["args"]))

to this

Code:
 os.system("%s %s &" % (launcher["args"], launcher["application"]))

So now you can link directly to a pnd and add "pnd_run" as an argument and it will actually run a pnd

woopee!

Now I realize this isn't the best idea (if you really do want to pass an argument, but it's just a dirty hack I guess...

could I pass a command that would kill xbmc in the arg section? (Just as a temporary dirty hack?)

Edit:

So I guess all that's left to be done (for me) is

figure out why sound isn't working when launching a pnd
how to quit xbmc when launching a pnd
And how to set it up as the default GUI so when you quit your program it goes right back to xbmc (just like the xbox does)

And then in the future auto populate xbmc with pnds using libpnd so that you don't have to manually add them...
And automatically include the system apps like sd mass storage, switch gui etc. (or atleast figure out how to add them manually)

We're close guys!

Edit:

To make xbmc quit you have to replace this line

Code:
xbmc.executebuiltin("Quit")

with this

Code:
xbmc.executebuiltin("XBMC.Quit")

But it doesn't seem to actually launch the pnds now...

Edit: Okay just tested it... XBMC quits but we need to clear the framebuffer (I think) but once I start a rom (I'm testing with picodrive) everything is fine... except there's still no sound :/

Oh well... one more step closer!

Code:
       elif (sys.platform.startswith('linux')):
                    #this minimizes xbmc some apps seems to need it
                    #xbmc.executehttpapi("Action(199)")
                    os.system("%s %s &" % (launcher["args"], launcher["application"]))
                    xbmc.executebuiltin("XBMC.Quit")
                    #this brings xbmc back
                    #xbmc.executehttpapi("Action(199)")
                elif (sys.platform.startswith('darwin')):

The above code is what I have now...

I was wondering if I could add the "pnd_run " to that os.system method? That way I could keep the arguments intact

But something like this doesn't work

Code:
os.system("pnd_run %s %s &" % (launcher["application"], launcher["args"]))

Edit:

But it looks like this does work

Code:
os.system("pnd_run " + "%s %s &" % (launcher["application"], launcher["args"]))

So so far I have this now...

Code:
       elif (sys.platform.startswith('linux')):
                    #this minimizes xbmc some apps seems to need it
                    #xbmc.executehttpapi("Action(199)")
                    os.system("pnd_run " + "%s %s &" % (launcher["application"], launcher["args"]))
                    xbmc.executebuiltin("XBMC.Quit")
                    #this brings xbmc back
                    #xbmc.executehttpapi("Action(199)")
                elif (sys.platform.startswith('darwin')):

But after I make that change xbmc no longer closes? :huh:
 
HackModford said:
could I pass a command that would kill xbmc in the arg section? (Just as a temporary dirty hack?)
...
And how to set it up as the default GUI so when you quit your program it goes right back to xbmc (just like the xbox does)

Let's dissect a bit what the plugin exactly does. If you look at the code in the original script you will see the following:
Code:
    #this minimizes xbmc some apps seems to need it
    xbmc.executehttpapi("Action(199)")
    os.system("%s %s" % (launcher["application"], launcher["args"]))
    #this brings xbmc back
    xbmc.executehttpapi("Action(199)")
This performs the following three steps:
- toggle xbmc fullscreen
- launch application (and wait for it to finish)
- toggle xbmc fullscreen

When you open an xbmc plugin (i.e. in the xbmc gui) then it fires the script with some arguments, the script populates the list on screen and terminates. At this point there is no longer any plugin code running. When you select an item, the plugin fires again with different arguments and acts accordingly.

The code above waits for the application to finish to guarantee that it can still toggle back to fullscreen (by preventing the script from terminating before the application does).

Some modifications we have made is to append the & at the end of the command line. This causes the os.system call to immediately terminate and xbmc directly toggles back to fullscreen (commented out in the modified script). Finally, the script terminates.

Since the script no longer runs it is impossible at this point to take any action from within the python script. This naturally holds as well if you kill xbmc.

I see the following solutions to this:
- either we keep the original launcher script behaviour and have the script wait for the application to finish.
This requires that we can properly minimize xbmc and taskswitch to the other application. Manually () or automatically (xbmc.executebuiltin('System.Exec'... or httpapi).
This is my preferred solution, but strangely it doesn't seem to work
- we launch a wrapper script which does this for us outside of xbmc:
  • kill xbmc (this could optionally be done in the python script as well)
  • invoke run_pnd
  • restart xbmc (it would be best if it reopens the launcher plugin path)
This script should be launched such that it continues when xbmc dies (i.e. with the &)

Either way, this will fail if invoke run_pnd does not (directly or indirectly) wait for the launched application to finish as it will then restart xbmc immediately.

I don't really understand why the regular minimizing behaviour fails on the Pandora. On my media center running a bare X (XBMC can't run without X) it works just fine. Minimizing causes xbmc to go to a quarter of my screen size, I can then move my mouse over the launched application and start using it.

@sebt3
Do you plan to look into the xbmc webserver? The httpapi is used by quite a few scripts I think. It would be very nice if it worked properly.
 
Last edited by a moderator:
Caine said:
I don't really understand why the regular minimizing behaviour fails on the Pandora. On my media center running a bare X (XBMC can't run without X) it works just fine. Minimizing causes xbmc to go to a quarter of my screen size, I can then move my mouse over the launched application and start using it.
Me neither :(
From what I've read from xbmc source, to get off fullscreen, you just have to set a resolution lower than the screen size. There is even a resolution() builtin function. I tried to set the resolution to pal (lower than the pandora resolution) and nothing happened :(
The builtin command minimize, don't work either. The builtin command System.exec call minimize before starting the binaries, but it don't work...

I'm pretty sure there is something fishy in the EGL code that somehow prevent windowing XBMC but i can't get what. I've no experience with EGL so...

Caine said:
@sebt3
Do you plan to look into the xbmc webserver? The httpapi is used by quite a few scripts I think. It would be very nice if it worked properly.
I don't even know where to start :(
The log say that the webserver is successfully started and that's it. But any connection to it will hang hard (connection initiallized you can send anything you want but dont expect any answer....)
 
Last edited by a moderator:
mindlord said:
try:
Code:
os.system("pnd_run '%s %s' &" % (launcher["application"], launcher["args"]))

I tried that and xbmc does quit now but doesn't launch the pnd :(
 
Last edited by a moderator:
Have you tried using it with matchbox window manager? This is used to running and switching between full-screen app.

You might also want to think about hacking together XBMC, Matchbox and the XFCE panel, much like I did (without XBMC) here. That way you could have a multitasking XBMC-based environment.
 
Last edited by a moderator:
I'm going to try it this way now...


Code:
elif (sys.platform.startswith('linux')):
                    #this minimizes xbmc some apps seems to need it
                    #xbmc.executehttpapi("Action(199)")
                    xbmc.executebuiltin("XBMC.Minimize")
                    os.system("%s %s" % (launcher["args"], launcher["application"]))
                    #this brings xbmc back
                    #xbmc.executehttpapi("Action(199)")
                    xbmc.executebuiltin("XBMC.RestartApp")

Edit: And that sucessfully minimized XBMC :D

But sound still doesn't work on the app... and when I tried quitting (picodrive in my case) I just got nothing and had to use the pandora button to launch minimenu

Edit: Next I tried this

Code:
elif (sys.platform.startswith('linux')):
                    #this minimizes xbmc some apps seems to need it
                    #xbmc.executehttpapi("Action(199)")
                    #xbmc.executebuiltin("XBMC.Minimize")
                    os.system("%s %s" % (launcher["args"], launcher["application"]))
                    #this brings xbmc back
                    #xbmc.executehttpapi("Action(199)")
                    xbmc.executebuiltin("XBMC.Quit")

But that doesn't quit xbmc... next I'm going to try this

Code:
elif (sys.platform.startswith('linux')):
                    #this minimizes xbmc some apps seems to need it
                    #xbmc.executehttpapi("Action(199)")
                    #xbmc.executebuiltin("XBMC.Minimize")
                    os.system("%s %s" % (launcher["args"], launcher["application"]))
                    #this brings xbmc back
                    #xbmc.executehttpapi("Action(199)")
                    xbmc.executebuiltin("XBMC.Minimize")
                    xbmc.executebuiltin("XBMC.Quit")

Nope that didn't do it... I think the problem is that once the application launches the script freezes. and so I can't run the quit command (or once the app is done it does quit...

so I tried this
Code:
elif (sys.platform.startswith('linux')):
                    #this minimizes xbmc some apps seems to need it
                    #xbmc.executehttpapi("Action(199)")
                    xbmc.executebuiltin("XBMC.Minimize")
                    os.system("%s %s" % (launcher["args"], launcher["application"]))
                    #this brings xbmc back
                    #xbmc.executehttpapi("Action(199)")
                    xbmc.executebuiltin("XBMC.Minimize")

but that didn't work any better than before... I wish there was a Maximize command or something <_<
 
HackModford said:
I'm going to try it this way now...

Edit: And that sucessfully minimized XBMC :D

But sound still doesn't work on the app... and when I tried quitting (picodrive in my case) I just got nothing and had to use the pandora button to launch minimenu

Edit: Next I tried this
Sorry to say this, but it sounds a bit as if you are just guessing without having a clue of what you are actually doing.


Code:
elif (sys.platform.startswith('linux')):
                    #this minimizes xbmc some apps seems to need it
                    #xbmc.executehttpapi("Action(199)")
                    #xbmc.executebuiltin("XBMC.Minimize")
                    os.system("%s %s" % (launcher["args"], launcher["application"]))
                    #this brings xbmc back
                    #xbmc.executehttpapi("Action(199)")
                    xbmc.executebuiltin("XBMC.Quit")

But that doesn't quit xbmc... next I'm going to try this
By the looks of it, the os.system call waits for the application to finish and executes xbmc.executebuiltin only AFTER you have closed the launched application. However, because you don't minimize you cannot see the launched application and therefore cannot terminate it.

But that doesn't quit xbmc... next I'm going to try this

Code:
elif (sys.platform.startswith('linux')):
                    #this minimizes xbmc some apps seems to need it
                    #xbmc.executehttpapi("Action(199)")
                    #xbmc.executebuiltin("XBMC.Minimize")
                    os.system("%s %s" % (launcher["args"], launcher["application"]))
                    #this brings xbmc back
                    #xbmc.executehttpapi("Action(199)")
                    xbmc.executebuiltin("XBMC.Minimize")
                    xbmc.executebuiltin("XBMC.Quitp")
I would expect that to function just as the previous case, the application is launched in the background, next xbmc waits for it to terminate (which it doesn't as you can't reach the application).

Does xbmc show you the cancel dialog or does it just return to the launcher gui?
 
Last edited by a moderator:
No wait this is the current state.

I can launch a pnd

I can even minimize xbmc so that you can see the program just fine and use it just fine, but sound doesn't work.

When I try quitting the program (picodrive in my case) nothing happens.

Thus I'm trying to figure out how to maximize xbmc again.

Does that make sense?

Oh and you're right... I am guessing and don't really have much of a clue as to what to do :lol:

Edit:

Okay so I set it to this

Code:
elif (sys.platform.startswith('linux')): 
                    xbmc.executebuiltin("XBMC.Quit")
                    os.system("%s %s" % (launcher["args"], launcher["application"]))

Because I figure

1) you quit xbmc to save resources
2) plus when you quit the app if you have xbmc setup as the default launcher it should automatically relaunch it (this is how it works on an xbox also)

I have tested it and it indeed does quit xbmc, because when I quit picodrive this time minimenu reloads.

So I guess now I just need to figure out why sound isn't working on the launched app, and figure out how to setup xbmc as a gui (not the default right now though)

Edit: Maybe it's not as good as I thought... I'm having trouble launching other things.... so far I've only gotten gpsp and picodrive to run. gpsp runs very sloooww and picodrive runs great but no sound... Weird...
 
HackModford said:
No wait this is the current state.
...
Does that make sense?
Yes, that makes perfect sense.

Oh and you're right... I am guessing and don't really have much of a clue as to what to do :lol:
Haha, no problem :) It's actually a pretty decent way to learn how stuff works.

I'm kinda curious as to what state xbmc is in after execution and termination of certain parts.
When you execute the following block of code:
Code:
elif (sys.platform.startswith('linux')):
                    #this minimizes xbmc some apps seems to need it
                    #xbmc.executehttpapi("Action(199)")
                    xbmc.executebuiltin("XBMC.Minimize")
                    os.system("%s %s" % (launcher["args"], launcher["application"]))
                    #this brings xbmc back
                    #xbmc.executehttpapi("Action(199)")
                    #xbmc.executebuiltin("XBMC.RestartApp")
I'm ignoring sound issues for now, as it's my opinion that running multiple applications with sound ought to work.

You said this launched the application properly, but didn't do much after closing down the application. I commented out the xbmc.executebuiltin("XBMC.RestartApp").

Can you manually restore xbmc through your window manager at two points in time:
1) while the launched application is running
2) after closing the launched application

I'm kinda wondering what state the launched plugin is in. I would expect it to be either
- the same state as before launching (showing a list of applications it can start)
- awaiting the application to terminate (i.e. showing the cancel dialog on top of the application list)

This will give me some information as to where xbmc has gotten in the script. If you cannot manipulate xbmc through your window manager, I believe that print statements go to the xbmc log in ~/.xbmc/temp/xmbc.log

In this case, run:
Code:
                    #this minimizes xbmc some apps seems to need it
                    #xbmc.executehttpapi("Action(199)")
                    print "XBMC Launcher plugin: before minimize"
                    xbmc.executebuiltin("XBMC.Minimize")
                    print "XBMC Launcher plugin: after minimize"
                    os.system("%s %s" % (launcher["args"], launcher["application"]))
                    print "XBMC Launcher plugin: after application launch"
                    #this brings xbmc back
                    #xbmc.executehttpapi("Action(199)")
                    #xbmc.executebuiltin("XBMC.RestartApp")
Perform the same tests and check the log for both case 1) and 2)
 
Last edited by a moderator:
OK will do right now ASAP...

And yeah I can't really do anything with a windows manager. I'm using matchbox + minimenu as the default gui right now (because I can use the pnd button to quit xbmc if it hangs)
 
HackModford said:
Edit:

Okay so I set it to this

Code:
elif (sys.platform.startswith('linux')): 
                    xbmc.executebuiltin("XBMC.Quit")
                    os.system("%s %s" % (launcher["args"], launcher["application"]))
I would be very surprised if that actually launches the application as the plugin script indicates that you should first quit xbmc (which should also terminate the plugin script) and then launch the application.

If this indeed performs both, then probably executing builtins is performed by posting events which are deferred until after termination of the script.
 
Last edited by a moderator:
You don't have sound because XBMC is not releasing the sound system.
Even while quitting XBMC : You start the apps then stop XBMC. So when the app start, it try and fail to get Audio, then XBMC stop and release the audio system.
You should add some delay in the app starting.

I'm definatly surprised that you manage to minimize XBMC as my own tests didn't ended so well.

Oh and restauration function look like this :
bool CWinSystemEGL::Restore()
{
return false;
}

I'm expecting it to not work ;)
 
Back
Top