LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 01-26-2011, 04:39 PM   #1
poweredbydodge
Member
 
Registered: Oct 2006
Location: Buffalo, NY
Distribution: Servers: Scientific Linux 5.x // Desktops: Fedora Core (latest)
Posts: 110

Rep: Reputation: 15
MPlayer GUI (gmplayer - NOT gnome-mplayer) single instance fix...


So I finally made the leap to a single media player. Long gone are the days of VLC + MPlayer + Xine-UI + XMMS + whatever... why bother? MPlayer (or more properly stated, its 'stock' GUI) has come well far enough that it serves as an all-in-one without repute.

So... enter my issue.

Every time I click on a music of movie file, bang, a new unique instance of the MPlayer GUI is launched, leaving me with two songs playing at once, or a song and a movie, etc... etc...

So, I putz around through the manpage, looking for an answer. There is none; and the wiki states that it is a 'known issue'.

The spin-off Gnome MPlayer front end (command is gnome-mplayer rather than gmplayer), has a 'single instance' flag that can be used, however it simply blocks you from opening a second file, rather then enqueing and auto-playing the second file clicked (whilst stopping the first one). So, it was of no help.

Then, it dawned on me... simple is simple is simple is... stupid?

gmplayer-hack.sh
Code:
#!/bin/bash
# MPLAYER GUI HACK FOR SINGLE INSTANCES WITH SELF START
#
item_to_play=$1
killall -9 gmplayer
gmplayer $item_to_play & 
#
Then simply edit your audio and video file auto launches to use /usr/bin/gmplayer-hack.sh rather than /usr/bin/gmplayer

I then proceeded to smack myself on the forehead and become ashamed for not having thought of it earlier.

I post this here for posterity, as hopefully someone else looking for the "mplayer gui prevent multiple instance or instances" fix will find it, as I searched Google to no avail for a good half hour before realizing the folly.

Enjoy,
- Vince.

Last edited by poweredbydodge; 01-26-2011 at 04:40 PM.
 
Old 01-26-2011, 05:26 PM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Quite dirty, but simple and effective. Nice job man! :P
 
Old 01-26-2011, 10:43 PM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
The big problem there is that you can only play one file at a time with it, and you can't pass it any other options.

Changing item_to_play=$1 to item_to_play="$@" will help correct that.

Even shorter: killall -9 gmplayer && gmplayer. You can set it up as an alias too.

But I personally don't see how you can think it's possible to go with a single player yet. I still run across videos that will only work correctly in one player or another. There's just too much variability involved in multimedia for any one solution to be able to handle them all.
 
Old 04-11-2011, 06:45 PM   #4
nanobahr
LQ Newbie
 
Registered: Apr 2011
Posts: 22

Rep: Reputation: 0
works great but !!!!

this script working great but if your video file name contain any spaces it wont play it !!

how to fix that ?

Last edited by nanobahr; 04-11-2011 at 07:01 PM.
 
Old 04-12-2011, 06:56 AM   #5
poweredbydodge
Member
 
Registered: Oct 2006
Location: Buffalo, NY
Distribution: Servers: Scientific Linux 5.x // Desktops: Fedora Core (latest)
Posts: 110

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by nanobahr View Post
this script working great but if your video file name contain any spaces it wont play it !!

how to fix that ?

Code:
#!/bin/bash
# MPLAYER GUI HACK FOR SINGLE INSTANCES WITH SELF START
# -- WHITESPACE FRIENDLY
#
item_to_play=$1
killall -9 gmplayer
gmplayer "$item_to_play" & 
#
there ya go.
 
Old 04-12-2011, 03:34 PM   #6
nanobahr
LQ Newbie
 
Registered: Apr 2011
Posts: 22

Rep: Reputation: 0
poweredbydodge thanks man >>>> your script working great .
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
MPlayer with GUI (gmplayer) help installing slackware 10.2! TommyBoi Linux - Software 3 02-20-2006 07:17 PM
MPlayer gui (gmplayer) will not run Blackglass Linux - Software 6 01-03-2005 06:44 AM
mplayer - no gui when gmplayer darkleaf Linux - Software 5 08-21-2004 03:34 AM
Problem with gmplayer (GUI of mplayer) Killah Linux - Software 1 09-14-2003 03:22 PM
Problem with gmplayer (GUI of Mplayer) Killah Linux - Newbie 1 09-14-2003 11:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 09:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration