# replace from list to export

**URL:** https://community.mp3tag.de/t/replace-from-list-to-export/7607
**Category:** Export
**Created:** [December 12, 2008, 4:13pm UTC](https://community.mp3tag.de/t/replace-from-list-to-export/7607 "2008-12-12T16:13:28Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Richard1963](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/c4cdca/32.png) [@Richard1963](https://community.mp3tag.de/u/Richard1963)
#### Post date: [December 12, 2008, 4:13pm UTC](https://community.mp3tag.de/t/replace-from-list-to-export/7607/1 "2008-12-12T16:13:28Z")

</div>

Hello, i have a own made muziek program dat makes a muziek.dat file in the order of:

4,21,2008,2,39768,0,K:\Katy Perry\ Katy Perry - I Kissed A Girl.mp3  
| | | | | | |  
| | | | | | --- Toegevoegd (altijd NUL alleen niet na net toegevoegd te zijn)  
| | | | | ------remains zero  
| | | | --- Date in UNIX timestamp 39768 == 1970 (seconds since 1-1-1970)  
| | | |  
| | | --- Language 1=nederlands 2=engels (0=alle others or unknown)  
| | |  
| | --- Jaar for example '2008'  
| |  
| --- Genre for example 21 is Pop)  
|  
--- times played (zero on creation)

Now i tried to make a export script that takes the %genre% from mp3tag and replaces the known genres into coresponding numerical data like Pop = 21, Top 40 = 24, etc

it works sometimes but its not acurate  
please can someone help me ? (only need to replase second number, the rest is used by my program)  
see attachment

```
$loop(%_filename_ext%,%album%,%track%)0,$lower($replace($lower(%genre%),
others,0,
other,0,
cabaret,1,
blues,2,
folk,2,
schlagers,3,
carribean,4,
country,5,
chanson,6,
disco,7,
dance,7,
easy listening,8,
feest,9,
golden oldies,10,
bruin cafe,11,
instrumentaal,12,
jazz,13,
accordeon,13,
karaoke,14,
kerst,15,
christmas,15,
xmas,15,
kerstmis,15,
klassiek,16,classic,16,
piratenhits,17,
smartlap,18,
live opname,19,
nederpop,20,
pop,21,
rock Algemeen,22,
r&b,23,
soul,23,
top 40 dossier,24,
top 40,24,
top40,24,
soundtracks,25,
kinder,26,
jeugd,26,
reggae,27,
rock & roll,28,
nationaal,29,
nederlands,29,
nederland,29,
internationaal,30,
sport,31,
musical,32,
classic rock,33,
rock ballads,34,
apres ski,35,
songfestival,36,
grappig,37,
parodie,37,
remix,38,
12 inch,38,
rap,39,
hiphop,39,
love songs,40,
carnaval,41,
zuid-amerikaans,42,
latin,42,
funk,43,
freeStyle,44,
60's,45,
60,45,
70's,46,
70,46,
80's,47,
80,47,
90's,48,
90',48)),%year%,0,0,0,%_path%
$loopend()
```

---

<div class="post-metadata">

### Author: ![Richard1963](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/c4cdca/32.png) [@Richard1963](https://community.mp3tag.de/u/Richard1963)
#### Post date: [December 17, 2008, 7:22am UTC](https://community.mp3tag.de/t/replace-from-list-to-export/7607/2 "2008-12-17T07:22:54Z")

</div>

Figured it out some bit

if the string for replace is too lang it only does the firts part.  
is there a limit for replace ????

