LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 07-18-2009, 08:52 AM   #1
shogun1234
Member
 
Registered: May 2004
Posts: 167

Rep: Reputation: 15
mplayer playlist syntax


I encountered a problem when playing mplayer using argument `-playlist'. The command used is `mplayer -playlist x.list`

The content in the x.list looks like

Code:
/path/to/folder/music\ category/\[abc\]\ file\_name.mp3
or

Code:
/path/to/folder/music\ category/\(abc\)\ file\_name.mp3
is this the correct syntax for playlist?

I can ls the file name when using e.g.
Code:
ls /path/to/folder/music\ category/\[abc\]\ file\_name.mp3
but the mplayer keeps saying `file not found' and `failed to open file /path/to/...mp3'

Where did I do it wrong?

env: debian lenny, mplayer 1.0rc2-4.3.2-DFSG-free

Thanks,
 
Old 07-18-2009, 10:29 AM   #2
jdkaye
Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,037

Rep: Reputation: Disabled
Quote:
Originally Posted by shogun1234 View Post
I encountered a problem when playing mplayer using argument `-playlist'. The command used is `mplayer -playlist x.list`

The content in the x.list looks like

Code:
/path/to/folder/music\ category/\[abc\]\ file\_name.mp3
or

Code:
/path/to/folder/music\ category/\(abc\)\ file\_name.mp3
is this the correct syntax for playlist?

I can ls the file name when using e.g.
Code:
ls /path/to/folder/music\ category/\[abc\]\ file\_name.mp3
but the mplayer keeps saying `file not found' and `failed to open file /path/to/...mp3'

Where did I do it wrong?

env: debian lenny, mplayer 1.0rc2-4.3.2-DFSG-free

Thanks,
I don't think /path/to/... belongs in the path unless you have a truly weird file system. You have to put the real path to your mp3's. "/path/to", which I guess you got from the instructions is just a reminder to you to put the path to your mp3's based on their location in your system. It doesn't belong in your play list file.
cheers,
jdk

Last edited by jdkaye; 07-18-2009 at 10:30 AM.
 
Old 07-18-2009, 11:12 AM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950
In it's most basic form, a playlist is simply a text file containing a list of files or urls to play. Of course there are different playlist formats like .m3u that also add things like metadata fields to make reading the file info easier for the player, but I think most programs like mplayer can read plain text lists.

First of all, you have files with shell "restricted" characters in them. When using pathnames from the shell, there are certain characters that the shell (bash usually) sees as special, These include spaces, parentheses and brackets, quote marks, question marks and exclamation points, asterisks, the tilde and more. Filenames with these characters can be used, but they are more difficult to process; you have to escape them first. This can be done two ways. You can use a backslash in front of each one (like your examples show), or you can quote the entire string. When you use tab-completion to ls your files, bash automatically inserts the backslash escapes.

But in playlists you usually don't need the escapes. Since the paths are being processed directly by the program and not the shell, they can be read literally. So in this case try removing all the backslash escapes (\), and see if that helps. My tests with mplayer show that it can't handle escapes or quotes in playlists.


In any case, it's usually recommended to (at the very least) not use spaces in your filenames, since they cause the most headaches. The fewer restricted characters you use, the less hassles you'll have. Most Linux users will replace spaces in filenames with underscores or hyphens instead.


By the way, one convenient thing you can do for playlist lines is to use relative pathnames. In other words, use ./ for the current directory, and ../ for the directory above it, just as you would in the shell. So if my playlist is in /home/david/music, and my files are in /home/david/music/artistname, I can use

./artistname/filename.mp3

This is nice because the playlist will still work if you move the entire tree to another location, as long as the relative locations of the playlist and files remain the same.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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... Playlist... I don't know how to use it!!! reed68 Linux - Software 2 02-26-2008 10:54 AM
mplayer playlist help nutthick Linux - Software 2 05-10-2006 08:10 AM
mplayer playlist zeus_iit Linux - Newbie 1 04-02-2005 07:10 PM
using mplayer with .asx without -playlist? Would be useful for mplayer plug-in pierrethibault Linux - Software 1 02-18-2005 09:12 AM
mplayer playlist enzo250gto Linux - Software 7 09-07-2002 03:15 AM


All times are GMT -5. The time now is 07:39 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration