19 February, 2006

MIME Types (Mplayer)

Example: MPlayer should start WMV by Double-Click
I've uninstalled Xine and Totem, cause i only use MPlayer. After uninstalling them, I saw a disaster: Totem used to be the default player. And now there was ... nothing!
After two days of internet research, this essay was created ... so that you don't waste your time the way I had to.

Creating the desktop file
If it is not already existing, create the file "/usr/share/applications/mplayer.desktop" like this:
Code:


[Desktop Entry]
Name=Movie Player
Comment=Play multimedia files and media
Icon=mplayer.xpm
Exec=gmplayer %f
Terminal=false
MimeType=video/mpeg;video/x-msvideo;video/quicktime;video/x-ms-asf;video/x-ms-wmv
Type=Application
Categories=Application;AudioVideo;
Encoding=UTF-8


The mime types for asf and wmv already exist and are stored in the mime type database (/usr/share/mime/packages/freedesktop.org.xml)

Modify defaults.list
This file will init our DEFAULT application. It ONLY contains ONE desktop file for EACH mime type:
Code:


video/x-ms-asf=mplayer.desktop
video/x-ms-wmv=mplayer.desktop



Modify mimeinfo.cache
To take effect as default application and init the double-click feature, we need to modify the mimeinfo.cache also:
Code:


video/x-ms-asf=mplayer.desktop
video/x-ms-wmv=mplayer.desktop


This file can use MORE then ONE desktop file. If you want to be able to handle - for example - WMV files with different players, a line like this is also acceptable:
Code:


video/x-ms-wmv=mplayer.desktop;realplay.desktop


This will change the right-click-menu and insert Helix-Player, while mplayer is still default (with double-click)

After modification, log out from gnome and log in again...

No comments: