Daten in mp3 ändern
09.06.2014 14:20:32
Fred
Hallo miteinander,
es gelingt mir die Tags von mp3-Dateien auszulesen. Nun möchte ich die Titel der Songs in der mp3-Datei ändern.
Ich suche eine einfache Lösung ohne DLL's, ohne hunderte Zeilen von Code,... und habe das Gefühl recht nah dran zu sein. Nach erfolgloser Suche im WWW und hier wende ich mich an Euch:
In Tabelle1 steht dabei in
Ich kann auch bereits den Titel ändern mit folgendem Code aber es zerlegt andere Tags.
Wie muss ich was bei "Put #1,,.NewSongTitle" ändern?
Danke für sachdienliche Hinweise,
Fred
PS. Hier mein Code:
Private Type TagInfo
Tag As String * 3
Songname As String * 30
artist As String * 30
album As String * 30
year As String * 4
comment As String * 30
genre As String * 1
End Type
Dim FileName As String
Dim CurrentTag As TagInfo
Sub Command1_Click()
StartRow = 3
For i = 1 To 1
FileName = Worksheets("Tabelle1").Cells(StartRow + i, 1).Value
If FileName <> "" Then
Open FileName For Binary As #1
With CurrentTag
Get #1, FileLen(FileName) - 127, .Tag
Get #1, , .Songname
Get #1, , .artist
Get #1, , .album
Get #1, , .year
Get #1, , .comment
Get #1, , .genre
txtTitle = RTrim(.Songname)
txtArtist = RTrim(.artist)
txtAlbum = RTrim(.album)
txtYear = RTrim(.year)
txtComment = RTrim(.comment)
temp = RTrim(.genre)
txtGenreCode = Asc(temp)
End With
Close #1
Worksheets("Tabelle1").Cells(StartRow + i, 3).Value = txtTitle
Worksheets("Tabelle1").Cells(StartRow + i, 4).Value = txtArtist
Worksheets("Tabelle1").Cells(StartRow + i, 5).Value = txtAlbum
Worksheets("Tabelle1").Cells(StartRow + i, 6).Value = txtYear
Worksheets("Tabelle1").Cells(StartRow + i, 7).Value = txtComment
Worksheets("Tabelle1").Cells(StartRow + i, 8).Value = temp
Worksheets("Tabelle1").Cells(StartRow + i, 9).Value = txtGenreCode
NewSongTitle = Worksheets("Tabelle1").Cells(StartRow + i, 2).Value
Open FileName For Binary As #1
With CurrentTag
Put #1, FileLen(FileName) - 127, .Tag ' <--- Hier hapert es <---
Put #1, , NewSongTitle ' <--- Hier hapert es <---
Put #1, , txtArtist
Put #1, , txtAlbum
Put #1, , txtYear
Put #1, , txtComment
Put #1, , txtGenreCode
End With
Close #1
Else
Exit Sub
End If
Next i
End Sub