Xbmc Launch Pnds


HackModford

Active Member
Joined
Oct 2, 2007
Messages
813
Age
33
Okay I'm going to try and get my hands dirty and do this...

this is the plugin that can launch stuff
http://code.google.com/p/xbmc-launcher/

It says it can launch a file with arguments...

So my question is this.

What arguments are needed to actually launch a PND?

Edit: Just tried looking at the source and I really have no idea what I'm doing :p

It's all in python. Afraid I'm an obj-c iphone guy...
 
HackModford said:
sebt3 determined that xbmc simply can't launch python scripts yet :(
What do you mean? That XBMC plugins don't work on the Pandora or that the launching of external python scripts fails?
<edit>Never mind, just found the other thread. Apparently plugins just don't work. Can't take a look at it myself as I don't have my Pandora yet.</edit>
 
Last edited by a moderator:
You got any ideas?

My eventual plan is to use xbmc instead of minimenu
 
HackModford said:
You got any ideas?

My eventual plan is to use xbmc instead of minimenu
I know that one of the major changes in the upcoming XBMC dharma release is a plugin repository which allows you to install plugins directly from XBMC. They might have changed the plugin API again which would break some or all of the plugins. I haven't done any XBMC plugin work in a while now so I'm just guessing.

Which XBMC version are you using?

Do none of the plugins function correctly or is it just the launchers failing?

If you don't get any of the plugins to work at all, I would start with writing a minimal test plugin first to check if the builtin python interpreter and script support function properly (XBMC doesn't use the systems python installation but includes a modified one instead).

If that test plugin does work, then it's back to slowly debugging the launcher I suppose. The source of the launcher plugin doesn't look particularly complex to me, so that should be doable.
 
Last edited by a moderator:
We are using the upcoming XBMC dharma release (which have the gles work done within gsoc merged back in).
none of the plugins function correctly.

While the docs say xbmc support python 2.6 (that we have on the pandora), but make still want to link to python2.5. All I did was to force using 2.6.
You also need to know I'm cross-compiling and python's setup-tools don't seems to be cross-compilation friendly (hard-coded guess within /usr etc...)

I'll check angstrom patches and see if something apply here...
 
Is this what you use to actually run pnds from a terminal?

Code:
pnd_run /file.pnd
 
Okay I'm using the executor addon.

If I point it at a PND on my SD card and do not enter any arguments xbmc freezes...

If I point it at the .desktop on my Desktop same thing...

When I point to a PND and set the argument to pnd_run xbmc still freezes...

Next I'm going to try the addon Launcher
 
HackModford said:
Is this what you use to actually run pnds from a terminal?

Code:
pnd_run /file.pnd
I think the best and easiest way to do it is to parse the *.desktop files in /usr/share/applications and $HOME/Desktop.
The file format is very easy to grok.
I do have a shell function :
Code:
showExec () { 
    awk -F= '/Exec/{print $2}' < $1
}
that i'm usually using to launch pnd :
eval $(showExec Desktop/qorganizer-qOrganizer-*.desktop)

But as the code have to be in python, I have no clue.
 
Last edited by a moderator:
Well basically without mucking around in the source code

I can pick a file
And then set arguments

I just tried using launcher to launch a .desktop but it froze xbmc also. I'm going to try to do this from minimenu just so I can be sure xbmc froze. I'll try using the pandora button to exit.

Edit: Okay I did the minimenu thing and I can indeed exit xbmc. I wonder if pnd_run doesn't work because I am technically already running a pnd?

I'm gonna try pnd_run.sh as an argument

Interesting thing... if I run xbmc via minimenu I see the xbmc logo but nothing happens. I have to press the pandora button for it to actually boot :/

Edit: That didn't work either...

Isn't there some kind of pnd launcher? Because with the xbmc launcher addon I can set a program (say a pnd launcher) and then tell it to look in the pandora folder for .pnd's. It will then launch those files with the pnd launcher. Similar to how you would launch an emulator...

Edit: Still no luck... I'm gonna call it a night... I'm tired... and want to play my pandora :D
 
sebt3 said:
I think the best and easiest way to do it is to parse the *.desktop files in /usr/share/applications and $HOME/Desktop.

But as the code have to be in python, I have no clue.

The following code fragment should do the trick
Code:
#!/usr/bin/python

import os
import sys

if len(sys.argv) == 2:
    with open(sys.argv[1]) as f:
        # Find first line with 'Exec=<cmd>\n', extract <cmd>
        cmd = (l for l in f if l.startswith('Exec=')).next()[5:-1]
        os.system(cmd + ' &')
HackModford. Put that in a file, make it executable and configure the launcher to pass the .desktop files to it.
 
Last edited by a moderator:
When you say executable I assume you mean a .sh file?

But I've even tried to "launch" .sh files and xbmc seems to simply just hang... So I wonder if it's a problem with the addons code at this point?

So if I did it right... no go yet :(

I'm gonna try a .py extension...

nope.. .py doesnt work either... I think something else is going on...
 
HackModford said:
When you say executable I assume you mean a .sh file?
No, I mean giving the file execution permissions (chmod +x <file>, or perhaps in the file properties dialog if you're a GUI person).

HackModford said:
I'm gonna try a .py extension...
That would be the convention yes.
 
Last edited by a moderator:
HackModford said:
It still didn't work
I just gave it a try on my media center pc. I configured the python script I pasted as file launcher (not as standalone executable) and configured the .desktop file as "rom". Furthermore I made a dummy desktop file to launch emacs.

Now I did use an older version of xbmc and therefore also the older version of the plugin, so that might influence results a bit.

Automatically scanning for the desktop file seemed to crash my xbmc to the desktop for some strange reason. I added the file manually (from within xbmc, highlight the launcher, hit c, manually add file). After doing this it launched the target program correctly.

What are you doing differently?
 
Last edited by a moderator:
Hi,

Here is my finding :
Launcher plugins start xbmc.executehttpapi("Action(199)") before starting an app and XBMC freeze there.
This call a code through the web-server that goes within XBMC.
My last built was without it (--disable-webserver), so I added the dependencies for it and built with the webserver (PND updated).
The bad thing is the the web server hang. Even a simple "telnet localhost 9090" get you nowhere.

I tried to hack the plugins instead (remove the dependencies to the webserver). In the end of day, I'm able to start an app by quitting XBMC.
No way to minimize the XBMC window :(

So I edited ./xbmc/WinSystemEGL.cpp which contain :
Code:
bool CWinSystemEGL::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays)
{
  m_nWidth      = res.iWidth;
  m_nHeight     = res.iHeight;
  m_bFullScreen = fullScreen;

#if defined(HAS_XRANDR)

  if(m_bFullScreen)
  {
        XOutput out;
        XMode mode;
        out.name = res.strOutput;
        mode.w   = res.iWidth;
        mode.h   = res.iHeight;
        mode.hz  = res.fRefreshRate;
        mode.id  = res.strId;
        g_xrandr.SetMode(out, mode);
  }
  else
        g_xrandr.RestoreState();

#endif

#if (HAS_GLES == 2)
    int options = 0;
#else
    int options = SDL_OPENGL;
#endif
  if (m_bFullScreen)
    options |= SDL_FULLSCREEN;
  else
    options |= SDL_RESIZABLE;

  if ((m_SDLSurface = SDL_SetVideoMode(m_nWidth, m_nHeight, 0, options)))
  {
    RefreshEGLContext();
  }

  CRenderSystemGLES::ResetRenderSystem(res.iWidth, res.iHeight, fullScreen, res.fRefreshRate);

  return true;
}

....

bool CWinSystemEGL::Minimize()
{
  CLog::Log(LOGINFO, "EGL Minimizing");
  m_bWasFullScreenBeforeMinimize = g_graphicsContext.IsFullScreenRoot();
  if (m_bWasFullScreenBeforeMinimize)
    g_graphicsContext.ToggleFullScreenRoot();

  SDL_WM_IconifyWindow();
  return true;
}

Both function get called, but XBMC is still fullscreen not minimized.

Any EGL guru could help me here ?
 
Nothing that I can tell... I think the plugin just makes xbmc hang and do nothing.
 
Sebt3

So you got it to launch apps but xbmc is fullscreen? can you just quit xbmc for now?
 
sebt3 said:
Both function get called, but XBMC is still fullscreen not minimized.
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>
 
Last edited by a moderator:
HackModford said:
Sebt3

So you got it to launch apps but xbmc is fullscreen? can you just quit xbmc for now?
Edit .../pandora/appdata/xbmc/.xbmc/addons/plugin.program.launcher/resources/lib/launcher_plugin.py So it look like this (about line 244) :
Code:
                elif (sys.platform.startswith('linux')):
                    #this minimizes xbmc some apps seems to need it
#                    xbmc.executehttpapi("Action(199)")
                    os.system("%s %s &" % (launcher["application"], launcher["args"]))
                    xbmc.executebuiltin("Quit")
                    #this brings xbmc back
#                    xbmc.executehttpapi("Action(199)")
                elif (sys.platform.startswith('darwin')):
 
Last edited by a moderator:
Back
Top