Hi all,
I have a small simple program that will create an xml file from files contained in a folder mp3s actually.
It works OK but I am trying to get rid of the .mp3 extension from the title. I need it in the filename the xml is created as below
<?xml version="1.0"?>
<songs>
<song path="my_mp3s/ ANVIL_CHORUS.MP3" title="ANVIL_CHORUS.MP3">
<song path="my_mp3s/ Black Hawk Down - Leave No Man Behind.mp3" title="Black Hawk Down - Leave No Man Behind.mp3">
<song path="my_mp3s/ Im only sleeping#.mp3" title="Im only sleeping#.mp3">
<song path="my_mp3s/ nowhere man.mp3" title="nowhere man.mp3">
</songs>
but i need to remove the .mp3 from the title like this
<song path="my_mp3s/ nowhere man.mp3" title="nowhere man">
VB Code:
Private Sub Command2_Click() Dim f1 As Integer, jpgurl As String, xmlpath As String, MyPath As String, songpath As String, slidenode As String, SongName As String, mp3path As String, f2 As Integer, i As Integer Dim Artist As String, artname As String, fname As String Dim mysong As String mp3path = "C:\Program Files\Mgamerz\my_mp3s\" xmlpath = "C:\Program Files\Mgamerz\" f2 = FreeFile Open mp3path & "mp3.txt" For Output As #f2 ' if you don't need mp3.txt take out f1 = FreeFile Open mp3path & "slides.xml" For Output As #f1 Print #f1, "<?xml version=""1.0""?>" Print #f1, "<songs>" 'Print #f1, "<pic>" SongName = Dir(mp3path & "\*.mp3") ' get first track i = 1 While Not Len(SongName) = 0 MyPath = Right(mp3path, (Len(mp3path) - Len(xmlpath))) & " " & SongName MyPath = Replace(MyPath, "\", "/") MyPath = Replace(MyPath, "", "", 1, 1) 'songpath = "<song path=""" & MyPath & """ title=""" & SongName & """/> " songpath = "<song path=""" & MyPath & """ artist=""" & Artist & """ title=""" & SongName & """> " Print #f1, songpath Print #f2, SongName ' for mp3.txt Sleep 100 ' slight pause, needed SongName = Dir ' get next track Wend ' Print #f1, "</pic>" Print #f1, "</songs>" Close End Sub
Thanks in advance




Reply With Quote