replace from list to export

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()

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 ?)

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)

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 (1.13 KB)

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

20150303.Test.SearchTable.zip (55 KB)
DD.20150304.1324.CET

20150303.Test.SearchTable.zip (55 KB)