Active Topics

 


Reply
Thread Tools
tso's Avatar
Posts: 4,783 | Thanked: 1,253 times | Joined on Aug 2007 @ norway
#11
oh ye honking gods, how come this isnt clearly spelled out somewhere?!
 
pipeline's Avatar
Posts: 693 | Thanked: 502 times | Joined on Jul 2007
#12
qole : i agree emelfm2 is overkill just to use as an app launcher, and yes it has its share of quirks... but god is it powerful

linuxauthor : you nailed it... i'd guess mainly its to enforce single instancing of applications. Any shim program would probably just allow multiple instances... user discretion would ensure you dont run out of memory by not shutting down old apps. Mplayer is easy though since exiting full screen can quit.

tso : afaik they only advocate hildon/dbus -> hildon/dbus and this is documented (in arguable clarity) as requiring changing codebase to support that callback. I am not familiar enough with dbus on regular distros to know if this is a proprietary implementation. I'd rather not be forced into this as only option for associations although i see possible benefits of such an interprocess communication (IPC) mechanism. Most existing source code that i have seen (which has or could be) ported to maemo doesn't support dbus messages.

Imagine how much better and versatile your device could be if you could associate these non dbus apps...

If someone can figure out how to successfully launch from cli sending just dbus messages / script files, then the possibility exists to replace the file manager with a different file manager which can do both (as opposed to middle-man shim). Or the middle-man could be reverse shim-scripts which convert the opposite direction (shell out cli which converts to dbus).

Last edited by pipeline; 2008-03-07 at 22:32.
 
qole's Avatar
Moderator | Posts: 7,109 | Thanked: 8,820 times | Joined on Oct 2007 @ Vancouver, BC, Canada
#13
MaemoN00B: Your method, once I understood how the whole "hildon-" thing works, gets me part of the way there. I made a usr/share/applications/hildon/mplayer-CLI.desktop file for mplayer, referred to it in that file you mention, and I get "CLI MPlayer - loading" in the top right of my screen, but that's all.

I think, as pipeline says, hildon apps simply do not pass filenames to the associated apps except through this dbus system, so that rules out command-line apps like mplayer.

Does this maemo kmplayer app use dbus?

Interesting update: My attempt only got that far as long as I had an X-Osso-Service line in my mplayer-CLI.desktop file, and that method, as we have determined, is a no-go for non-hildon apps. As soon as I removed the X-Osso-Service line, file manager just throws up its hands and doesn't know what to do with video at all.

Last edited by qole; 2008-03-07 at 23:35.
 
tso's Avatar
Posts: 4,783 | Thanked: 1,253 times | Joined on Aug 2007 @ norway
#14
iirc dbus is open source, but its also a fairly recent addition to the overall "ecosystem". more "mature" code do not have the required support built in...
 
qole's Avatar
Moderator | Posts: 7,109 | Thanked: 8,820 times | Joined on Oct 2007 @ Vancouver, BC, Canada
#15
It looks like kmplayer will do what I want it to. From the garage home page:

"Video playback using osso-media-server and MPlayer, with fullscreen and sub-rectangle (using SMIL) support. Be patient though with initial video start"

So KMPlayer acts like a shim between mplayer and the wacky hildon-osso dbus system. I'll download and experiment.

Another interesting thing about kmplayer is that it plays flash outside the browser ("using the libflash browser plugin"), which opens possibilities for flash games; perhaps even making application menu items for flash games is possible?
 
pipeline's Avatar
Posts: 693 | Thanked: 502 times | Joined on Jul 2007
#16
Nice to know... i guess so far that makes quiver and kmplayer so far which support dbus... too bad neither are python because it that would make for good starting point to build a universal shim from since the codes right there (and editable) on device... very important for patching with new apps.

As for flash games, this could work in theory. I tried it (with kmplayer) for two different swf flash files and it crashed in the libflashplayer.so lib though. But it did seem to get the command line parameters which would be missing piece to integrating swf files/apps into maemo menu system.
 
qole's Avatar
Moderator | Posts: 7,109 | Thanked: 8,820 times | Joined on Oct 2007 @ Vancouver, BC, Canada
#17
Originally Posted by pipeline View Post
...too bad neither are python because it that would make for good starting point to build a universal shim from since the codes right there (and editable) on device... very important for patching with new apps.
The kmplayer web page says, "The osso-media-server control, done by using d-bus, is in kmplayerprocess.cpp" so maybe someone who knows C can get the needed code from there?
 
tso's Avatar
Posts: 4,783 | Thanked: 1,253 times | Joined on Aug 2007 @ norway
#18
make that c++...
 
pipeline's Avatar
Posts: 693 | Thanked: 502 times | Joined on Jul 2007
#19
Ok i got a working demo of this in python which is best language to use... at least for now in the hack/retry/hack/retry... stage

First sample just implements 'torrents' to transmission program but you can hack in your own associations really easy and it will support pretty much anything.

So i've got this simple python script which i put into /usr/bin/dbus-switchboard.py (set execute permissions on this file) :
Code:
#!/usr/bin/python2.5
import osso
import gtk
import os

