Skip to main content

Topic: script help needed (Read 1005 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • dolgorazzo
  • [*]
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!

  • dolgorazzo
  • [*]
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!

  • lvqcl
  • [*][*][*][*][*]
  • Developer
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)))

  • dolgorazzo
  • [*]
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...

  • dolgorazzo
  • [*]
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.

  • lvqcl
  • [*][*][*][*][*]
  • Developer
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)"...

  • dolgorazzo
  • [*]
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!

  • fbuser
  • [*][*][*][*][*]
  • Developer
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)))
  • Last Edit: 12 February, 2013, 04:41:33 PM by fbuser

  • dolgorazzo
  • [*]
script help needed
Reply #8
Although not tested, this should also cover the not working part lvqcl mentioned (and it's shorter  )[/code]


Thanks a lot, it works!

  • mobyduck
  • [*][*][*][*][*]
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.
  • Last Edit: 14 February, 2013, 07:12:23 AM by mobyduck