Sometimes you will need to change ID3 tags in a batch process.
This code is using CDDBControl.dll, which is suplied with Creative SoundBlaster extigy drivers and software.
Next code let's you change some ID3 metadata in one mp3 file.
Dim id3 'As New CddbID3Tag
Set id3 = CreateObject("CDDBControl.CddbID3Tag")
id3.LoadFromFile "Z:\Work\94.01.09 rozsivani a sklizeni.mp3", False
id3.Album = " ivot za ivot"
id3.Title = "Bo rozs v n a sklize "
id3.CopyrightHolder = "Fotobit, s.r.o."
id3.CopyrightYear = "2005"
id3.FileId = "Ab-33-00025"
id3.Genre = "Speech"
id3.ISRC = "Ab-33-00025"
id3.LeadArtist = "Alexandr Flek"
id3.PartOfSet = "1"
id3.Year = "1994/01/09 10:00"
id3.Comments = "Remaster k z n 1 "
id3.SaveToFile "Z:\Work\94.01.09 rozsivani a sklizeni.mp3"
|
Second code is a VBScript batch which let's you
change Artist field in all music or other sound mp3 files in one folder.
'Batch change ID3 tag Author In folder files
'2005 Antonin Foller, Motobit Software
Sub ChangArtist(sFolder, Artist)
'get FileSystemObject To enumerate files
Dim FS: Set FS = CreateObject("Scripting.FileSystemObject")
'Get id3 object To change data
Dim id3: Set id3 = CreateObject("CDDBControl.CddbID3Tag")
'Enumerate folder files
Dim File
For Each File In FS.GetFolder(sFolder).Files
'Select only mp3 files In the folder
If LCase(Right(File.Name, 4)) = ".mp3" Then
'Load id3 data from the file
id3.LoadFromFile File.Path, False
'Change Artist In the id3 data
id3.LeadArtist = Artist
'Save modified id3 data To the file
id3.SaveToFile File.Path
End If
Next
End Sub
|
Initialize CddbID3Tag in Net (ASP, VB.Net, C#)
1. Register the CDDBControl.dll file on your system (by regsvr32)
2. Go to menu Project -> Add reference -> Com tab -> Browse
Select CDDBControl.dll file, click Open and OK.
3. Use the object in your code. You can write (VB.Net):
'Create CddbID3Tag object
Dim ID3 As New CDDBCONTROLLib.CddbID3Tag
'Load ID3 data from a file
ID3.LoadFromFile("Z:\bozi rozsivani a sklizeni v r. 94.mp3", False)
'...
|
CDDBControl on web
Find more about
CDDBControl.dll
Class CddbID3Tag
GUID: {D734EAE8-0810-4513-99B6-DDAC4BC30E29}
HelpString: CddbID3Tag Class
Interfaces:
Interface ICddbID3Tag
GUID: {0306D2A8-B7E2-4EA2-ADC6-78F80D65B1E2}
HelpString: ICddbID3Tag Interface
Members:
Sub QueryInterface(riid as GUID, ppvObj as Void)
Function AddRef as VT_UI4
Function Release as VT_UI4
Sub GetTypeInfoCount(pctinfo as VT_UINT)
Sub GetTypeInfo(itinfo as VT_UINT, lcid as VT_UI4, pptinfo as Void)
Sub GetIDsOfNames(riid as GUID, rgszNames as VT_I1, cNames as VT_UINT, lcid as VT_UI4, rgdispid as Long)
Sub Invoke(dispidMember as Long, riid as GUID, lcid as VT_UI4, wFlags as VT_UI2, pdispparams as DISPPARAMS, pvarResult as Variant, pexcepinfo as EXCEPINFO, puArgErr as VT_UINT)
Property Get Album as String [property Album]
Property Put Album as String [property Album]
Property Get Movie as String [property Movie]
Property Put Movie as String [property Movie]
Property Get Title as String [property Title]
Property Put Title as String [property Title]
Property Get CopyrightYear as String [property CopyrightYear]
Property Put CopyrightYear as String [property CopyrightYear]
Property Get CopyrightHolder as String [property CopyrightHolder]
Property Put CopyrightHolder as String [property CopyrightHolder]
Property Get Comments as String [property Comments]
Property Put Comments as String [property Comments]
Property Get Label as String [property Label]
Property Put Label as String [property Label]
Property Get BeatsPerMinute as String [property BeatsPerMinute]
Property Put BeatsPerMinute as String [property BeatsPerMinute]
Property Get LeadArtist as String [property LeadArtist]
Property Put LeadArtist as String [property LeadArtist]
Property Get PartOfSet as String [property PartOfSet]
Property Put PartOfSet as String [property PartOfSet]
Property Get TrackPosition as String [property TrackPosition]
Property Put TrackPosition as String [property TrackPosition]
Property Get Year as String [property Year]
Property Put Year as String [property Year]
Property Get Genre as String [property Genre]
Property Put Genre as String [property Genre]
Property Get FileId as String [property FileId]
Property Put FileId as String [property FileId]
Property Get ISRC as String [property ISRC]
Property Put ISRC as String [property ISRC]
Sub LoadFromFile(Filename as String, Readonly as Long) [method LoadFromFile]
Sub BindToFile(Filename as String, Readonly as Long) [method BindToFile]
Sub SaveToFile(Filename as String) [method SaveToFile]
Sub Commit [method Commit]
Sub Clear [method Clear]
Sub LoadFromBuffer(Buffer as Variant, BufferSize as Long) [method LoadFromBuffer]
Function GetBufferSize as Long [method GetBufferSize]
Sub SaveToBuffer(Buffer as Variant, BufferSize as Long) [method SaveToBuffer]
Function GetTextFrame(Frame as String) as String [method GetTextFrame]
Sub SetTextFrame(Frame as String, Text as String) [method SetTextFrame]
Copyright and use this code
The source code on this page and other samples at
https://www.motobit.com/tips/
are a free code, you can use it as you want: copy it, modify it, use it in your products, ...
If you use this code, please:
1. Leave the author note in the source.
or
2. Link this sample from you page.
<A
Href="https://www.motobit.com/tips/detpg_change-id3-tags-script/"
Title="Let's you read and replace ID3
tags in meadia files (mp3)
with VB Script batch in
ASP, WSH or ASP.Net."
>Batch change of ID3 tags by VB Script in MP3 and other files.</A>