4

Here's my boggle. I use gmplayer to play all my videos. 99.9% of the time everything works fine but in that 1-in-1000 case, a video might be corrupted. gmplayer plays the video but it cries like an angry, hungry baby, popping up windows left, right and centre. In really bad videos this actually slows down the whole system as it spawns hundreds of error windows (compiz applies effects, etc). It also steals focus and occasionally cancels Christmas.

In the command-line mplayer these messages are just throw out to the command line. Using mplayer-proper might be an option if I can't use gmplayer but it's not quite as good for my needs.

I have found a workaround. If you add -msglevel all=0 to the gmplayer call, errors are suppressed. Useless from a debug perspective but I'm not attempting to debug videos here, just watch them.

What I want to do is "alias" or "proxy" the gmplayer command so when you run gmplayer from the command line or by association, it actually runs gmplayer -msglevel all=0. I gather that just adding a bash alias won't work for associated (as in double clicking on a video in gnome) plays.

What are my options for hard-proxying the command. This only needs to work for one user but I'm open to system-wide changes too.

moberley
  • 1,002
Oli
  • 299,380

6 Answers6

8

You can set this option in one f the mplayer option files, this will then be the default behaviour. For system wide change /etc/mplayer/mpplayer.conf of just for that user create ~/.mplayer/mplayer.conf and put it in there.

Adding this to ~/.mplayer/mplayer.conf works:

msglevel=all=0
Oli
  • 299,380
Stuart
  • 1,226
3

You could edit the /usr/share/applications/mplayer.desktop file to adujst the way the gmplayer command is called from the menu. Be sure to use dpkg-divert to make this change consistent locally:

$ sudo dpkg-divert /usr/share/applications/mplayer.desktop

This will tell dpkg to keep your modified version of the file in future package upgrades.

raphink
  • 1,130
1

I am not totally sure how to complish this. other than writing a script that calls your executable with flags. But I know that in Eclipse that there is a eclipse.ini file in the same directory as the excutable that allows you to pass flags. Maybe looking into that you can write a similar file for gmplayer

I hope this helps. :)

myusuf3
  • 35,659
0

The easiest way to do this, is probably the following:

  1. rename the executable in /usr/bin
  2. put in its place a script that will call the executable under the new name, that adds your argument.

    #!/bin/bash
    original-gmplayer -msglevel all=0 $@
    

Alternatively, you could put this script in the bin directory in your home, and make sure this bin directory is in your path (needs to be set system wide in order to work for applications that are not called from terminal)

Oli
  • 299,380
txwikinger
  • 29,406
0

As a different solution, use smplayer instead, which has the distinction of being actually maintained, and works great (which you cannot say of gmplayer).

loevborg
  • 7,414
-2

You can create a symlink to your command. Create a command named mygmplayer, then verify where is your actual gmplayer command with whereis or which, then create a symlink to you command. Here an example

 $ echo '#!/bin/bash' > /home/user/mygmplayer
 $ echo "gmplayer -msglevel all=0" >> /home/user/mygmplayer
 $ chmod a+x mygmplayer
 $ which gmplayer
 /usr/bin/gmplayer
 $ sudo mv /usr/bin/gmplayer /usr/bin/gmplayer.old
 $ sudo ln -s /home/user/mygmplayer /usr/bin/gmplayer

Bye.

lcipriani
  • 457