Trim some contributing artist from filename

Hi !

How do I trim the filename to make it show only the first artist from a list of contributing artists ?

Example:

              Original Artists:  Alfa, Beta, Gamma                  Tittle: My Song
         
                   Actual filename:    alfa, beta, gamma _ My Song


                                    I want to trim the filename field after the first (  ,  ) to obtain this:


               Expected filename:     alfa _ My Song

Hi,
Double check if it works:

Make a new action: "Replace with regular expression"
"Field": FILENAME
"Regular expression": ^(.?)(\s?),(.*?)
(\s*?)([^\s])(.*)$
"Replace with": $1 _ $5$6

$left(%_FILENAME%,$sub($strchr(%_FILENAME%,','),1))$mid(%_FILENAME%,$strchr(%FILENAME%,''),$len(%_FILENAME%))

DD.20100107.1651.CET

I put your command in FORMAT VALUE and work fine except in cases where the name of one of the artists includes last name:

                                 Example:     alfa, beta, gamma gamma, zeta_Song Title

in these case, the filename is not trimed.

Thanks again !!!
:unsure:

Mine didn't work?

He does not know where ... or why ...

DD.20100107.2305.CET

OK it's just that while your (impressive-looking by the way) explanation did not say where he should put it, mine explained that, too, and as far as I know it is a working solution, so I was just wondering if he ever tried it.

I guess it is a "Format value" on the field "_FILENAME".

DD.20100107.2312.CET

Are you a programmer?
I noticed you are good at coding but not always know how exactly mp3tag applies RegExp:)
Some of the stuff you write takes quite a while for me to see through (nice)

I put your command in FORMAT VALUE and work fine except in cases where the name of one of the artists includes last name:

Example: alfa, beta, gamma gamma, zeta_Song Title

in these case, the filename is not trimmed. Any solution ? ? ?

Thanks again !!!

It's perfect !!! :smiley: Thank's !!! :w00t: This forum rocks !

I cannot see any problem, scripting expression works fine even with your new example:

$left(%_FILENAME%,$sub($strchr(%_FILENAME%,','),1))$mid(%_FILENAME%,$strchr(%FILENAME%,''),$len(%_FILENAME%))

Preview gives:
"O:\TEST\alfa, beta, gamma gamma, zeta_Song Title.mp3" ->
"O:\TEST\alfa_Song Title.mp3"

DD.20100108.1044.CET

ok, I understand how to replace with regular expression. I just don't know what codes to use to do what I need to do.

I want to DELETE the artist name from the file name, and only leave the song title. my song looks like this

artist - title

I want it to look like this

title

I just do not know what codes to put in which places (I'm assuming it is a _filename, but I'm not sure on the "regular expression: and the "replace matches with" function should show. Also, a lot of these songs may not have the artist name in the id tag (is that the right word, hopefully you understand what I mean), and it would be nice to put it in the tag. If you could show me THAT, I would be eternailly greatful! :astonished:

Convert | Filename - Filename | ALT+3

Select format string

Old filename pattern:
%1, %2 _ %3

New filename pattern:
%1 _ %3

Preview
alfa _ My Song.mp3

... or ...
Action: Format value
Field: _FILENAME
Formatstring: $regexp(%_filename%,'^(.+?)(, .+?)+( _ .+)$','$1$3')
From:
alfa, beta, gamma _ My Song
To:
alfa _ My Song

... or ...
Action: Format value
Field: _FILENAME
Formatstring: $regexp(%_filename%,'^(.+?), .+ _ (.+)$','$1 _ $2')
From:
alfa, beta, gamma _ My Song
To:
alfa _ My Song

DD.20111108.0220.CET