Hi Guys
Could somebody please look at this code and maybe help me with a better way to do this, the idea is to check each mp3 file tag, if there is missing needed info in the tag it moves it to a error directory for checking, if all needed fields are present then moves to another folder
cheers
jimbo
Dim ds As ID3Lib = New ID3Lib(Fl)
Dim x As Boolean = False
Dim ErrTagAlbum = TagErrorDirectory & "\" & " Missing Album Info " & "\" & flnm
Dim ErrTagTitle = TagErrorDirectory & "\" & " Missing Title Info " & "\" & flnm
Dim ErrTagGenre = TagErrorDirectory & "\" & " Missing Genre Info " & "\" & flnm
Dim ErrTagArtist = TagErrorDirectory & "\" & " Missing Artist Info " & "\" & flnm
Dim ErrTagDisc = TagErrorDirectory & "\" & " Missing Disc No Info " & "\" & flnm
Dim ErrTagTrack = TagErrorDirectory & "\" & " Missing Track No Info " & "\" & flnm
Dim errTagArtwork = TagErrorDirectory & "\" & " Missing Artwork Info " & "\" & flnm
Dim errTagYear = TagErrorDirectory & "\" & " Missing Year Info " & "\" & flnm
Dim errTagAccompaniment = TagErrorDirectory & "\" & " Missing Accompaniment Info " & "\" & flnm
Dim ErrTagTolong = TagErrorDirectory & "\" & " Tag Too long " & "\" & flnm
Dim ErrTagUnknown = TagErrorDirectory & "\" & " Unknown Tag Error " & "\" & flnm
Try
If (ds.thisID3Tag.Album) = "" Then
TagErrorTB.Text = TagErrorTB.Text + 1
My.Computer.FileSystem.MoveFile(Fl, ErrTagAlbum, True)
ds = Nothing
Continue For
End If
If (ds.thisID3Tag.Title) = "" Then
TagErrorTB.Text = TagErrorTB.Text + 1
My.Computer.FileSystem.MoveFile(Fl, ErrTagTitle, True)
ds = Nothing
Continue For
End If
If (ds.thisID3Tag.Genre) = "" Then
TagErrorTB.Text = TagErrorTB.Text + 1
My.Computer.FileSystem.MoveFile(Fl, ErrTagGenre, True)
ds = Nothing
Continue For
End If
If (ds.thisID3Tag.Artist) = "" Then
TagErrorTB.Text = TagErrorTB.Text + 1
My.Computer.FileSystem.MoveFile(Fl, ErrTagArtist, True)
ds = Nothing
Continue For
End If
If (ds.thisID3Tag.DiscNumber) = "" Then
TagErrorTB.Text = TagErrorTB.Text + 1
My.Computer.FileSystem.MoveFile(Fl, ErrTagDisc, True)
ds = Nothing
Continue For
End If
If (ds.thisID3Tag.TrackNumber) = "" Then
TagErrorTB.Text = TagErrorTB.Text + 1
My.Computer.FileSystem.MoveFile(Fl, ErrTagTrack, True)
ds = Nothing
Continue For
End If
If (ds.thisID3Tag.Accompaniment) = "" Then
TagErrorTB.Text = TagErrorTB.Text + 1
My.Computer.FileSystem.MoveFile(Fl, ErrTagTrack, True)
ds = Nothing
Continue For
End If
If ds.thisID3Tag.Accompaniment.Length > 50 Then
TagErrorTB.Text = TagErrorTB.Text + 1
My.Computer.FileSystem.MoveFile(Fl, ErrTagTolong, True)
ds = Nothing
Continue For
End If
If (ds.thisID3Tag.PictureList.Count) < 1 Then
TagErrorTB.Text = TagErrorTB.Text + 1
My.Computer.FileSystem.MoveFile(Fl, errTagArtwork, True)
ds = Nothing
Continue For
End If
If ds.thisID3Tag.RecordingTimestamp > "" Then
ds.thisID3Tag.RecordingTimestamp = ds.thisID3Tag.RecordingTimestamp.Substring(0, 4)
Else
If ds.thisID3Tag.DateRecorded > "" Then
ds.thisID3Tag.RecordingTimestamp = ds.thisID3Tag.DateRecorded.Substring(0, 4)
Else
If ds.thisID3Tag.RecordingDates > "" Then
ds.thisID3Tag.RecordingTimestamp = ds.thisID3Tag.RecordingDates.Substring(0, 4)
Else
If ds.thisID3Tag.ReleaseTimestamp > "" Then
ds.thisID3Tag.RecordingTimestamp = ds.thisID3Tag.ReleaseTimestamp.Substring(0, 4)
Else
If ds.thisID3Tag.OriginalReleaseYear > "" Then
ds.thisID3Tag.RecordingTimestamp = ds.thisID3Tag.OriginalReleaseYear.Substring(0, 4)
Else
If ds.thisID3Tag.Year > "" Then
ds.thisID3Tag.RecordingTimestamp = ds.thisID3Tag.Year.Substring(0, 4)
Else
TagErrorTB.Text = TagErrorTB.Text + 1
My.Computer.FileSystem.MoveFile(Fl, errTagYear, True)
ds = Nothing
Continue For
End If
End If
End If
End If
End If
End If
If ds.thisID3Tag.RecordingTimestamp.Length > 3 Then
ds.thisID3Tag.RecordingTimestamp.Trim({"-"c})
ds.thisID3Tag.RecordingTimestamp = ds.thisID3Tag.RecordingTimestamp.Substring(0, 4)
Else
TagErrorTB.Text = TagErrorTB.Text + 1
My.Computer.FileSystem.MoveFile(Fl, errTagYear, True)
ds = Nothing
Continue For
End If
Jimbo