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)

qole 2010-06-15 22:53

Re: How To : Associate MPlayer, Transmission, and other apps as default handlers
 
New version (1.2.13-3fremantle1) fixes the gnome dependency problem (thanks qwerty12 ! ) and repairs the softlink to /etc/gnome/defaults.list upon removal (thanks rebhana ! )

rebhana 2010-06-16 17:23

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

Originally Posted by qole (Post 716656)
New version in Extras-devel (1.2.13) has rudimentary, hackish support for mimetypes. If your file doesn't have a recognised file extension, it will try to match the file to a recognised mimetype.

I have added a new file,

/home/user/.mimetypes/user-mimetypes.list

which you must edit by hand. Find the mimetype in the incredibly long list (taken from my desktop Ubuntu defaults.list) and change the "none" to the name of the handler (from the Handlers list in the GUI).

I have defined one mimetype as an example, application/pdf=Evince to show you how to do it (and to keep the invaluable rebhana as my betatester :)).

Great! I can now read my physics papers directly from the browser also with dbus-switchboard installed, so I'm back in as a betatester! :) And I can now use the Easy Debian version of evince for those formats not supported by native evince, namely postscript files! So I've gained something already! :D For this I had to extend the "incredibly long" user-mimetypes.list file even more, so in time I'll feed back my version of it!

Now to a new problem I've encountered:
I believe in the previous version of dbus-switchboard, I could use microB to view my directories and when I clicked on an .odt file, it would open OO Writer immediately. For some reason that doesn't work any longer. Now it obviously tries to run something, because the screen goes black for a while with the little clock ticking away, but then it comes back with nothing. From file manager I can open OO Writer by selecting dbus-switchboard, but as I said, from microB it had done that by itself before. On the other hand, when I open files on the internet with a file extension recognized by dbus-switchboard, I get the option of opening them with it or saving it on the device, so that works.

qole 2010-06-16 17:32

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

Originally Posted by rebhana (Post 717854)
....so I'm back in as a betatester! :)

Hoorah!

Quote:

Originally Posted by rebhana (Post 717854)
For this I had to extend the "incredibly long" user-mimetypes.list file even more, so in time I'll feed back my version of it!

Great. Let's make this list as comprehensive as possible.

Quote:

Originally Posted by rebhana (Post 717854)
Now to a new problem I've encountered:
I believe in the previous version of dbus-switchboard, I could use microB to view my directories and when I clicked on an .odt file, it would open OO Writer immediately. For some reason that doesn't work any longer.

I bet it is a parameter format problem. Could you open a terminal and enter:
Code:

