The utility codec [ID Tag Update] (R4 or later) and the DSP effect ID Tag Processing (R10 or later) contain an option Externally Script Tags
Externally scripting allows tag actions to take place which could not otherwise be accommodated in dBpoweramp, the scripting language (in this example uses VB Scripting) can do almost anything to the tags. The following example simply replaces the Artist with "abc"
A command line is specified for this value, for example:
cscript.exe "z:\tag.vbs" "%idtagstxt%"
This runs the program cscript.exe which in turn executes the Tag.vbs script. The value %idtagstxt% is replaced by the filename of a temporary unicode text file containing the ID Tags, an example:
Each tag line has an element=value
Album art is listed as: _albumart_1xxxxxxxxx _albumart_2xxxxxxxxxx the latter part of the art element name represents the art type:
The code in the vb script tag.vbs:
Externally scripting allows tag actions to take place which could not otherwise be accommodated in dBpoweramp, the scripting language (in this example uses VB Scripting) can do almost anything to the tags. The following example simply replaces the Artist with "abc"
A command line is specified for this value, for example:
cscript.exe "z:\tag.vbs" "%idtagstxt%"
This runs the program cscript.exe which in turn executes the Tag.vbs script. The value %idtagstxt% is replaced by the filename of a temporary unicode text file containing the ID Tags, an example:
Code:
Title=What Up Gangsta replaygain_album_gain=-10.96 dB replaygain_album_peak=1 AccurateRipResult=AccurateRip: Accurate (confidence 143) [6E45E560] AccurateRipDiscID=019-002dabb6-028d652e-2b105113-2 Year=2003 02 06 Composer=Rob Tewlow UPC=606949354428 Style=Hardcore Rap Album=Get Rich or Die Tryin' Genre=Rap Artist=50 Cent{_MUL_}Artist2 Rating=7 replaygain_track_gain=-10.19 dB replaygain_track_peak=0.952637 Track=2/19 Disc=1/1 Album Artist=50 Cent _albumart_1_Front Album Cover=z:\tmpusr\dbpA532.tmp\18.bin
Album art is listed as: _albumart_1xxxxxxxxx _albumart_2xxxxxxxxxx the latter part of the art element name represents the art type:
Code:
32x32 Icon, (apic 1) Other Icon, (apic 2) Front Album Cover, (apic 3) Back Album Cover, (apic 4) Leaflet Page, (apic 5) Media >>CD image<<, (apic 6) Lead Artist, (apic 7) Artist, (apic 8) Conductor, (apic 9) Band, (apic 10) Composer, (apic 11) Writer, (apic 12) Recording Location, (apic 13) During Recording, (apic 14) During Performance, (apic 15) Video Capture, (apic 16) Illustration, (apic 18) Artist Logo, (apic 19) Publisher Logo (apic 20)
Code:
Const ForReading = 1, ForWriting = 2, ForAppending = 8 on error resume next ' ----------------get the filename from dbpoweramp----------------- Dim args, IDTagsTXT set args = Wscript.arguments IDTagsTXT = args(0) ' ------------------ load the tags ------------------------------- Dim Elements(), Values() LoadTags Elements, Values, IDTagsTXT ' in this example we find the artist tag and set to abc Dim IndexTag IndexTag = GetTagIdx ("aRtist", Elements) if IndexTag > -1 THEN Values(IndexTag) = "abc" end if SaveTags Elements, Values, IDTagsTXT '----------------------------------------------------------------------- '----------------------------------------------------------------------- '----------------------------------------------------------------------- '----------------------------------------------------------------------- '----------------------------------------------------------------------- '----------------------------------------------------------------------- '----------------------------------------------------------------------- '------------------load the tags to the array---------------------------- Sub LoadTags(Elements(), Values(), IDTagsTXT) Dim fso, objFileRead, TagCount TagCount = 0 Set fso = CreateObject("Scripting.FileSystemObject") Set objFileRead = fso.OpenTextFile(IDTagsTXT, ForReading, 0, -1) Do While objFileRead.AtEndOfStream <> True Dim Line, EqualPos, TagName, TagValue Line = objFileRead.ReadLine EqualPos = InStr(1, Line, "=", vbTextCompare) If EqualPos > 0 Then TagName = Left(Line, EqualPos -1) TagValue = Right(Line, Len(Line) - EqualPos) AddTag Elements, Values, TagName, TagValue, TagCount End If Loop objFileRead.Close() End Sub '------------------Save the tags to the array---------------------------- Sub SaveTags (Elements(), Values(), IDTagsTXT) Dim fso, objFileRead, TagCount TagCount = 0 Set fso = CreateObject("Scripting.FileSystemObject") fso.DeleteFile(IDTagsTXT) Set objFileRead = fso.OpenTextFile(IDTagsTXT, ForWriting, true, -1) for i = 0 to UBound(Elements) if (Len(Elements(i)) > 0) Then Dim ToWrite ToWrite = Elements(i) + "=" + Values(i) objFileRead.WriteLine(ToWrite) End if next objFileRead.Close() End Sub '------------------adds a tag to the array---------------------------- Sub AddTag (Elements(), Values(), Element, Value, ByRef TagCount) if (Len(Element) > 0) then ReDim Preserve Elements(TagCount + 1) ReDim Preserve Values(TagCount + 1) Elements(TagCount) = Element Values(TagCount) = Value TagCount = TagCount + 1 end if End Sub '------------------finds a tag index, returns -1 if not there---------------------------- Function GetTagIdx (Need, Elements()) GetTagIdx = -1 For i = 0 to Ubound(Elements) If StrComp(Elements(i), Need, vbTextCompare) = 0 Then GetTagIdx = i Exit for End if Next End Function
Comment