Output "Various Artist" When There Is More Than 1 Artist

Hi,
My current export is

Export

'[size=4]Tracklist:[/size]'
$loop(%discnumber%)'[size=4]Disc '%discnumber% (%_total_time%)'[/size]'
$loop(%dummy%)''$num(%track%,2)' '$trim($regexp(%artist%,'(,)\s([^,]+[^,\s])','$1 [artist]$2[/artist]'))' - '%title%' i[/i]'
$loopend()$loopend()

So when there is a Track with Artist 1, Artist 2, Artist 3...etc it will look like this:

  1. Artist 1, Artist 2, Artist 3, – Track Name (Duration)

I want it to replace (Artist 1, Artist 2, Artist 3) to Various Artists so it would look like this

  1. Various Artists – Track Name (Duration)

It looks to me like the code is not complete.
If the string that you generate for several artists contains a comma, then you could use that to trigger the "Various Artists".

I wonder how that should work for groups that consist of several names anyway (like Earth, Wind & Fire; Emerson, Lake & Palmer) - will they also be condensed to "Various artists"?

Yeah, I snipped only the tracklist portion for the problem at hand, below is the complete code for reference:

Export

$filename(%_folderpath%%album%.txt,utf-8)'[size=2]Album: '%album%'[/size]'
['Release Date: '%year%]
'Genre: '$trim($regexp(%genre%,'(,)\s([^,]+[^,\s])','$1 '$2''))
'Total Length: '%_total_time%

'[size=4]Tracklist:[/size]'
$loop(%discnumber%)'[size=4]Disc '%discnumber% (%_total_time%)'[/size]'
$loop(%dummy%)''$num(%track%,2)' '$trim($regexp(%artist%,'(,)\s([^,]+[^,\s])','$1 [artist]$2[/artist]'))' - '%title%' i[/i]'
$loopend()$loopend()
'[url=URL] [url=URL]'

How's that can be done in code? I am still newbie ^^

I use Export mainly for Soundtracks albums so it's not problem for me

No, I mean that the code representation is not complete.

seems to be missing a number of repetition actors lik * or +.
Anyway: the whole part looks to me like it laboriously splits the data in ARTIST but as far as I understand you, you do not need this as you either want the data in ARTIST as it is or, if there is a comma in the data, you want to see "Various Artists" - is this so?

Oh,
Yes but to be sure I want it for tracks that has only 1 Artists to outputs it normally
but for tracks that has a comma (multiple artists) it outputs Various Artists

What about:
$ifgreater($strstr(%artist%,','),0,Various Artists,%artist%)

Thanks, it worked! but now it overlaps with the %artist% tag code below

Export

$loop(%dummy%)''$num(%track%,2)' '$trim($regexp(%artist%,'(,)\s ([^,]+[^,\s])','$1 [artist]$2[/artist]'))' - '%title%' i[/i]'

just FYI this output Artist name as a clickable link

What is the difference between this

and this:

and where did you insert my suggestion?

It's the same, just to point the problematic portion.

I insert it here

Code

'[size=4]Tracklist:[/size]'
$loop(%discnumber%)'[size=4]Disc '%discnumber% (%_total_time%)'[/size]'
$loop(%dummy%)''$num(%track%,2)' '$trim($ifgreater($strstr(%artist%,'、'),0,Various Artists,%artist%))' - '%title%' i[/i]'
$loopend()$loopend()

and the output is fine, but I don't know where to put this tag [artist] which makes the artist name a clickable link without getting syntax error

here is the a summary picture

Where did you get the code?
Did it work ever at all?
How and where do you get the target information to where the link should lead?
What syntax have you tried before?

I didn't, I mixed and matched until I got the result I wanted and yeah it did work
it's a site integration that just points that the text inside the artist tag is an artist.

Anyway, I figured what the problem was,

the first artist tag was inside parentheses syntax so it was working with the quotation marks like below

Original Code

$trim($regexp(%artist%,'(,)\s([^,]+[^,\s])','$1 [artist]$2'))'[/artist]

but without the parentheses I didn't need the quotation marks so when I removed them the tag text appeared again like below

Current Code

[artist] '$trim($ifgreater($strstr(%artist%,'、'),0,Various Artists,%artist%))'[/artist]

Sorry for the somewhat confusing matter but you did help me with the code I was looking for and thus reach the solution!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.