如何使用tag.ib与VB.Net编写id3v2相册艺术家

时间:2011-05-02 03:33:15

标签: vb.net taglib

我无法弄清楚如何使taglib保存使用数组的某些标签。例如,当我保存相册时,我只需输入ID31.Album = txtalubm1.text即可。但是,如果我想保存albumartist,因为它的阵列我似乎无法以同样的方式做到这一点。

任何人都知道怎么做?

2 个答案:

答案 0 :(得分:2)

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

答案 1 :(得分:-1)

辉煌!

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

它现在的工作原理如下: -

将mp3文件存储在具有相册名称的文件夹中,该文件夹位于具有艺术家姓名的文件夹下。

将文件重命名为前两个字符中的曲目编号,后跟空格,然后是标题。

使用名为txtFolder的文本框和名为cmdOK的按钮创建一个新项目。

添加taglib-sharp.dll作为参考。

运行项目。

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

此代码将修改元数据。

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