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: script help needed (Read 1722 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

script help needed

Hi everybody,
I need to get the album tag with everything that is in front of three characters (or more): (, [, {. I managed to do so with only one of the three, how can I do this for three of them at once? And also, if the %album% doesn't contain any of them, how can I make it so that it appears as it is? Like "if %album% contains ( or [ or { than return everything that stands before ( or [ or {, otherwise return %album% as it is".
Thanks in advance!

script help needed

Reply #1
I'll make some examples so that it is clearer:

If %album% is "Title (EP)" or "Title [EP]" or "Title {EP}" I want that the script returns "Title"
If %album% is "Title" I want that the script returns "Title".

I tried to use this: http://wiki.hydrogenaudio.org/index.php?ti...g_in_front_of_X
but can't get to adapt it to multiple values (X), i. e. (, [ and {.

Thanks in advance!

script help needed

Reply #2
Slightly modified example:

Code: [Select]
$puts(tag,%tag%)
$puts(spacer1,$strchr($get(tag),'{'))
$puts(spacer2,$strchr($get(tag),'['))
$puts(spacer3,$strchr($get(tag),'('))
$puts(spacer,$min($min(spacer1,spacer2),spacer3))
$trim($left($get(tag),$sub($get(spacer),1)))

script help needed

Reply #3
Slightly modified example:

Code: [Select]
$puts(tag,%tag%)
$puts(spacer1,$strchr($get(tag),'{'))
$puts(spacer2,$strchr($get(tag),'['))
$puts(spacer3,$strchr($get(tag),'('))
$puts(spacer,$min($min(spacer1,spacer2),spacer3))
$trim($left($get(tag),$sub($get(spacer),1)))



Thanks a lot but I can't get it to work. I'm using this to launch album art downloader with the run service component...

script help needed

Reply #4
It works only with one. Why???

This works:

$puts(spacer1,$strchr(%album%,'{'))$trim($left(%album%,$sub($get(spacer1),1)))

But not if I make a script with more than one spacer, like the one you suggested.

script help needed

Reply #5
in my code, the 5th line should be:
Code: [Select]
$puts(spacer,$max($max($get(spacer1),$get(spacer2)),$get(spacer3)))


but it also works incorrectly if there are several characters: for "Title (EP) [2012]" the script returns "Title (EP)"...

script help needed

Reply #6
in my code, the 5th line should be:
Code: [Select]
$puts(spacer,$max($max($get(spacer1),$get(spacer2)),$get(spacer3)))


but it also works incorrectly if there are several characters: for "Title (EP) [2012]" the script returns "Title (EP)"...


Thanks a lot, you've been very helpful! I don't think I have albums tagged that way, your code works fine for me! I'm now curious to see if there's a way to do it the way I meant tough.
Thanks again!

script help needed

Reply #7
Although not tested, this should also cover the not working part lvqcl mentioned (and it's shorter  ) :
Code: [Select]
$trim($left(%album%,$sub($strchr($replace(%album%,'{','(','[','('),'('),1)))


script help needed

Reply #9
I'm unable to test it right now, but wouldn't this be enough?
Quote
$replace(%album%, '(EP)', '', '[EP]', '', '{EP}', '')
Alessandro

PS: never mind, scratch that. Didn't realize EP was a mere example.