What is proper way to specify the path to mp3 file in M3U playlists, for use playlists in hardware players, like Compact & Shelf Stereos, Micro Component Systems, Car Audio Players? I understand the path should be relative, for more reliable playback. For example, Windows Media Player m3u playlist have two dots before the leading back slash:

#EXTM3U
#EXTINF:0,Artist - Track Name (Mix).mp3
..\My Album\Artist - Track Name (Mix).mp3

Does this dots and leading back slashes make any sense for hardware players?

share|improve this question
up vote 4 down vote accepted

All the players I've seen (Windows Media Player included) accept relative paths.

The .. means one directory up. If you wanted to specify the current path, either use ., or don't specify it at all.

If you have compatibility problems, consider using regular "forward" slashes / instead. Most hardware players aren't running Windows, and most Windows software can handle the regular slashes even though Windows paths use backslashes \.

share|improve this answer
    
So if "My Folder" is in DVD root directory, I should use path "My Folder/Artist - Track Name (Mix).mp3"? – triwo Sep 5 '14 at 11:44
    
@vestix5 That's correct. – Brad Sep 5 '14 at 12:18
    
There is no need for leading slash in path? – triwo Sep 5 '14 at 12:49
    
@vestix5 No, you don't want a leading slash. That would mean go to the root of the file system. – Brad Sep 5 '14 at 13:20
    
One note: is ir possible to adjust Windows Media Player settings to make it exclude dots and leading slash from path? – triwo Sep 5 '14 at 20:13

Here is a one-line command to convert absolute to relative for an .m3u file (update playlistname and username before using):

name='playlistname'; cd /Volumes/'Mac Storage'/Music/Music/playlists; cat $name.m3u >> $name-old.m3u; LC_ALL=C sed -i '' 's/\\Users\\username\\Music\\/\.\.\//g' $name.m3u

What it means:

  • name='playlistname' - The name of the playlist.m3u file you wish to change.
  • cd ~/Music/playlists; - Navigates to the playlists folder.
  • cat playlist.m3u >> playlist-old.m3u; - Backs up your playlist before making changes.
  • sed -i '' 's/oldtext/newtext/g' playlist.m3u - In the target playlist, replaces all instances (g for global) of the oldtext (the absolute path) with newtext (the relative path: ../).
  • LC_ALL=C avoids an error that sometimes comes up: sed: RE error: illegal byte sequence.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.