2011-05-02 2 views
0

taglib에서 배열을 사용하는 특정 태그를 저장하는 방법을 알 수 없습니다. 예를 들어 앨범을 저장할 때 ID31.Album = txtalubm1.text을 입력하면됩니다. 그러나 내가 앨범 아트를 저장하고 싶다면 그 배열을 생각해 보면 같은 방식으로하는 것처럼 보인다.작성하는 방법 id3v2 앨범 아티스트 taglib with VB.Net

누구든지이 작업을 수행하는 방법을 알고 있습니까?

답변

2
tagFile.Tag.AlbumArtists = New String() {"Album Artist"} 
-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 
+0

원본 q보다 훨씬/대답이 많은 것 같습니다. 실제 질문에 대한 답변이 몇 줄이면 안됩니까? –

관련 문제