|
-
May 6th, 2002, 03:20 AM
#1
Thread Starter
Fanatic Member
Loading Winamps m3u playlist to a ListBox question
Was wondering if anyone had figured out how to load Winamp's m3u playlist to a listBox leaving out the # lines. I mean if you open up an m3u file you would or should normally see the lines containing file paths along with the #crap lines (like sample bellow). Well how would I go about populating a listBox I have with the lines containing file paths only and leave out all the lines starting with # ?
I know I could probably loop through the listBox afterward and remove these unwanted lines but I was looking for a way to do this while I'm opening up the file for Input. Thanks a bunch.
Here's a sample of an m3u playlist generated by Winamp.
#EXTM3U
#EXTINF:8,weezer - Living Without You
D:\ftp\Full Albums (mp3)\weezer - Living Without You.mp3
#EXTINF:227,01 - Razzmatazz
D:\ftp\Full Albums (mp3)\Froggy Mix - No Nagging\01 - Razzmatazz.mp3
#EXTINF:208,01 - Britney Spears - Sometimes (remix)
D:\ftp\Full Albums (mp3)\Planet Pop 2000\01 - Britney Spears - Sometimes (remix).mp3
#EXTINF:232,03 - Stay the night
D:\ftp\Full Albums (mp3)\98 Degrees - Revelation\03 - Stay the night.mp3
#EXTINF:234,03 - Could You Be Love
D:\ftp\Full Albums (mp3)\Bob Marley - Legend\03 - Could You Be Love.mp3
#EXTINF:196,06 - Get Up Stand Up
D:\ftp\Full Albums (mp3)\Bob Marley - Legend\06 - Get Up Stand Up.mp3
Here's a Sub I created to loads each lines into a listBox
Problem is, well you know, it loads every lines
VB Code:
Public Sub LoadContents(ByVal List As ListBox, ByVal sFile As String)
Dim tmpString As String
If Len(Dir(sFile)) Then ' Proceed only if file exists
Open sFile For Input As #1
Do Until EOF(1)
Line Input #1, tmpString
List.AddItem tmpString
Loop
Close #1
End If
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|