# Add composer if title matches from text file?

**URL:** <https://community.mp3tag.de/t/add-composer-if-title-matches-from-text-file/5660>\
**Category:** General Discussion\
**Created:** [October 30, 2007, 3:52am UTC](https://community.mp3tag.de/t/add-composer-if-title-matches-from-text-file/5660 "2007-10-30T03:52:06Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)\
**Post date:** [December 19, 2007, 10:20am UTC](https://community.mp3tag.de/t/add-composer-if-title-matches-from-text-file/5660/21 "2007-12-19T10:20:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mizery\_Made](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/ba9def/32.png) [@Mizery\_Made](https://community.mp3tag.de/u/Mizery_Made)\
**Post date:** [February 11, 2008, 9:21am UTC](https://community.mp3tag.de/t/add-composer-if-title-matches-from-text-file/5660/22 "2008-02-11T09:21:25Z")

</div>

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'? 🙂

---

<div class="post-metadata">

**Author:** ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)\
**Post date:** [February 11, 2008, 10:59am UTC](https://community.mp3tag.de/t/add-composer-if-title-matches-from-text-file/5660/23 "2008-02-11T10:59:38Z")

</div>

> [@Mizery\_Made](#):
>
> ... there are surely things the user needs to change to fit there set up. ... Perhaps some 'Assistance for Dummies'? 🙂

Hmm, I will try it. 🙂

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

---

<div class="post-metadata">

**Author:** ![Mizery\_Made](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/ba9def/32.png) [@Mizery\_Made](https://community.mp3tag.de/u/Mizery_Made)\
**Post date:** [February 11, 2008, 11:55am UTC](https://community.mp3tag.de/t/add-composer-if-title-matches-from-text-file/5660/24 "2008-02-11T11:55:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ZipLock98](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/z/6a8cbe/32.png) [@ZipLock98](https://community.mp3tag.de/u/ZipLock98)\
**Post date:** [November 29, 2015, 12:50am UTC](https://community.mp3tag.de/t/add-composer-if-title-matches-from-text-file/5660/25 "2015-11-29T00:50:24Z")

</div>

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?

 ![](https://community.mp3tag.de/uploads/default/original/2X/3/346be3b04ef5dacec563391f819390d6a3c147c2.png)

---

<div class="post-metadata">

**Author:** ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)\
**Post date:** [November 29, 2015, 9:44am UTC](https://community.mp3tag.de/t/add-composer-if-title-matches-from-text-file/5660/26 "2015-11-29T09:44:50Z")

</div>

> [@ZipLock98](#):
>
> I feel like I'm close to getting your action to work, but it doesn't seem to be working. ...

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

1. I have created four test files ...  
[20151129.Test.ZipLock98.zip](https://community.mp3tag.de/uploads/default/original/2X/c/c0b45e538c65f6902d170f3309e4b86fe88e3ddf.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](https://community.mp3tag.de/uploads/default/original/2X/2/265d9ad1f3001b57bffb0b598fede97524dc5bda.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](https://community.mp3tag.de/uploads/default/original/2X/c/c0b45e538c65f6902d170f3309e4b86fe88e3ddf.zip) (960 Bytes)

 

[Test2015\_20151129.Lookup.2\_\_ZipLock98\_.zip](https://community.mp3tag.de/uploads/default/original/2X/2/265d9ad1f3001b57bffb0b598fede97524dc5bda.zip) (474 Bytes)

---

<div class="post-metadata">

**Author:** ![ZipLock98](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/z/6a8cbe/32.png) [@ZipLock98](https://community.mp3tag.de/u/ZipLock98)\
**Post date:** [November 29, 2015, 11:52am UTC](https://community.mp3tag.de/t/add-composer-if-title-matches-from-text-file/5660/27 "2015-11-29T11:52:03Z")

</div>

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

![:music:](https://community.mp3tag.de/uploads/default/original/1X/2ba05d1ade5eb0d15fc173be6f717dbe63890a70.gif ":music:")

[Previous page](https://community.mp3tag.de/t/add-composer-if-title-matches-from-text-file/5660.md?page=1)