def callback_func(interface, method, arguments, user_data):
    print "RPC received"
    osso_c = user_data
    print "osso_test_receiver: Received an RPC to %s." % method
    print "osso_test_receiver: RPC had arguments %s." % arguments

    #convert common hex encodings, and format and wrap in single quotes
    argstr = "%s" % arguments
    argstr = argstr.replace("%5B", "[")
    argstr = argstr.replace("%5D", "]")
    argstr = argstr.replace("%2B", "+")
    argstr = argstr.replace("%20", " ")
    argstr = argstr.replace("file:///", "/")
    argstr = "'" + argstr + "'"

    if argstr.find(".torrent") <> -1:
        osso_sysnote = osso.SystemNote(osso_c)
        osso_sysnote.system_note_infoprint("Launching Transmission...")
        print "launching torrent..."
        print "/usr/bin/run-standalone.sh /usr/lib/transmission/transmission %s" % argstr 
        os.system("/usr/bin/run-standalone.sh /usr/lib/transmission/transmission %s" % argstr )

    if argstr.find(".avi") <> -1:
        osso_sysnote = osso.SystemNote(osso_c)
        osso_sysnote.system_note_infoprint("Launching MPlayer...")
        print "launching mplayer..."
        print "/usr/bin/run-standalone.sh /usr/bin/mplayer %s" % argstr 
        os.system("/usr/bin/run-standalone.sh /usr/bin/mplayer %s" % argstr )

    if argstr.find(".mpg") <> -1:
        osso_sysnote = osso.SystemNote(osso_c)
        osso_sysnote.system_note_infoprint("Launching MPlayer...")
        print "launching mplayer..."
        print "/usr/bin/run-standalone.sh /usr/bin/mplayer %s" % argstr 
        os.system("/usr/bin/run-standalone.sh /usr/bin/mplayer %s" % argstr )

    if argstr.find(".wmv") <> -1:
        osso_sysnote = osso.SystemNote(osso_c)
        osso_sysnote.system_note_infoprint("Launching MPlayer...")
        print "launching mplayer..."
        print "/usr/bin/run-standalone.sh /usr/bin/mplayer %s" % argstr 
        os.system("/usr/bin/run-standalone.sh /usr/bin/mplayer %s" % argstr )


osso_c = osso.Context("dbus-switchboard", "0.0.1", False)
print "dbus-switchboard started"
osso_rpc = osso.Rpc(osso_c)
osso_rpc.set_rpc_callback("org.dbus.switchsvc",
    "/org/dbus/switchservice",
    "org.dbus.switchsvc", callback_func, osso_c)
gtk.main()
And a dbus service in /usr/share/dbus-1/services/dbus-switchboard.service :
Code:
[D-BUS Service]
Name=org.dbus.switchsvc
Exec=/usr/bin/dbus-switchboard.py
I've also got a .desktop file in /usr/share/applications/hildon/dbus-switchboard.desktop which you will don't seem to need to change :
Code:
[Desktop Entry]
NoDisplay=true
Version=1.0
Encoding=UTF-8
Name=dbus switchboard 
Exec=/usr/bin/python /usr/bin/dbus-switchboard.py 
Type=Application
X-Osso-Service=org.dbus.switchsvc
X-Osso-Type=application/x-executable
And not sure if its needed but i edited the /usr/share/applications/defaults.list add mime type link as well with the lines :
Code:
#torrents
application/x-bittorrent=hildon-dbus-switchboard.desktop
- You will probably need to reboot for the dbus service settings to take effect -

Ok this solution is still rough and you should probably load xterm and run the python from there (at least while we are debugging) to see console messages. But it does seem to work and launch that python prog even when you dont.... its just invisible.

So open xterm and then run /usr/bin/dbus-switchboard.py and leave it running and you can browse web and download ('open') a torrent and it will load in transmission. I assume same would work for file manager but benefit for that app is from browser.

I got working for avi files to launch mplayer from file manager but i need to fine tune/fix up the parameter since if the filename has a space in it mplayer doesnt like it.

Eventually i'm hoping a python expert can pick this up and design a nice screen which lets you configure which apps to launch for each filetype. The part where you bind mime types to dbus-switchboard would be manual but the part where you bind dbus-switchboard to 'sinks' or applications could be packaged into gui program.

Last edited by pipeline; 2008-03-10 at 23:19.
 

The Following User Says Thank You to pipeline For This Useful Post:
pipeline's Avatar
Posts: 693 | Thanked: 502 times | Joined on Jul 2007
#20
Ok I built a deb installer for the first version which will support avi files and torrent files.

Install this :
http://wardenclyffetower.com/MaemoFi...-1.1.3.all.deb

Then edit the /usr/share/applications/defaults.list file (as root) and change relevant mime types such as :
video/x-msvideo=hildon-dbus-switchboard.desktop
application/x-bittorrent=hildon-dbus-switchboard.desktop

There is issue an issue with file names containing certain special symbols, currently i support the special symbols '[' ']' and '+' ... the other special symbols will show up as char codes like %5B %5D so if it wont launch, look for that. Unless someone knows a better way i guess i will just convert a bunch of common symbol codes in later versions.

I didn't need to reboot after installing this... not sure if you will need to or not.

If you see popup notices but your file doesnt launch then load the dbus-switchboard.py from xterm, try again, and read xterm console for info which might help.

Last edited by pipeline; 2008-05-15 at 02:01.
 

The Following 3 Users Say Thank You to pipeline For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 19:23.