开发者

Parse M3U file locations to fully qualified paths

开发者 https://www.devze.com 2023-03-15 03:06 出处:网络
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:

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 sol开发者_开发知识库ution that I can find. I've searched extensively for terms like "convert relative path to absolute" but no luck.

Any advice appreciated.

Thanks.


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...

0

精彩评论

暂无评论...
验证码 换一张
取 消