maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   How To : Associate MPlayer, Transmission, and other apps as default handlers (https://talk.maemo.org/showthread.php?t=17757)

hvacengi 2008-10-26 20:40

Re: How To : Associate MPlayer, Transmission, and other apps as default handlers
 
Quote:

Originally Posted by qole (Post 235753)
I'm having second thoughts about the "conservative" sudoers settings. You may have to experiment with that, to find out exactly what you need to include. I suspect you'll need to at least include the app you use to edit your system files, too.

No, you were right the first time. Or at least you seem to be, with how I have it working. I just created a file in /tmp and then used an external call to "sudo cp" to copy it into the regular folder.

I do think that I have things working, with direct modification of the both defaults.list files. I've got a PM in to pipeline to have him test it out, and put it into his .deb with the install scripts.

Hopefully it will work... and his tablet won't start on fire as soon as he runs it...

pipeline 2008-10-26 22:27

Re: How To : Associate MPlayer, Transmission, and other apps as default handlers
 
Hey thanks for the code and ideas... I did manage to run the new interface and it looks great. I do have some 'first thoughts' on this but it will probably take me a few days to get around to look over what you've already done (so some may not be relevant) :

DBus from python : Yes, as i understand it (hvacengi), in mlbviewer you are launching dbus normally which will go through defaults.list. If we are to intercept a mime type we cant use that method because it will come back to us... thats where dbus-send comes into play. Unfortunately, its a bit hackish (sometimes it launches app and sometimes it needs app loaded and it may behave differently if its a single instance program like media player or if it allows multiple windows like microb.

About sudoers : My first though was separate registration into separate .py file whose sole purpose is to update the defaults.list, but now that i see your gui i think it might be better to sudo the entire dbus-switchboard-gui python file and run the whole program as root... thats less of a hole than leaving capability to copy arbitratry file and overwrite defaults.list as 'user'... less important because its a tablet, but probably more acceptable to long time linux users. Sudo on the gui at least the user sees what hes about to do rather than it getting overwritten as a blip in someone elses ui-less script to cp that file.

At first, I got an error because i did not have a '/usr/share/applications/uri-action-defaults.list~' file... but you should not use the ~files since they are created when i call my '/usr/bin/dswitch-ini.sh' script from my .deb postinstall (and i dont change the uri-actions file so no backup (hence the error).

This looks great... thanks for the work... i'll look over the code over the next few days and try to stress test it.

Update : now that i think about it your probably parsing the ~file to see the hildon default? If so we can package together an unused defaults.list (with all maemo apps as defaults) for reference and hide it in /usr/lib/dbus-switchboard for you to use intead of ~ files since my current implementation of those ~ files is not reliable enough to use anymore (useless if you install/upgrade more than once on any given os flash)

hvacengi 2008-10-27 04:16

Re: How To : Associate MPlayer, Transmission, and other apps as default handlers
 
Quote:

Originally Posted by pipeline (Post 236830)
Update : now that i think about it your probably parsing the ~file to see the hildon default? If so we can package together an unused defaults.list (with all maemo apps as defaults) for reference and hide it in /usr/lib/dbus-switchboard for you to use intead of ~ files since my current implementation of those ~ files is not reliable enough to use anymore (useless if you install/upgrade more than once on any given os flash)

Thats fine, I just used that because it was handy on the defaults, and then rinsed and repeated for the uri's. I didn't define a global for the "base" file, but I think that the file paths are used in only two lines of code, one each for loading the info.

Quote:

Originally Posted by pipeline (Post 236830)
About sudoers : My first though was separate registration into separate .py file whose sole purpose is to update the defaults.list, but now that i see your gui i think it might be better to sudo the entire dbus-switchboard-gui python file and run the whole program as root... thats less of a hole than leaving capability to copy arbitratry file and overwrite defaults.list as 'user'... less important because its a tablet, but probably more acceptable to long time linux users. Sudo on the gui at least the user sees what hes about to do rather than it getting overwritten as a blip in someone elses ui-less script to cp that file.

That makes sense, i think. The way I read it, we would create a sudo entry for the switchboard gui and run it with sudo instead of just the cp command. Which keeps the defaults.list file under lock and key, so some one can't randomly type "sudo rm defaults.list" [DISCLAIMER: DO NOT TYPE THIS!!!!!!!!!!!!!].


I'm going to have to take a second look at the dbus mime calls. It looked like the dbus services received a method call of "mime_open" from the internal maemo mime handler. Since switchboard gets called instead of that dbus method, I thought that switchboard could instead place the osso.rpc call directly to the service. I only looked at it long enough to get my audio/video running though, I could have been way off base. I really wish there was documentation that came with all of the services, it sure would be easier to wrap my head around (If some one does know of said documentation, I'd love to be directed to it!)

Thanks for taking a look at it, I'm sure you're going to have fun ironing out various bugs. I do apologize, I forgot to mention that I fixed my implementation of tracking if the file was saved, and did not implement your new version that did the same (thanks to me forgetting to update to 1.2.2 before editing.)

Thanks for all the hard work!

qole 2008-10-27 04:30

Re: How To : Associate MPlayer, Transmission, and other apps as default handlers
 
Thanks both of you... This is going to be kick-@ss.

pipeline 2008-11-07 12:37

Re: How To : Associate MPlayer, Transmission, and other apps as default handlers
 
I have added hvacengi's new GUI program into a version 1.23 easy edition (in first post).

It works great, and i can toggle types between native hildon apps and dbus-switchboard now... so for mp3, i can intercept for xmms or disable default for normal Media Player... without rebooting.

So no longer need to edit any files.

You may need to reboot after install... if the menu link doesn't start the program, then reboot.

If you use personal-menu or personal-launcher, you will need to delete and re-add the shortcut since startup has changed.

Thanks hvacengi for all your work on making this GUI simple enough for casual use and users. :D It will allow me to try many more combinations of file types and handlers now.

codeMonkey 2008-11-18 17:32

Re: How To : Associate MPlayer, Transmission, and other apps as default handlers
 
Just noticed that dbus-switchboard seems to struggle with differing-case file extensions, e.g. .pdf / .PDF

Any chance of a fix? (No hurry, I've just renamed the offending file)
:)

qole 2008-11-18 17:42

Re: How To : Associate MPlayer, Transmission, and other apps as default handlers
 
I've been playing with dbus switchboard for the last few days, trying to get it to work in every situation. It looks like I'm going to have to release a new version of Easy Debian (to fix a few bugs revealed by this), but when I do, you'll be able to click on a Word document in an e-mail attachment and have it open in OpenOffice Writer.

pipeline, please add .jar and .jnlp as filetypes, and I'll keep messing about to get Easy Debian passing parameters properly, so that (debbie java -jar "%params%") will work to open Java applets, and (debbie javaws "%params%") will open Java Web Start applets.

A workaround for the problems with parameters that the "debbie" script is having is to replace "debbie" in the Easy Debian handlers with "sudo debian hilda" ... this works as expected.

pipeline 2008-11-18 23:24

Re: How To : Associate MPlayer, Transmission, and other apps as default handlers
 
Thanks guys... i'll fix the case-sensitivity and add debian java handlers and xrefs.

I'll probably release this weekend with those changes, so make any other simple suggestions now and i'll add those as well.

I think i'll also move the xref and handler configuration files to /usr/lib/dbus-switchboard and lock down as root... the gui will still have permission to edit the files but user can't update, only read.

dkwatts 2008-11-19 06:56

Re: How To : Associate MPlayer, Transmission, and other apps as default handlers
 
Quote:

Originally Posted by pipeline (Post 242994)
Thanks guys... i'll fix the case-sensitivity and add debian java handlers and xrefs.

I'll probably release this weekend with those changes, so make any other simple suggestions now and i'll add those as well.

what app are you using to stream voicemail from www.grandcentral.com/mobile/ ?

qole 2008-11-19 07:14

Re: How To : Associate MPlayer, Transmission, and other apps as default handlers
 
Um, yeah, about that. Two things:

1. grandcentral/mobile just doesn't work to stream those mp3s to the tablet. I get an error from GC, 400 bad request, no matter what I do. They play if you save them first...

2. xmms handler should be:
[code]
/bin/sh -c "LC_MESSAGES=C LANG=C /usr/bin/xmmsctrl launch main 0 equalizer 0 play_list 0 main 1 %params%"
[code]


All times are GMT. The time now is 15:54.

vBulletin® Version 3.8.8