little help again (RESOLVED)
Hi all
I have received excellent help here and am back for a little more. I have an app that will write an xml file however it is currently writing it like this
<?xml version="1.0"?>
<songs>
<song path="my_mp3s\ 05 - Swamp.mp3" artist="Michael Kamen" title="05 - Swamp.mp3"/>
</songs>
But I need it to be displayed like this
<?xml version="1.0"?>
<songs>
<song path="my_mp3s/song.mp3"artist="" title=""/>
</songs>
I just need to remove the spacing nand change the slash here is the code that performs this but I'm not sure what needs changing I have played about with it but having no luck. Hop someone can help. Thanks
VB Code:
Private Sub Command2_Click()
Dim f1 As Integer, xmlpath As String, songpath As String, mp3path As String, f2 As Integer, i As Integer
Dim Artist As String, SongName As String, artname As String, fname As String, MyPath As String
Dim mytag As Boolean
mp3path = "C:\mgamerz\my_mp3s\"
xmlpath = "C:\mgamerz\ "
SongName = Dir(mp3path & "\*.mp3")
fname = mp3path & SongName
With Form4
While Not Len(SongName) = 0
' Artist = GetMP3Tag(fname)
If Not i = 0 Then
Load .Label1(i): Load .Text1(i)
.Label1(i).Top = .Label1(i - 1).Top + 350
.Text1(i).Top = .Text1(i - 1).Top + 350
.Label1(i).Visible = True: .Text1(i).Visible = True
End If
.Label1(i) = SongName
mytag = GetMP3Tag(fname)
.Text1(i) = RTrim(MP3Info.sArtist)
SongName = Dir
fname = mp3path & SongName
i = i + 1
Wend
.Height = .Text1(.Text1.Count - 1).Top + 1600
.TAG = mp3path
MDIForm1.Caption = "You must close this form before continuing"
.Show
' .WindowState = 2
End With
TAG = "wait"
While TAG = "wait"
DoEvents
Wend
i = 1
f2 = FreeFile
Open mp3path & "mp3.txt" For Output As #f2
f1 = FreeFile
Open xmlpath & "audiolist.xml" For Output As #f1
Print #f1, "<?xml version=""1.0""?>"
Print #f1, "<songs>"
SongName = Dir(mp3path & "\*.mp3")
i = 1
While Not Len(SongName) = 0
' if you can return the name of the artist you put the code in here
mytag = GetMP3Tag(mp3path & SongName)
Artist = RTrim(MP3Info.sArtist)
If Len(Artist) = 0 Then Artist = "UNKOWN"
MyPath = Right(mp3path, (Len(mp3path) - Len(xmlpath) + 1)) & " " & SongName
songpath = "<song path=""" & MyPath & """ artist=""" & Artist & """ title=""" & SongName & """/> "
Print #f1, songpath
Print #f2, SongName
Sleep 100
SongName = Dir
Wend
Print #f1, "</songs>"
Close
End Sub
Re: little help again (RESOLVED)
Brilliant - Thanks very much indeed for all the help!!
Rob