Page 1 of 1

How to make VLC (or any player) the default for all video fi

Posted: 09 Sep 2007 23:13
by u-slayer
I've searched the forums in the past, trying to find a way to change the default application that opens video files. The best response I ever found was to right click on the files and manually change the properties.

I find this method slow and tedious. There are 19 different types of video files. Therefore, I have automated the whole thing. ONE line in the terminal will change ALL of your video files so that they open with vlc

Code:

Code: Select all

cd /usr/share/mime ls video/* | sed 's/.xml/=vlc.desktop/' | tee -a ~/.local/share/applications/defaults.list
By the way, this also works for Image, message, multipart, text, audio, packages and video files.

Just change the word 'video' to one of the above options and change vlc to whatever app you like best.

Tell me if this works for you. I only tested it in ubuntu linux.

Re: How to make VLC (or any player) the default for all video fi

Posted: 10 Sep 2007 00:48
by funman
Hi,
Your script is interesting, can we put it in the vlc source tree (under GPL licence, copyrighted by VideoLAN team if you agree) ?

I'd like to make 2, one for audio, one for video (i don't see the interest for other mimetypes)

And by the way the script will work on any distribution that is freedesktop compliant.

thanks

Re: How to make VLC (or any player) the default for all video fi

Posted: 10 Sep 2007 01:30
by u-slayer
Yes, feel free to include it. :D

Re: How to make VLC (or any player) the default for all video fi

Posted: 10 Sep 2007 05:50
by funman
I added it in the tree, and modified it a little bit:
see
http://trac.videolan.org/vlc/browser/tr ... default.sh and
http://trac.videolan.org/vlc/browser/tr ... default.sh
(they are basically the same)

I added a way to keep settings while not duplicating entries (for example on multiple running of the script), and create the config file if it's not present.

thanks for your contribution !

tell me if you think it can be enhanced further

Re: How to make VLC (or any player) the default for all video fi

Posted: 14 Sep 2007 09:53
by SynUK
Can you give me any pointers what I am doing wrong when I run your script above. When I run it I get the following error :

Code: Select all

./video-vlc-default.sh: 1: cannot open !DOCTYPE: No such file ./video-vlc-default.sh: 1: html: not found ./video-vlc-default.sh: 2: PUBLIC: not found ./video-vlc-default.sh: 3: Syntax error: newline unexpected
I am running it on a standard install of Ubuntu Feisty Fawn with Beryl added.

Re: How to make VLC (or any player) the default for all video fi

Posted: 16 Sep 2007 03:36
by funman
the link goes to an html webpage with the code
the direct link is http://trac.videolan.org/vlc/browser/tr ... format=txt

(you could have figured that by loading the page in the browser instead of saving it)