You are not logged in.

#1 2010-06-01 13:30:25

demian
Member
From: Frankfurt, Germany
Registered: 2009-05-06
Posts: 709

[solved] command line music player

Hi,

i'm looking for a very simple command line music player like mpg123 but with a server option like mocp/mpd.

Other than mocp or mpd i want it for playing files on-the-fly. Like browsing around and playing files i see in the current directory, queueing them, maybe with a curses interface like ncmpc.
As far as i know, mpg123 can't queue and doesn't run in the background per default. mocp on the other hand comes very close but i don't think it can play files out of the current working directory like i want it.

Do you know a tool that fits my description?

Thanks in advance,
demian

Last edited by demian (2010-06-01 18:21:05)


no place like /home
github

Offline

#2 2010-06-01 13:47:59

lotuskip
Member
From: Finland
Registered: 2010-04-10
Posts: 22

Re: [solved] command line music player

I would imagine mocp can do what you need. I never use it in that way, so I'm not sure, but you should take a look at the manpage if you haven't already. There is also cmus, which I haven't tried. If neither of those work for you, you might be out of luck.

Offline

#3 2010-06-01 14:14:28

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: [solved] command line music player

fwiw, i have a script i call playnow which accepts a file path and plays it through mpd.  i use it for one-off downloaded content or whatever.  it just adds it to a temp folder, quickly updates the db, adds the temp folder to the current playlist (queuing) and plays it.

it's been working well for me.  i also hear mpd accepts the file:/// uri scheme which kinda takes care of this usage case too.

Offline

#4 2010-06-01 14:33:26

rb
Member
From: Argentina
Registered: 2010-05-07
Posts: 143

Re: [solved] command line music player

Maybe mocp -a or mocp -p? I didn't dig into it, but playing songs while browsing folders on mc is definitely on my ToDo list


Sorry for my English. Feel free to point out my errors.

Offline

#5 2010-06-01 16:39:58

demian
Member
From: Frankfurt, Germany
Registered: 2009-05-06
Posts: 709

Re: [solved] command line music player

Turns out it can be done with mocp:

if which mocp &>/dev/null;then
  mplay() {
    mocp -c
    mocp -a "$@"
    mocp -p
  }
  alias madd="mocp -a"
  alias mtog="mocp -G"
  alias mkill="killall mocp"
  alias mnxt="mocp -f"
  alias mpause="mocp -P"
  alias mprev="mocp -r"
  alias mcl="mocp -c"
  alias msync="mocp -y"
fi

Thanks for the suggestions.

P.S.: playnow is not suitable for me as I have mpd installed on only one of my systems. I'll have to work on an automount solution to get goodsong (and then probably playnow too) on my other pcs working too, but there are more pressing matters right now tongue.

Last edited by demian (2010-06-01 18:16:41)


no place like /home
github

Offline

#6 2010-06-01 16:42:29

Runiq
Member
From: Germany
Registered: 2008-10-29
Posts: 1,053

Re: [solved] command line music player

brisbin33 wrote:

fwiw, i have a script i call playnow which accepts a file path and plays it through mpd.  i use it for one-off downloaded content or whatever.  it just adds it to a temp folder, quickly updates the db, adds the temp folder to the current playlist (queuing) and plays it.

it's been working well for me.  i also hear mpd accepts the file:/// uri scheme which kinda takes care of this usage case too.

As far as I know, MPD's database is updated automatically via inotify as soon as a file is added, so I think you don't even need to update before playing.

Offline

#7 2010-06-01 16:52:47

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: [solved] command line music player

Runiq wrote:
brisbin33 wrote:

fwiw, i have a script i call playnow which accepts a file path and plays it through mpd.  i use it for one-off downloaded content or whatever.  it just adds it to a temp folder, quickly updates the db, adds the temp folder to the current playlist (queuing) and plays it.

it's been working well for me.  i also hear mpd accepts the file:/// uri scheme which kinda takes care of this usage case too.

As far as I know, MPD's database is updated automatically via inotify as soon as a file is added, so I think you don't even need to update before playing.

sounds great in theory, but i'm not so sure about in practice.

for inotify to pick up the new file(s) and mpd to update itself all between bash executing `ln -s` and `mpc add` would be... impressive.  calling `mpc --wait update` manually means i only wait exactly as long as the update requires.

thanks for the advice though, maybe i'll test it out and see.

Offline

#8 2010-06-01 16:55:31

rb
Member
From: Argentina
Registered: 2010-05-07
Posts: 143

Re: [solved] command line music player

That's awesome Demian, thanks for sharing that!


Sorry for my English. Feel free to point out my errors.

Offline

#9 2010-06-01 17:56:04

dmz
Member
From: Sweden
Registered: 2008-08-27
Posts: 881
Website

Re: [solved] command line music player

Mplayer!

#!/usr/bin/perl
# mplayerd
use strict;
use App::Daemon qw(daemonize);

my @files = @ARGV or die 'Need files';
my $cmd = "mplayer -slave -input file=\$HOME/.mplayer/mplayerd.fifo";

unless(-p "$ENV{HOME}/.mplayer/mplayerd.fifo") {
  use POSIX;
  mkfifo("$ENV{HOME}/.mplayer/mplayerd.fifo", 0666) or die $!;
}

print "Daemonizing.";
daemonize();
system("$cmd \"$_\"") for @files;
echo loadfile foofile > fifo

etc...

Offline

#10 2010-06-01 17:58:45

dmz
Member
From: Sweden
Registered: 2008-08-27
Posts: 881
Website

Re: [solved] command line music player

brisbin33 wrote:

fwiw, i have a script i call playnow which accepts a file path and plays it through mpd.  i use it for one-off downloaded content or whatever.  it just adds it to a temp folder, quickly updates the db, adds the temp folder to the current playlist (queuing) and plays it.

it's been working well for me.  i also hear mpd accepts the file:/// uri scheme which kinda takes care of this usage case too.

There's also mpcplay. smile

Offline

#11 2010-06-01 18:14:57

jiyuu
Member
Registered: 2010-04-13
Posts: 63

Re: [solved] command line music player

xmms2 does what you want out of the box.

Offline

#12 2010-06-01 18:20:49

demian
Member
From: Frankfurt, Germany
Registered: 2009-05-06
Posts: 709

Re: [solved] command line music player

thanks.
but actually i'm quite comfortable with mocp now, since it's leightweight and already comes with a curses interface.


no place like /home
github

Offline

Board footer

Powered by FluxBB