|
参考代码
Public Enum TagItem
Album
BeatsPerMinute
Comments
CopyrightHolder
CopyrightYear
FileId
Genre
ISRC
Label
LeadArtist
Movie
PartOfSet
Title
TrackPosition
Year
End Enum
Public Function GetTagItem(ByVal Path As String, ByVal Item As TagItem) As String
Dim id3Tag As Object ' CDDBCONTROLLib.CddbID3Tag
Set id3Tag = CreateObject("CDDBControl.CddbID3Tag")
id3Tag.LoadFromFile Path, True
Select Case Item
Case Album: GetTagItem = id3Tag.Album
Case BeatsPerMinute: GetTagItem = id3Tag.BeatsPerMinute
Case Comments: GetTagItem = id3Tag.Comments
Case CopyrightHolder: GetTagItem = id3Tag.CopyrightHolder
Case CopyrightYear: GetTagItem = id3Tag.CopyrightYear
Case FileId: GetTagItem = id3Tag.FileId
Case Genre: GetTagItem = id3Tag.Genre
Case ISRC: GetTagItem = id3Tag.ISRC
Case Label: GetTagItem = id3Tag.Label
Case LeadArtist: GetTagItem = id3Tag.LeadArtist
Case Movie: GetTagItem = id3Tag.Movie
Case PartOfSet: GetTagItem = id3Tag.PartOfSet
Case Title: GetTagItem = id3Tag.Title
Case TrackPosition: GetTagItem = id3Tag.TrackPosition
Case Year: GetTagItem = id3Tag.Year
End Select
Set id3Tag = Nothing
End Function
Public Sub SetTagItem(ByVal Path As String, ByVal Item As TagItem, ByVal Value As String)
Dim id3Tag As Object ' CDDBCONTROLLib.CddbID3Tag
Set id3Tag = CreateObject("CDDBControl.CddbID3Tag")
id3Tag.LoadFromFile Path, False
Select Case Item
Case Album: id3Tag.Album = Value
Case BeatsPerMinute: id3Tag.BeatsPerMinute = Value
Case Comments: id3Tag.Comments = Value
Case CopyrightHolder: id3Tag.CopyrightHolder = Value
Case CopyrightYear: id3Tag.CopyrightYear = Value
Case FileId: id3Tag.FileId = Value
Case Genre: id3Tag.Genre = Value
Case ISRC: id3Tag.ISRC = Value
Case Label: id3Tag.Label = Value
Case LeadArtist: id3Tag.LeadArtist = Value
Case Movie: id3Tag.Movie = Value
Case PartOfSet: id3Tag.PartOfSet = Value
Case Title: id3Tag.Title = Value
Case TrackPosition: id3Tag.TrackPosition = Value
Case Year: id3Tag.Year = Value
End Select
id3Tag.SaveToFile Path
Set id3Tag = Nothing
End Sub |
|