Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Titleformatting $if3? (Read 4291 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Titleformatting $if3?

I'm adding some code to Track Info Mod to indicate the presence of embedded lyrics or TXT or LRC files. So far I have:
Code: [Select]
$if($or(%lyric%,%lyrics%), Embedded,)
$if($cwb_fileexists($replace(%_path%,%_filename_ext%,)%album artist% - %title%.txt), TXT,)
$if($cwb_fileexists($replace(%_path%,%_filename_ext%,)%album artist% - %title%.lrc), LRC,)
$rgb(255,0,0) NONE$char(10)

This code works fine but what I'd like to display is basicaly

Lyrics: (Embedded) (TXT) (LRC) NONE

where none is displayed when the first 3 fail. Seemingly $if3 is the way to go but when I use the above code it results in false. Here's what I have.
Code: [Select]
$if3($if($or(%lyric%,%lyrics%), Embedded),$if($cwb_fileexists($replace(%_path%,%_filename_ext%,)%album artist% - %title%.txt), TXT),$if($cwb_fileexists($replace(%_path%,%_filename_ext%,)%album artist% - %title%.lrc), LRC),$rgb(255,0,0) NONE)

Any ideas? Thanks.

Titleformatting $if3?

Reply #1
I'm adding some code to Track Info Mod to indicate the presence of embedded lyrics or TXT or LRC files. So far I have:
Code: [Select]
$if($or(%lyric%,%lyrics%), Embedded,)
$if($cwb_fileexists($replace(%_path%,%_filename_ext%,)%album artist% - %title%.txt), TXT,)
$if($cwb_fileexists($replace(%_path%,%_filename_ext%,)%album artist% - %title%.lrc), LRC,)
$rgb(255,0,0) NONE$char(10)

This code works fine but what I'd like to display is basicaly

Lyrics: (Embedded) (TXT) (LRC) NONE

where none is displayed when the first 3 fail. Seemingly $if3 is the way to go but when I use the above code it results in false. Here's what I have.
Code: [Select]
$if3($if($or(%lyric%,%lyrics%), Embedded),$if($cwb_fileexists($replace(%_path%,%_filename_ext%,)%album artist% - %title%.txt), TXT),$if($cwb_fileexists($replace(%_path%,%_filename_ext%,)%album artist% - %title%.lrc), LRC),$rgb(255,0,0) NONE)

Any ideas? Thanks.

How about...
Code: [Select]
$if($or(%lyric%,%lyrics%), Embedded,$if($cwb_fileexists($replace(%_path%,%_filename_ext%,)%album artist% - %title%.txt), TXT,$if($cwb_fileexists($replace(%_path%,%_filename_ext%,)%album artist% - %title%.lrc), LRC,$rgb(255,0,0) NONE$char(10))))

Now, I have by all means never touched a single line of tagz code, but as far as I understand, this setup will evaluate the next IF clause until a positive is found, or the last ELSE is issued (the NONE thingy)
Pusk is the new Start.

Titleformatting $if3?

Reply #2
How about...
Code: [Select]
$if($or(%lyric%,%lyrics%), Embedded,$if($cwb_fileexists($replace(%_path%,%_filename_ext%,)%album artist% - %title%.txt), TXT,$if($cwb_fileexists($replace(%_path%,%_filename_ext%,)%album artist% - %title%.lrc), LRC,$rgb(255,0,0) NONE$char(10))))

Now, I have by all means never touched a single line of tagz code, but as far as I understand, this setup will evaluate the next IF clause until a positive is found, or the last ELSE is issued (the NONE thingy)

I don't think you can have that many arguements in an $if statement. I tested it and it didn't work BTW but thanks for trying.

Titleformatting $if3?

Reply #3
I didn't count brackets, but it seems to be constructed properly.

Try it without the $rgb function that you've placed just before the NONE.
That's so plausible, I can't believe it.

Titleformatting $if3?

Reply #4

How about...
Code: [Select]
$if($or(%lyric%,%lyrics%), Embedded,$if($cwb_fileexists($replace(%_path%,%_filename_ext%,)%album artist% - %title%.txt), TXT,$if($cwb_fileexists($replace(%_path%,%_filename_ext%,)%album artist% - %title%.lrc), LRC,$rgb(255,0,0) NONE$char(10))))

Now, I have by all means never touched a single line of tagz code, but as far as I understand, this setup will evaluate the next IF clause until a positive is found, or the last ELSE is issued (the NONE thingy)

I don't think you can have that many arguements in an $if statement. I tested it and it didn't work BTW but thanks for trying.

Please, I hope that the number of arguments is not the reason why my example didn't work, as each of the if statements were only supposed to see two arguments - The if, and the else. If tagz cant handle stacking, it really should.
Pusk is the new Start.

Titleformatting $if3?

Reply #5
Please, I hope that the number of arguments is not the reason why my example didn't work, as each of the if statements were only supposed to see two arguments - The if, and the else. If tagz cant handle stacking, it really should.

Well it can but the $if function has a specific format that only accepts so many arguements but funtions like $if3 handles more and works differently.

Titleformatting $if3?

Reply #6
Well it can but the $if function has a specific format that only accepts so many arguements but funtions like $if3 handles more and works differently.

Yeah, I read the documentation. I think there is a slight chance we are misunderstanding each other.

What I did amounts to basically this:
Code: [Select]
if(something)
{
dothis();
}
else
{
  if(somethingelse)
  {
    dothat();
  }
  else
  {
    if(somethingthird)
    {
      donothing();
    }
  }
}

This should be possible within any programming or scripting language, even though it is very ugly and just plain utterly wrong. One should use if-elseif instead of stacking if statements, but from what I've seen in tagz scripts, I'm thinking tagz doesnt have if-elseif.
Pusk is the new Start.

Titleformatting $if3?

Reply #7
I think you want something like this:

Code: [Select]
$rgb(255,0,0) 

$if($or(%lyric%,%lyrics%),Embedded,
$if($cwb_fileexists($replace(%_path%,%_filename_ext%,)%album artist% - %title%.txt),TXT,
$if($cwb_fileexists($replace(%_path%,%_filename_ext%,)%album artist% - %title%.lrc),LRC,
NONE
)
)
)

$char(10)


It's not pretty, but it should work.
</signature>

Titleformatting $if3?

Reply #8
I think you want something like this:

Code: [Select]
$rgb(255,0,0) 

$if($or(%lyric%,%lyrics%),Embedded,
$if($cwb_fileexists($replace(%_path%,%_filename_ext%,)%album artist% - %title%.txt),TXT,
$if($cwb_fileexists($replace(%_path%,%_filename_ext%,)%album artist% - %title%.lrc),LRC,
NONE
)
)
)

$char(10)


It's not pretty, but it should work.

Beautifully, although I only wanted NONE to be in red (easily changed)! Thanks Insolent.