Managing many MIME types at once

This forum is dedicated to advanced help and support :

Ask here your questions about advanced usage of Mageia. For example you may post here all your questions about network and automated installs, complex server configurations, kernel tuning, creating your own Mageia mirrors, and all tasks likely to be touchy even for skilled users.

Managing many MIME types at once

Postby doktor5000 » Jun 12th, '11, 10:16

Hello,

currently i'm searching for a way or a tool to manage many MIME associations at once.
Maybe you know the problem: You install your default media player, f.ex. VLC.
Some time after, you install another media player, f.ex. smplayer.
The result is, that the latter is now associated with higher priority for
all the MIME types which it supports, so if you only want it as fallback,
one has to manually edit all MIME associations to give VLC higher priority.

Anyone knows if there is an easy way to say: VLC should again be the one
with the highest priority instead of the time-consuming editing of all supported
MIME types?

This is under KDE4.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18066
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Managing many MIME types at once

Postby Akien » Jun 12th, '11, 12:48

Supposing you're using Dolphin: if you want to change the priorities for, e.g., playing a .mkv file, you just have to right-click on any .mkv file, go to the properties.
There, you'll see "Type: Matroska video", and an icon with an open-end wrench. There you can manage the priorities between all the desired players.

I hope that's what you were searching for.
Image
Co-leader of Mageia's packaging and development team (dev).
List of packages I maintain.
User avatar
Akien
 
Posts: 171
Joined: Jun 5th, '11, 22:54
Location: Brunswick, Germany

Re: Managing many MIME types at once

Postby doktor5000 » Jun 12th, '11, 14:16

No, this is the same or maybe even more complicated as in systemsettings -> file associations.
I want to change the priority at once, like some little app would ask me:

"Would you like to play the following files with [insert your favorite media player here] by default:
.avi, .mp4, .mpg, .mpeg, .flv, .xvid, .vob, .mp3, .m3u ....."
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18066
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Managing many MIME types at once

Postby ahmad » Jun 14th, '11, 04:31

Since you're using KDE, copy /usr/share/applications/vlc.desktop to ~/.local/share/applications, then edit it to add:
InitialPreference=10

the number, 10, is arbitrary, the higher the number the higher the priority, (smplayer.desktop doesn't have an InitialPreference entry at all, but it's before vlc since smplayer is before vlc, alphabetically, IINM). Then refresh the kde4 configuration, as user:
Code: Select all
kbuildsycoca4


(To associate more mimetypes to vlc, edit the same file, and add the appropriate mimetype to the MimeType entry, you can get the exact syntax from "file associations" in systemsettings, e.g. flv files have mimetype video/x-flv).
ahmad
 
Posts: 336
Joined: Mar 22nd, '11, 20:18
Location: Egypt

Re: Managing many MIME types at once

Postby doktor5000 » Jun 14th, '11, 20:15

ahmad wrote:Since you're using KDE, copy /usr/share/applications/vlc.desktop to ~/.local/share/applications, then edit it to add:
InitialPreference=10
the number, 10, is arbitrary, the higher the number the higher the priority


Ahmad, you are my hero :P
Now my question: From where do you know this? After googling this, i found several occurences on several mailinglists
about the usage, also on freedesktop.org, but nowhere a mention where the origin of this entry is or where this is defined...
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18066
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Managing many MIME types at once

Postby ahmad » Jun 14th, '11, 20:34

First time I saw it was in some of KDE .desktop files in /usr/share/applications/kde4, then google'ed it, e.g.:
http://www.freedesktop.org/wiki/Specifi ... tions-spec
http://lists.freedesktop.org/archives/x ... 09163.html

Basically it's define in the freedeskop specification, it's a reserved key for KDE, other DE's don't use/recognise it; from the first link:
The current status-quo is that KDE orders on the InitialPreference key in the .desktop files (higher = preferred), and gnome uses a global configuration file defaults.list. Effectively this makes the default ordering desktop-specific, but gives more work to distributions.
ahmad
 
Posts: 336
Joined: Mar 22nd, '11, 20:18
Location: Egypt

Re: Managing many MIME types at once

Postby doktor5000 » Jun 25th, '11, 10:19

Now i must ask again: I have installed another program (handbrake) which defines its supported MIME types in the .desktop file,
and no InitialPreference ist set for this one. But this MIME type definition still puts it at the topmost position in the list, for one
of the defined MIME types (.MKV in my example) and VLC comes in last, even after a manual kbuildsycoca4 call.

How to manage this one, do you have any suggestion? Could this come of the fact that VLC only defines
application/x-matroska

and handbrake defines
application/x-matroska; audio/x-matroska; video/x-matroska;

Shouldn't VLC also get all those entries, to support its MIME types properly?
Should i ask about this upstream?
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18066
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Managing many MIME types at once

Postby ahmad » Jun 25th, '11, 14:51

It depends on the mimetype of the .mkv file, I checked here and it's video/x-matroska; the InitialPreference setting would only affect the mimetypes mentioned in vlc .desktop file, so adding video/x-matroska should make it work, I think.

I, too, think upstream should add the matroska mimetypes to the vlc .desktop file, since obviously vlc can play them.
ahmad
 
Posts: 336
Joined: Mar 22nd, '11, 20:18
Location: Egypt

Re: Managing many MIME types at once

Postby billgates » Apr 28th, '12, 12:45