dbus-switchboard.py
Then try to open a local file via the browser (the way that doesn't work currently). Paste the output of dbus-switchboard.py here so I can see more details.

qwerty12 2010-06-16 17:37

Re: How To : Associate MPlayer, Transmission, and other apps as default handlers
 
Are you escaping the URI? Filenames recieved from the browser must be unescaped (the File Manager sends them "properly"). I was using a GLib function, but I bet Python offers such a function (you'll probably find it being used elsewhere in dbus switchboard).

qole 2010-06-16 17:40

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

I think I see the problem: When a local file is clicked via the browser, I am feeding a bad filename to GnomeVFS. There are two // at the beginning of the file path... I think that is a straightforward fix... Thanks again, rebhana.

rebhana 2010-06-16 17:43

Re: How To : Associate MPlayer, Transmission, and other apps as default handlers
 
I've opened the local file Anmeldung.doc with microB, which mimetype (from the libfile-mimeinfo-perl package that I installed in Easy Debian) recognizes correctly:
Code:

[user@deb-m5v3d: ~]mimetype Anmeldung.doc
Anmeldung.doc: application/msword

dbus-switchboard.py says:
Code:

dbus-switchboard started
--
-- dbus-switchboard: Received an RPC to mime_open.
-- dbus-switchboard: RPC had arguments ['//home/user/Anmeldung.doc'].
-- dbus-switchboard: Interface is org.dbus.switchsvc
-- dbus-switchboard: user_data is <osso.context.Context object at 0x1e5ff0>
_rpc_callback_handler: Exception occurred during callback execution.
Traceback (most recent call last):
  File "rpc.pyx", line 16, in osso.rpc._rpc_callback_handler (osso/rpc.c:1473)
  File "/usr/bin/dbus-switchboard.py", line 76, in callback_func
    docmimetype = gnomevfs.get_mime_type(params2)
RuntimeError: there was an error reading the file

EDIT: I should also say that I've chosen OO Writer as the handler for doc files, not the default antiword->pdf. Is there actually antiword for fremantle?

EDIT2: Wow, you two are fast! :eek: Can you tell me where to fix the script?

qole 2010-06-16 17:52

Re: How To : Associate MPlayer, Transmission, and other apps as default handlers
 
I'll package up another version ASAP.

Why do they send such a strange parameter?

['//home/user/docname.doc']

The two slashes aren't part of any convention that I'm aware of...

EDIT: Rebhana, do you want to give me your mimetype list extensions?

rebhana 2010-06-16 18:27

Re: How To : Associate MPlayer, Transmission, and other apps as default handlers
 
1 Attachment(s)
Quote:

Originally Posted by qole (Post 717896)
I'll package up another version ASAP.

Why do they send such a strange parameter?

['//home/user/docname.doc']

The two slashes aren't part of any convention that I'm aware of...

EDIT: Rebhana, do you want to give me your mimetype list extensions?

Here is my user-mimetype list file, where I have introduced two handlers not (yet) in dbus-switchboard, but which I'd suggest to include:
dbus-switch-apps.cfg:
Code:

OpenOffice,cli,"debbie-sue ooffice ""%params%"""
DEvince,cli,"debbie-sue evince ""%params%"""

Regarding OO, I think you don't have to distinguish between the different OO components, ooffice anyway opens with the one applicable. And in addition to Evince, I've introduced DEvince as the Easy Debian version, which can handle a lot more file formats. But I kept native evince for pdf and djvu.

In dbus-switch-xref.cfg, you could actually map a lot more extensions to OpenOffice, but I haven't made a comprehensive list yet.

rebhana 2010-06-16 19:32

Re: How To : Associate MPlayer, Transmission, and other apps as default handlers
 
1 Attachment(s)
I have extended my dbus-switch-xref.cfg such that it covers more completely the files that evince (native and E.D.) and ooffice can display, in case you are interested.

qole 2010-06-16 19:58

Re: How To : Associate MPlayer, Transmission, and other apps as default handlers
 
New version (1.2.14) uploaded to Extras-devel:
  • Worked around the local-files-in-browser-have-extra-leading-slash problem; now you can click on local files in the browser and they will be properly handled by dbus-switchboard.
  • rebhana's extra mime types added to user-mimetypes.list (but not his extra associations to OpenOffice, yet).
  • "Evince Debian", "OpenOffice" and "VLC" added to handler list
  • Antiword removed as default XRef for .doc, replaced with OpenOffice
  • rtsp: protocol added to XRefs
  • GUI icon improved: added a white border around the ... whatever it is. (side note: I did this in Debian GIMP on-device :) )
  • "unknown/unknown" added to Maemo defaults.list because that seems to be the catch-all for Maemo 5. Now unknown types (like rebhana's .gz file attachments for example!) can be opened by dbus switchboard instead of just downloaded. This is good, even if you don't have a dbus-switchboard handler, because dbus-switchboard now tells you the real mimetype and file extension so you can associate it.

I am aware that the "old" config files are all reset to package defaults at each update. This is a fairly systemic problem, however, so I am going to address this in a later update. My "new" mimetype list doesn't get updated at all, so if you want the new list, you have two choices: either delete your current list before updating:

Code:

rm -r /home/user/.mimetypes
...or, after updating, you have to do the following:

Code:

cp /usr/lib/dbus-switchboard/user-mimetypes.list /home/user/.mimetypes
And rebhana: Now that I have "real" mimetype support, I'm hoping to make the old-style xref file a secondary resource, only used in the cases where files of the same mimetype can be opened by different handlers depending on extension.


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

vBulletin® Version 3.8.8