如何使用标签库与VB.Net编写id3v2专辑艺术家



我不知道如何使taglib保存使用数组的某些标签。例如,当我保存相册时,我可以输入ID31.Album = txtalubm1.text。但是如果我想保存albumartist,因为它是一个数组,我似乎不能这样做。

有人知道怎么做吗?

tagFile.Tag.AlbumArtists = New String() {"Album Artist"}

太棒了!

我的VB2010 Express mp3元数据修改程序的最后一步。

现在是这样工作的:-

将mp3文件存储在艺人名称文件夹下的带有专辑名称的文件夹中。

重命名文件,使音轨号在前两个字符中,后跟一个空格,然后是标题。

创建一个新项目,文本框名为txtFolder,按钮名为cmdOK。

添加taglib-sharp.dll作为引用。

运行项目

在文本框中输入相册的文件夹字符串作为文本,然后单击OK。

此代码将修改元数据。

Private Sub cmdOK_Click() Handles cmdOK.Click
    '
    'check folder exists
    '
    If Not My.Computer.FileSystem.DirectoryExists(txtFolder.Text) Then
        MsgBox("Folder does not exist", vbExclamation)
        Exit Sub
    End If
    '
    'set up details from folder name
    '
    LastSlash = InStrRev(txtFolder.Text, "")
    AlbumStore = Microsoft.VisualBasic.Mid(txtFolder.Text, LastSlash + 1)
    FolderStore = Microsoft.VisualBasic.Left(txtFolder.Text, LastSlash - 1)
    LastSlash = InStrRev(FolderStore, "")
    ArtistStore = Microsoft.VisualBasic.Mid(FolderStore, LastSlash + 1)
    '
    'get each file in folder
    '
    For Each foundFile As String In My.Computer.FileSystem.GetFiles(txtFolder.Text)
        If LCase(Microsoft.VisualBasic.Right(foundFile, 4)) = ".mp3" Then
            '
            'set up details from file name
            '
            LastSlash = InStrRev(foundFile, "")
            FileStore = Microsoft.VisualBasic.Mid(foundFile, LastSlash + 1)
            FileStore = Microsoft.VisualBasic.Left(FileStore, Len(FileStore) - 4)
            TrackStore = Microsoft.VisualBasic.Left(FileStore, 2)
            TitleStore = Microsoft.VisualBasic.Mid(FileStore, 4)
            '
            'set up and modify metadata
            '
            Dim mp3 As TagLib.File = TagLib.File.Create(foundFile)
            mp3.Tag.Track = Val(TrackStore)
            mp3.Tag.Title = TitleStore
            mp3.Tag.Album = AlbumStore
            mp3.Tag.Performers = New String() {ArtistStore}
            mp3.Tag.AlbumArtists = New String() {ArtistStore}
            mp3.Save()
            mp3.Dispose()
        End If
    Next
    End
End Sub

最新更新