When you click a link to download a file, the MIME type determines what action is taken. If you see an "Opening <filename>" dialog asking if you want to save the file or open it with a specified application, that normally means that your Mozilla application cannot handle the MIME type internally, no plugin is installed and enabled that can handle it and you have not previously selected a download action or helper application
billgates
billgates
 
Posts: 1
Joined: Apr 28th, '12, 12:43

Re: Managing many MIME types at once

Postby doktor5000 » Apr 28th, '12, 18:17

This is not about mozilla applications, but about handling preferences for MIME types in general.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18066
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Managing many MIME types at once

Postby manseraider » Sep 18th, '15, 06:00

(I hope reviving a dormant post is OK, I didn't see a rule against it)

Doktor5000, did you ever find a satisfactory way to edit MIME associations? In other distros I've used a specific GUI application for it, but I don't see any officially supported in the Mageia database.
manseraider
 
Posts: 3
Joined: Sep 18th, '15, 05:36

Re: Managing many MIME types at once

Postby doktor5000 » Sep 18th, '15, 07:12

Hmmm, your question is pretty generic. In general, KDE's systemsettings is pretty satisfactory for edititing MIME associations, but it can't edit several MIME types at once. But I have a workaround for that for KDE, as you can read.
There are not that much standalone applications, usually each desktop environment brings an integrated facility for this.

What specific GUI application are you referring to?
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18066
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Managing many MIME types at once

Postby manseraider » Sep 18th, '15, 10:29

Ah, I didn't realize this was a DE-specific thing. I was previously using XFCE, so my application was this: http://docs.xfce.org/xfce/xfce4-settings/mime . I went with Gnome on my Mageia install, which doesn't appear to have its own MIME editor. (Although I see there's one made by Ubuntu). I guess I'll just have to go into the config files and do it the old-fashioned way.
manseraider
 
Posts: 3
Joined: Sep 18th, '15, 05:36

Re: Managing many MIME types at once

Postby jiml8 » Sep 18th, '15, 20:40

Actually, aside from Microsoft's determination to protect their desktop monopoly, I think this issue is THE biggest single reason that Linux has not achieved much greater desktop success.

MIME types are important, ubiquitous, and not handled in a consistent fashion in Linux. This single issue makes the test matrix for third-party developers into a freaking nightmare, and discourages development of 3rd party commercial applications.

Rather than systemd, in my ideal universe Redhat would be focusing on creating a consistent MIME handler (udev for MIME) that could be employed across all desktops and distros.
jiml8
 
Posts: 1254
Joined: Jul 7th, '13, 18:09

Re: Managing many MIME types at once

Postby doktor5000 » Sep 18th, '15, 22:06

manseraider wrote:I was previously using XFCE, so my application was this: http://docs.xfce.org/xfce/xfce4-settings/mime

Why not use that on Mageia?

[doktor5000@Mageia5]─[21:42:42]─[~] urpmq -l xfce4-settings | grep bin
/usr/bin/xfce4-accessibility-settings
/usr/bin/xfce4-appearance-settings
/usr/bin/xfce4-display-settings
/usr/bin/xfce4-keyboard-settings
/usr/bin/xfce4-mime-settings
/usr/bin/xfce4-mouse-settings
/usr/bin/xfce4-settings-editor
/usr/bin/xfce4-settings-manager
/usr/bin/xfsettingsd


But you can also use desktop-agnostic command-line tools for that, there are several of them.
Check e.g. https://wiki.mageia.org/en/User:Doktor5 ... er-desktop and the sections further down on how to check and how to set e.g. the default browser system-wide.

manseraider wrote:I went with Gnome on my Mageia install, which doesn't appear to have its own MIME editor. (Although I see there's one made by Ubuntu). I guess I'll just have to go into the config files and do it the old-fashioned way.

GNOME does have a MIME editor, it's just pretty well hidden. From what I remember, GNOME only lets you choose or change a MIME association in the file manager i you select "Open with" and then you could change the default application.
It's more file-centric as compared to KDE but when you want to change a lot of MIME definitions at once, it's even more braindead as you would need to get hold of a file from each MIME type.

@jiml8: From what I can tell after some investigations due to bugreports and issues with thunderbird and firefox not being used as default application under various desktop environments,
mimeo from an archlinux contributor seems to be a pretty good workaround to some points of the issue. Check http://xyne.archlinux.ca/projects/mimeo/
Apart from that, what are you missing in particular from desktop-agnostic things like xdg-open, xdg-mime and similar tools?
There are pretty consistent handlers and the spec is well defined, see e.g. http://www.freedesktop.org/wiki/Specifi ... apps-spec/
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18066
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Managing many MIME types at once

Postby lula » Sep 19th, '15, 12:52

jiml8 wrote:MIME types are important, ubiquitous, and not handled in a consistent fashion in Linux.

I fully agree to that. I've always liked the way they did in BeOS/Haiku, where you have a hierachical system of "super- and sub"-types and you can assign your favourite application to a super-type but also being able to have exceptions for some sub-types. This IMHO creates an easy to use, flexible and consistent MIME system.
Attachments
mime.png
MIME types in Haiku
mime.png (97.92 KiB) Viewed 6123 times
lula
 
Posts: 12
Joined: Feb 10th, '12, 21:32


Return to Advanced support

Who is online

Users browsing this forum: No registered users and 1 guest