SongKong Jaikoz

SongKong and Jaikoz Music Tagger Community Forum

the old style...

can someone please bring these into the “new” format,
thanks

$if(%bestartist%,%bestartist% - )$if(%trackno%,%trackno% - )%title%

$if(%trackno%,%trackno% - )$if(%artist%,%artist% - )%title%

%bestartist%%folderseperator%$if(%year%,%year% - )%album%

(albumartist.length>0  ? albumartist  +'-':(artist.length>0 ? artist +'-': ''))  + (trackno.length>0 ? trackno +'-' :'')   + title

(trackno.length>0 ? trackno +'-':'') + (artist.length>0 ? artist +'-':'') + title

(albumartist.length>0  ? albumartist +folderseparator :(artist.length>0 ? artist + folderseparator : '')) + (year.length>0 ? year +' ':'')  + album 

Thank you, that helps me to understand that new “language”

[quote=paultaylor]```
(albumartist.length>0 ? albumartist +’-’:(artist.length>0 ? artist +’-’: ‘’)) + (trackno.length>0 ? trackno +’-’ :’’) + title



[/quote]

Can you help me understand this little better?  I know zero JS.

albumartist.length>0  ? albumartist
What does the "?" mean.  I take this as "Return value if the artist text length is greater than zero, query the 'albumartist' field".

(artist.length>0 ? artist +'-': '')
What does the :'' at the end mean?  And how does "artist" work inside the "albumartist" statement?  Will it return both if they're the same?

And I noticed that this is not space-sensitive, so how would I use '-' to get "U2 - Twilight" with spaces around the -?

Im only slightly ahead of you but I’ll try. Of course because it is pure javascript any Javascript forum, book, website should be able to help.

? = then
: = else

So it means

’ If artist length is greater than zero then output the value of artist else display nothing.

[quote=dkoh]
And I noticed that this is not space-sensitive, so how would I use ‘-’ to get “U2 - Twilight” with spaces around the -?[/quote]
Literals are printed out if surrounded by single quotes so you would want

' - '

i.e

(artist.length>0 ? artist + ' - ': '') + title

Thanks Paul, that helps.

Turns out I was playing with the wrong literal trying to change U2-Twilight to get spaces.

Maybe it is time to pick up a Java book.