Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Imola Ghost

macrumors 65816
Original poster
Mar 21, 2009
1,153
12
Creating a playlist on a Mac with iTunes for playback in my Audi requires manually editing the .m3u file with TextEdit.

Now I'm pretty new to Mac's and was wondering if someone here has ideas to understand what's going on.

Once I create the playlist in iTunes and then export them and save them as a .m3u file. I open up TextEdit and need to edit the text to allow them to play in my car.

Programs like iTunes and VLC write absolute paths to the songs. The Audi is not a Mac and it will not have that absolute path that iTunes saves playlists. You have to open the M3U files and change them to be relative paths to where you save your M3U files.

Here is a sample of the .m3u file opened with TextEdit as it is unedited form. I've been told that I need to edit the path to .mp3 by using Find & Replace. In the sample below is the line I need to edit.

/Users/Todd/Music/MY MUSIC/S/Sex Pistols/Never Mind The Bollock's Here's The Sex Pistols/01-Holiday In The Sun.mp3



#EXTM3U
#EXTINF:202,Holiday In The Sun - Sex Pistols
/Users/Todd/Music/MY MUSIC/S/Sex Pistols/Never Mind The Bollock's Here's The Sex Pistols/01-Holiday In The Sun.mp3
#EXTINF:183,Bodies - Sex Pistols
/Users/Todd/Music/MY MUSIC/S/Sex Pistols/Never Mind The Bollock's Here's The Sex Pistols/02-Bodies.mp3
#EXTINF:170,No Feelings - Sex Pistols
/Users/Todd/Music/MY MUSIC/S/Sex Pistols/Never Mind The Bollock's Here's The Sex Pistols/03-No Feelings.mp3
#EXTINF:161,Liar - Sex Pistols
/Users/Todd/Music/MY MUSIC/S/Sex Pistols/Never Mind The Bollock's Here's The Sex Pistols/04-Liar.mp3
#EXTINF:251,Problems - Sex Pistols
/Users/Todd/Music/MY MUSIC/S/Sex Pistols/Never Mind The Bollock's Here's The Sex Pistols/05-Problems.mp3
#EXTINF:200,God Save The Queen - Sex Pistols
/Users/Todd/Music/MY MUSIC/S/Sex Pistols/Never Mind The Bollock's Here's The Sex Pistols/06-God Save The Queen.mp3
#EXTINF:122,Seventeen - Sex Pistols
/Users/Todd/Music/MY MUSIC/S/Sex Pistols/Never Mind The Bollock's Here's The Sex Pistols/07-Seventeen.mp3
#EXTINF:212,Anarchy In The Uk - Sex Pistols
/Users/Todd/Music/MY MUSIC/S/Sex Pistols/Never Mind The Bollock's Here's The Sex Pistols/08-Anarchy In The Uk.mp3
#EXTINF:252,Sub-Mission - Sex Pistols
/Users/Todd/Music/MY MUSIC/S/Sex Pistols/Never Mind The Bollock's Here's The Sex Pistols/09-Sub-Mission.mp3




Here is how my hard drive is set and of the folder structure of the music on the hard drive.

AUDI S5/ (name of the hard drive)
(PLAYLISTS)
0-9
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z



I've successfully done this once before about 2 years ago and I never messed with it again after having it working but I want to create more playlist, so I kind of forgot what I needed to do.

Someone mentioned something like editing the 2nd line for each song to be relative but can't remember what needed to be done.

I believe it was something like changing this:

/Users/Todd/Music/MY MUSIC/S/Sex Pistols/Never Mind The Bollock's Here's The Sex Pistols/01-Holiday In The Sun.mp3

To this:

/S/Sex Pistols/Never Mind The Bollock's Here's The Sex Pistols/01-Holiday In The Sun.mp3


But when I've done this & it still doesn't work in my car.

Ideas?
 
Here is a screen shot of how my drive and folder structure is:



8533d1284657346-any-apple-guys-here-screen-shot-2010-09


----------

Here's a screen shot of the unedited .m3u file.






8534d1284657346-any-apple-guys-here-screen-shot-2010-09
 
I found a Linux command which should work just fine in terminal:

Code:
echo "#EXTM3U" > playlist.m3u
find . -type f -print | sed -n -E -e 's/.*(mp3|wav|ogg|wma)/&/p' >> playlist.m3u

1 - Open terminal.

2 - cd /Volumes/nameofdevicewithmusic
3 - (type the echo and find commands above)

You should now have an m3u file with relative paths to the songs. I just tried it in my music folder and got 374 lines of relative entries in playlist.m3u.

You can put these commands in an applescript app, remembering to change to the directory containing the music as part of the script, and run the script every time you update songs on the usb stick by doubleclicking the applescript app. Let me know if you want me to paste the applescript in here. Please provide the path to the memory stick or hdd, ie /Volumes/Audi.

Here is the Applescript I wrote (and haven't had a chance to test):
Code:
do shell script "cd /Volumes/Audi S5; echo \"#EXTM3U\" > playlist.m3u;find . -type f -print | sed -n -E -e 's/.*(mp3|wav|ogg|wma)/&/p' >> playlist.m3u"
 
Last edited:
I appreciate the help. I've never created an Apple Script before but I'm interested in trying and it and this would be a great start!

Now all of the stuff I mentioned in the original post, I didn't know what absolute & relative paths were and I still don't really. If you can walk me thru a little more I'll hopefully learn something.
 
I appreciate the help. I've never created an Apple Script before but I'm interested in trying and it and this would be a great start!

Now all of the stuff I mentioned in the original post, I didn't know what absolute & relative paths were and I still don't really. If you can walk me thru a little more I'll hopefully learn something.

Absolute paths look like /Volumes/audi/d/song1.mp3
Relative paths look like d/song1.mp3 and normally don't have a leading /

The script I gave you creates the file from scratch every time. You run the script and it generates the file (and deletes the old file). If you're not comfortable in terminal, I can take a look at creating an applescript you can simply run and it will prompt you for the location where you want to make the m3u file. It's late so I'll be back tomorrow evening to take another look.

Let's get the text edit method working first and come back to the script to generate playlists. I'm still not sure why it doesn't work when you edit it in textedit. I think you can replace "/Users/Todd/Music/iTunes" with "" and it should all get cleaned up. You pick find and replace. You then type /Users/Todd/Music/iTunes in the top box and leave the replace box empty. Once you see it has highlighted the junk you want to get rid of you click all. If you are on Lion, you can simply close text edit. If you are on Snow Leopard or older, you have to choose save and then close text edit.

For instance, I noticed that my method preceded each line with ./amazon music etc so I went in textedit, picked find and replace, put ./ in the search box and left the replace box empty and hit all. Let me know if you had any luck in terminal or if you are still editing the files in textedit.
 
Very informative! Thank you!

I'll be looking for to the script and figuring this out.

I'm using Lion and one thing I noticed while messing around with the .m3u files. The ones that work have a little music note inside the little icon before the .m3u file. Now they seem to be black with a "exec" written in the top left and these don't work.
 
Last edited:
I edited my .m3u files again so that the file path starts off with the folder that the file is in and it works.

I guess I was confused with what I was replacing with and your relative & absolute file path explanation made me understand what was going on.

If you want to dig into this further with and Apple Script, I'm ok with that. It would be a learning experience anyway. If you don't it's easy enough to do the find & replace.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.