Add composer if title matches from text file?

Hmm ..., yes, I think so, for example:
YOUR_SEARCH_TAG_FIELD can be a combination of two tagfields %TAG_1%%TAG_2%.
The first column in YOUR_LOOKUP_FILE must contain values of possible %TAG_1%%TAG_2% content. Each search tagfield should be formatted to a proper fixed width, i. e. padded with space or underline characters. Each search entry in the lookup file has to be unique.

COL1_____COL2_|COL3

aaa______bbb__|result1
abcdef___bbb__|result2
abc______ddddd|result3

DD.20071219.1219.CET

I actually like this concept Dev. However, looking at your MTA's, there are surely things the user needs to change to fit there set up. How many of the things in there need to be changed to make it a smooth run, I can figure out that "YOUR_FILE_PATH_TO_LOOKUP_TXT" is obviously the path to the file on my computer for example. However, what about a lot of these other things, "LOOKUP_RESULT", "LOOKUP_SEARCH" I haven't much clue on which or if any of these need replacing and if so, with what.

Perhaps some 'Assistance for Dummies'? :slight_smile:

Hmm, I will try it. :slight_smile:

A Mp3tag MTA file internally looks something like a wellknown standard INI-File.
There are sections (e.g. '[#0]' ) containing pairs of 'key=value' sequences (e.g. 'T=5').
Each section describes one action dialog that is involved in a Mp3tag action group.

Example:

[#0]
T=5
F=LOOKUP_SEARCH_TAG
1=YOUR_SEARCH_TAG_FIELD

Meaning:
'T=5': This stands for Mp3tag Actiontype 5, i. e. 'Format tag field'.
'F=LOOKUP_SEARCH_TAG': This is the name of the tag field to change or create.
'1=YOUR_SEARCH_TAG_FIELD': This stands for the Formatstring to use for formatting.

In the MTA file from above there are used some tag fields to store temporary results.
The temporary tags will be cleaned up at end of the actionscript by a 'Remove fields' action, e. g.

[#11]
T=9
F=LOOKUP_SEARCH;LOOKUP_RESULT;LOOKUP_POS;LOOKUP_LEN

You don't need to alter these names, at end they are not relevant.

In the MTA file from above I've used symbolic names beginning with 'YOUR_' to identify Formatstrings or tagfield names you may wish to modify resp. you have to adapt to your needs:
'%YOUR_SEARCH_TAG_FIELD%' can be '%artist%'
'YOUR_RESULT_TAG_FIELD' can be 'artist_new'
'YOUR_FILE_PATH_TO_LOOKUP_TXT' can be '"C:\Some Folder\Some File.txt"'

I hope my explanations will help to understand.

DD.20080211.1259.CET

Who would have ever thought that the fields needing changed would be labeled with a "YOUR"... silly me. Good looks for clearing it up though, fixed it right up and appears to be working like a charm! Props.

I feel like I'm close to getting your action to work, but it doesn't seem to be working. I'm using the action for a slightly different purpose (to match artists with a defined genre list) so my lookup text follows this format %ALBUMARTIST%|%GENRE% and looks like

Aerosmith|Rock
Bob Marley & The Wailers|Reggae
Britney Spears|Pop

and I've modified the your action's variables:

YOUR_SEARCH_TAG_FIELD: %albumartist%
YOUR_FILE_PATH_TO_LOOKUP_TXT: C:\Lookup.txt
YOUR_RESULT_TAG_FIELD: GENRE

But I'm getting nothing. Any suggestions?


Maybe there are some writing errors like missing percent characters or something else?

  1. I have created four test files ...
    20151129.Test.ZipLock98.zip (960 Bytes)

  2. I have applied the following Action Group ...

Begin Action Group Test2015#20151129.Lookup.2 (ZipLock98)

Action #1
Actiontype__: Format value
Field ______: LOOKUP_SEARCH_TAG
Formatstring: %ALBUMARTIST%

Action #2
Actiontype__: Import text file
Field __: LOOKUP_INPUT
Filename: T:\TEST\20151129.Test.ZipLock98\Lookup.txt

Action #3
Actiontype__: Format value
Field ______: LOOKUP_INPUT
Formatstring: $char(10)%LOOKUP_INPUT%$char(13)

Action #4
Actiontype__: Format value
Field ______: LOOKUP_RESULT
Formatstring: %LOOKUP_INPUT%

Action #5
Actiontype__: Format value
Field ______: LOOKUP_SEARCH
Formatstring: (.$char(10)%LOOKUP_SEARCH_TAG%$char(92)$char(124).?$char(13)).*

Action #6
Actiontype__: Format value
Field ______: LOOKUP_RESULT
Formatstring: $regexp(%LOOKUP_RESULT%,%LOOKUP_SEARCH%,$1)

Action #7
Actiontype__: Format value
Field ______: LOOKUP_SEARCH
Formatstring: ^.$char(10)%LOOKUP_SEARCH_TAG%$char(92)$char(124)(.?)$char(13)$

Action #8
Actiontype__: Format value
Field ______: LOOKUP_RESULT
Formatstring: $regexp(%LOOKUP_RESULT%,%LOOKUP_SEARCH%,$1)

Action #9
Actiontype__: Format value
Field ______: YOUR_RESULT_TAG_FIELD
Formatstring: $if($eql(%LOOKUP_RESULT%,%LOOKUP_INPUT%),,%LOOKUP_RESULT%)

Action #10
Actiontype__: Remove fields
Fields to remove (semicolon separated): LOOKUP_INPUT;LOOKUP_SEARCH_TAG;LOOKUP_SEARCH;LOOKUP_RESULT

End Action Group Test2015#20151129.Lookup.2 (ZipLock98) (10 Actions)

Test2015_20151129.Lookup.2__ZipLock98_.zip (474 Bytes)

  1. After a test of the Action Group against the four test files a further report has given this output ...
^

_PATH:'T:\TEST\20151129.Test.ZipLock98\Track.1.mp3'
ALBUMARTIST:'Britney Spears'
TITLE:'Title A'
YOUR_RESULT_TAG_FIELD:'Pop'
$
^
_PATH:'T:\TEST\20151129.Test.ZipLock98\Track.2.mp3'
ALBUMARTIST:'Bob Marley & The Wailers'
TITLE:'Title B'
YOUR_RESULT_TAG_FIELD:'Reggae'
$
^
_PATH:'T:\TEST\20151129.Test.ZipLock98\Track.3.mp3'
ALBUMARTIST:'ZipLock98'
TITLE:'Title C'
$
^
_PATH:'T:\TEST\20151129.Test.ZipLock98\Track.4.mp3'
ALBUMARTIST:'Aerosmith'
TITLE:'Title D'
YOUR_RESULT_TAG_FIELD:'Rock'
$

The result looks ok.

DD.20151129.1144.CET

20151129.Test.ZipLock98.zip (960 Bytes)

Test2015_20151129.Lookup.2__ZipLock98_.zip (474 Bytes)

It works! It works!!! Thank you so much for the quick response! You've saved me countless hours of tagging!!!!

:music: