1

I would like to parse the file location information in an M3U playlist into fully qualified paths. The possible formats in M3U files seem to be:

c:\mydir\songs\tune.mp3

\songs\tune.mp3

..\songs\tune.mp3

For the first example, just leave it alone. For the second add the directory that the playlist resides in so it would become c:\playlists\songs\tune.mp3 and the same for the third case so it would also become: c:\playlists\songs\tune.mp3.

I'm using vb under VS2008 and I can't find a way to recognise each of the potential location formats in the M3U file. System.IO.Path offers no solution that I can find. I've searched extensively for terms like "convert relative path to absolute" but no luck.

Any advice appreciated.

Thanks.

Guy
  • 413
  • 6
  • 20
  • `..\ ` means go up one directory. If your M3U is in `C:\Playlists`, then the meaning of `..\songs\tune.mp3` is actually `C:\songs\tune.mp3` – Brad Jun 23 '11 at 13:51
  • 1
    Thanks for your comment Brad, understood. Maybe the only answer is to test for ":", "\", "..\" or none of the above at the beginning of the string. – Guy Jun 23 '11 at 21:21

1 Answers1

1

Write a batch script that just reads the m3u file line by line, and then just parse each line looking for ":" , and for "..", and edit the string as needed. You can then just write the "converted" strings to another file...

Andrew Breksa
  • 308
  • 2
  • 19