Now trying to make e few loops to complete the task  
Also find a way to fil in the blanks with $if2(x,y)  
when ready i post the script  
(does anybody knows a way for making a unix time stamp out of the today date ?)

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [December 17, 2008, 9:14am UTC](https://community.mp3tag.de/t/replace-from-list-to-export/7607/3 "2008-12-17T09:14:35Z")

</div>

The code you have posted here produces a syntax error?

## Anyway here are some things you must consider: Press F1 in the export dialog to open the help file and read it.

## You must write everything in $replace in one line: $replace($lower(%genre%),others,0,other,0,cabaret,1,blues,2,folk,...

$loop(%\_filename\_ext%,%album%,%track%)  
This is wrong and shouldn't even work.  
Comma is a seperator for parameters and it is possible to use $loop(%fieldname%,num)

## You can use $loop(%\_filename\_ext% %album% %track%) or several nested loops for your sorting.

## You must write 90''s and not 90's because ' is a special char. (See help file)

For unix time stamp try $regexp(%\_datetime%,x,y)

---

<div class="post-metadata">

### Author: ![Richard1963](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/c4cdca/32.png) [@Richard1963](https://community.mp3tag.de/u/Richard1963)
#### Post date: [December 27, 2008, 8:29am UTC](https://community.mp3tag.de/t/replace-from-list-to-export/7607/4 "2008-12-27T08:29:07Z")

</div>

I got this working!!!  
But it produces every line 3 times (in every line there is one result GOOD, so i have to exclude it in further conversions)  
my thought is now to check if the %genre% is numerical but thats not gonne work because nothing changes on the list only in the exported list so can i check the OUTPUT before it writes the file ?  
Code so far:

```
$loop(%_path%,1)0,$if2($replace($lower(
%genre%),others,0,other,0,cabaret,1,blues,2,folk,2,schlagers,3,carribean,4,country,5
,chanson,6,disco,7,easy listening,8,feest,9,oldies,10,bruin café,11,instrumentaal,12,jazz,13,accordeon,13,karaoke,14,kerst,15,christmas,15,
xmas,15,kerstmis,15,classical,16,classics,16,classic,16,piratenhits,17,smartlap,
1
8,live,19,nederpop,20,pop,21),0),$if2(%year%,0),0,0,0,%_path%
$loop(%_path%,1)0,$if2($replace($lower(%genre%),rock,22,r&b,23,soul,23,top40,24,top 40,24,soundtracks,25,soundtrack,25,kinder,26,jeugd,26,reggae,27,rock&roll,28,nationaal,29,nederlandstalig,29,nederlands,29,nederland,29,internati
onal,30,sport,31,musical,32,rock,33,rock ballads,34,apres ski,35,newwave,36,new wave,36,new age,36,newage,36,grappig,37,parodie,37,remix,38,12 inch,38,rap,39,hiphop,39,lovesongs,40,carnaval,41),0),$if2(%year%,0),0,0,0,%_path%
$loop(%_path%,1)0,$if2($replace($lower(%genre%),zuid-amerikaans,42,latin,42,funk,43,freestyle,44,60s,45,70s,46,'80s',47,90s,48),0),$if2(%year%,0),0,0,0,%_path%
$loopend()
$loopend()
$loopend()
$regexp(%_datetime%,x,y)

```

the output looks like this:

```
0,80s,0,0,0,0,K:\80's\Mega 80's Collection - Part 1\UB40 - Please Don't Make Me Cry.mp3
0,80s,0,0,0,0,K:\80's\Mega 80's Collection - Part 1\UB40 - Please Don't Make Me Cry.mp3
0,47,0,0,0,0,K:\80's\Mega 80's Collection - Part 1\UB40 - Please Don't Make Me Cry.mp3

0,80s,0,0,0,0,K:\80's\Mega 80's Collection - Part 1\UB40 & Chrissie Hynde - Breakfast In Bed.mp3
0,80s,0,0,0,0,K:\80's\Mega 80's Collection - Part 1\UB40 & Chrissie Hynde - Breakfast In Bed.mp3
0,47,0,0,0,0,K:\80's\Mega 80's Collection - Part 1\UB40 & Chrissie Hynde - Breakfast In Bed.mp3

0,11,2003,0,0,0,K:\Andre Hazes\Live In De Amsterdam Arena\Andre Hazes - Wat Is Dan Liefde.mp3
0,bruin café,2003,0,0,0,K:\Andre Hazes\Live In De Amsterdam Arena\Andre Hazes - Wat Is Dan Liefde.mp3
0,bruin café,2003,0,0,0,K:\Andre Hazes\Live In De Amsterdam Arena\Andre Hazes - Wat Is Dan Liefde.mp3

0,2,2002,0,0,0,K:\Andre Hazes\Strijdlustig\Andre Hazes - Laat Me Vrij.mp3
0,folk,2002,0,0,0,K:\Andre Hazes\Strijdlustig\Andre Hazes - Laat Me Vrij.mp3
0,folk,2002,0,0,0,K:\Andre Hazes\Strijdlustig\Andre Hazes - Laat Me Vrij.mp3

0,2,1983,0,0,0,K:\Andre Hazes\Voor jou\Andre Hazes - Ik Ga Met Jou Het Leven Door.mp3
0,blues,1983,0,0,0,K:\Andre Hazes\Voor jou\Andre Hazes - Ik Ga Met Jou Het Leven Door.mp3
0,blues,1983,0,0,0,K:\Andre Hazes\Voor jou\Andre Hazes - Ik Ga Met Jou Het Leven Door.mp3

0,16,1999,0,0,0,K:\Andrea Bocelli\Sogno\Andrea Bocelli - Mai Piu' Costi' Lontano.mp3
0,classical,1999,0,0,0,K:\Andrea Bocelli\Sogno\Andrea Bocelli - Mai Piu' Costi' Lontano.mp3
0,classical,1999,0,0,0,K:\Andrea Bocelli\Sogno\Andrea Bocelli - Mai Piu' Costi' Lontano.mp3

0,r&b,2002,0,0,0,K:\Ashanti\Ashanti\13 Over.wma
0,23,2002,0,0,0,K:\Ashanti\Ashanti\13 Over.wma
0,r&b,2002,0,0,0,K:\Ashanti\Ashanti\13 Over.wma

```

(ps are there any Delphi programmers here?)

[Muziek.export.mte](https://community.mp3tag.de/uploads/default/original/2X/5/5251b1e831b26ccab5aa9c4bd88cf90673dfb5a1.mte) (1.13 KB)

---

<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: [March 4, 2015, 8:15am UTC](https://community.mp3tag.de/t/replace-from-list-to-export/7607/5 "2015-03-04T08:15:05Z")

</div>

> [@Ancas](#):
>
> Hello, i have a own made muziek program dat makes a muziek.dat file in the order of:  
> 4,21,2008,2,39768,0,K:\Katy Perry\ Katy Perry - I Kissed A Girl.mp3  
> Now i tried to make a export script that takes the %genre% from mp3tag and replaces the known genres into coresponding numerical data like Pop = 21, Top 40 = 24, etc ... please can someone help me ? (only need to replase second number, the rest is used by my program)

See attached zip file, there are some test files and a Mp3tag export script file, which uses a search table.

[20150303.Test.SearchTable.zip](https://community.mp3tag.de/uploads/default/original/2X/e/e7854fa6be8f9e3bb291fc27fae3789c8b25a5aa.zip) (55 KB)  
DD.20150304.1324.CET

[20150303.Test.SearchTable.zip](https://community.mp3tag.de/uploads/default/original/2X/e/e7854fa6be8f9e3bb291fc27fae3789c8b25a5aa.zip) (55 KB)
