script help needed |
This is NOT a tech support forum.
Tech support questions go to foobar2000 Tech Support forum instead.
See also: Hydrogenaudio Terms of Service.
![]() ![]() |
script help needed |
Feb 12 2013, 15:44
Post
#1
|
|
|
Group: Members Posts: 11 Joined: 10-September 11 Member No.: 93624 |
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! |
|
|
|
Feb 12 2013, 18:07
Post
#2
|
|
|
Group: Members Posts: 11 Joined: 10-September 11 Member No.: 93624 |
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! |
|
|
|
Feb 12 2013, 18:26
Post
#3
|
|
![]() Group: Developer Posts: 2986 Joined: 2-December 07 Member No.: 49183 |
Slightly modified example:
CODE $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))) |
|
|
|
Feb 12 2013, 18:35
Post
#4
|
|
|
Group: Members Posts: 11 Joined: 10-September 11 Member No.: 93624 |
Slightly modified example: CODE $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... |
|
|
|
Feb 12 2013, 22:02
Post
#5
|
|
|
Group: Members Posts: 11 Joined: 10-September 11 Member No.: 93624 |
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. |
|
|
|
Feb 12 2013, 22:16
Post
#6
|
|
![]() Group: Developer Posts: 2986 Joined: 2-December 07 Member No.: 49183 |
in my code, the 5th line should be:
CODE $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)"... |
|
|
|
Feb 12 2013, 22:32
Post
#7
|
|
|
Group: Members Posts: 11 Joined: 10-September 11 Member No.: 93624 |
in my code, the 5th line should be: CODE $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! |
|
|
|
Feb 12 2013, 22:39
Post
#8
|
|
|
Group: Developer Posts: 648 Joined: 26-September 07 Member No.: 47369 |
Although not tested, this should also cover the not working part lvqcl mentioned (and it's shorter
CODE $trim($left(%album%,$sub($strchr($replace(%album%,'{','(','[','('),'('),1)))
This post has been edited by fbuser: Feb 12 2013, 22:41 |
|
|
|
Feb 13 2013, 17:57
Post
#9
|
|
|
Group: Members Posts: 11 Joined: 10-September 11 Member No.: 93624 |
|
|
|
|
Feb 14 2013, 13:09
Post
#10
|
|
|
Group: Members Posts: 550 Joined: 24-April 03 From: Italy Member No.: 6159 |
I'm unable to test it right now, but wouldn't this be enough?
QUOTE $replace(%album%, '(EP)', '', '[EP]', '', '{EP}', '') AlessandroPS: never mind, scratch that. Didn't realize EP was a mere example. This post has been edited by mobyduck: Feb 14 2013, 13:12 |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 24th May 2013 - 01:06 |