patrickglass
05-07-2004, 08:14 PM
Hi i am loading playlist file information and am doing it by way of an m3u playlist file. i can save it out but to load from it does not seem to work i have tried to save it to a normal listbox but still does not work. any ideas are welcome. hope someone could give me a hint. thanks
ps i am using a listview.
Public Sub PlayerM3U(varOpen As Boolean, varPath As String)
On Error GoTo goClose
Dim varInp As String
Dim row As Integer
Dim subitem
Dim iFileID As Integer
If varOpen = True Then
iFileID = FreeFile
Open varPath For Input As #iFileID
Do Until EOF(iFileID) = True
Line Input #iFileID, varInp
If InStr("#", varInp) >= 0 Then GoTo GoNext
If varInp <> "" Then
Set subitem = Player.SongPlaylist.ListItems.Add(, , Left(varInp, Len(varInp) - 4))
subitem.SubItems(3) = Right(varInp, 4)
subitem.SubItems(2) = varInp
End If
GoNext:
Loop
Close #iFileID
Else ' this part of the code works fine
iFileID = FreeFile
Open App.Path & "\PlayerPlaylist.m3u" For Output As #iFileID
For row = 1 To Player.SongPlaylist.ListItems.Count
Print #iFileID, Player.SongPlaylist.ListItems.Item(row).SubItems(2)
Next
Close #iFileID
End If
goClose:
Close #iFileID
End Sub
ps i am using a listview.
Public Sub PlayerM3U(varOpen As Boolean, varPath As String)
On Error GoTo goClose
Dim varInp As String
Dim row As Integer
Dim subitem
Dim iFileID As Integer
If varOpen = True Then
iFileID = FreeFile
Open varPath For Input As #iFileID
Do Until EOF(iFileID) = True
Line Input #iFileID, varInp
If InStr("#", varInp) >= 0 Then GoTo GoNext
If varInp <> "" Then
Set subitem = Player.SongPlaylist.ListItems.Add(, , Left(varInp, Len(varInp) - 4))
subitem.SubItems(3) = Right(varInp, 4)
subitem.SubItems(2) = varInp
End If
GoNext:
Loop
Close #iFileID
Else ' this part of the code works fine
iFileID = FreeFile
Open App.Path & "\PlayerPlaylist.m3u" For Output As #iFileID
For row = 1 To Player.SongPlaylist.ListItems.Count
Print #iFileID, Player.SongPlaylist.ListItems.Item(row).SubItems(2)
Next
Close #iFileID
End If
goClose:
Close #iFileID
End Sub