You are not logged in.
Pages: 1
How do I playback a folder with MPlayer from commandline? I can play it like this:
$mplayer /Music/xxxx/*.flac or $mplayer /Music/xxxx/0*
Is there a command where I dont need to specify filetype or tracknumber.
Offline
mplayer /Music/xxxx/*
That should do it, I think...
Offline
can't you just use:
mplayer /Music/xxxx/*oops, beaten too it.
Last edited by evr (2010-02-23 16:00:43)
Offline
Of course! Did not think of that. Thank you
Offline
It's still kind of uncomfortable if it's a folder with several layers of subfolders...
I've been asking myself the same question (doing the wildcard up until now).
I mean, it rarely happens that I want to play more than one layer (with wildcards it would be for example ~/Music/Angoyle Durb and the substituting little stars/*/*) but for times when it gets more complicated it'd be nice to have a more elegant solution.
I've tried to do this 'mplayer "$(find ~/Music/Angoyle Durb and the substituting little stars/)"' but it would give me nothing. Even though some claims of playing it. I think this is kind of the way. There must be just something I don't know about...
Offline
How about ~/Music/** ? You may have to enable bash's globstar option though.
Offline
but for times when it gets more complicated it'd be nice to have a more elegant solution.
To tune the list carefully, you can try the -playlist option, feeding mplayer a prepared playlist (ASX, Winamp, SMIL, or one-file-per-line format)
I've tried to do this 'mplayer "$(find ~/Music/Angoyle Durb and the substituting little stars/)"' but it would give me nothing.
I don't know why you're not escaping the spaces, (zsh?
). Anyway, try something like this:
mapfile -t files < <(find ~/Music/Angoyle\ Durb\ and\ the\ substituting\ little\ stars/)
mplayer "${files[@]}"You shouldn't put double quotes around $(find ...) since this way mplayer will try to play this one big long filename.
Last edited by lolilolicon (2010-02-24 12:32:14)
This silver ladybug at line 28...
Offline
You can pass the find argument directly to mplayer even with spaces in the filenames by just removing spaces from bash's field separator.
Default IFS is <space><tab><newline>, so try:
IFS=$'\n'
mplayer $(find ~/Music/Angoyle\ Durb* -type f)
Offline
-exec command {} +
This variant of the -exec action runs the specified command on the selected files, but
the command line is built by appending each selected file name at the end; the total num‐
ber of invocations of the command will be much less than the number of matched files.
The command line is built in much the same way that xargs builds its command lines. Only
one instance of `{}' is allowed within the command. The command is executed in the
starting directory.
sound like
find ./ -whatever -exec mplayer {} \+would be much cleaner; i've not tested this though.
//github/
Offline
@brisbin33: you would lose some functionality like moving in the playlist.
Offline
Procyon i always defer to your wisdom, but wouldn't all of these methods result in the same command (and suffer any loss of function) in the end?
mplayer file1 file2 file3
just different ways to get the file list as arguments to mplayer.
//github/
Offline
Ah ha, -exec +. Didn't notice that and I've never seen it used. Nice one.
Offline
I don't know why you're not escaping the spaces, (zsh?
).
Nope I just forgot adding them in the example. Usually I let them be added by Tab-completion or when my target is nonexistent I use quotes.
You shouldn't put double quotes around $(find ...) since this way mplayer will try to play this one big long filename.
Okay, makes sense. I was actually thinking that this way I could solve the problem that the list given by find doesn't escape the spaces (for which Procyon's solution is nice). Thanks to both of you!
How about ~/Music/** ? You may have to enable bash's globstar option though.
Nice! This might be just the right solution for me. Small and functional. I'm going to check it out later.
And thanks, brisbin33, for reminding me of find's power ![]()
And mapfile sounds interesting, too. No manpage though. I'm going to check the Ecyclopaedia Britannica on it.
All covered
Thanks!
Offline
Pages: 1