Multiple %releasetype%

Tags: #<Tag:0x00007f4d50c681e0>


I went through the forum but somehow I could not find the answer. I’m using a script that works not like I want. The question is, can you improve it somehow?

The script adds% releasetype% in the album folder name. However, it only works when all arguments match. This script is simplified and does not contain all possible combinations.

$if($eq(%releasetype%,album), [Album])
$if($eq(%releasetype%,album; compilation), [Compilation])
$if($eq(%releasetype%,album; compilation; soundtrack), [OST])
$if($eq(%releasetype%,album; compilation; remix), [Compilation])
$if($eq(%releasetype%,album; dj-mix), [DJ Mix])
$if($eq(%releasetype%,album; compilation; dj-mix), [DJ Mix])
$if($eq(%releasetype%,album; live), [Live])
$if($eq(%releasetype%,album; mixtape/Street), [Mixtape])
$if($eq(%releasetype%,album; remix), [Remix])
$if($eq(%releasetype%,album; soundtrack), [OST])
$if($eq(%releasetype%,compilation), [Compilation])
$if($eq(%releasetype%,dj-mix), [DJ Mix])
$if($eq(%releasetype%,dj-mix; compilation), [DJ Mix])
$if($eq(%releasetype%,ep), [EP])
$if($eq(%releasetype%,ep; compilation), [EP])
$if($eq(%releasetype%,ep; dj-mix), [EP])
$if($eq(%releasetype%,ep; live), [EP])
$if($eq(%releasetype%,ep; remix), [EP])
$if($eq(%releasetype%,live), [Live])
$if($eq(%releasetype%,live; compilation), [Live])
$if($eq(%releasetype%,mixtape/Street), [Mixtape])
$if($eq(%releasetype%,remix), [Remix])
$if($eq(%releasetype%,other; compilation), [Compilation])
$if($eq(%releasetype%,single), [Single])
$if($eq(%releasetype%,single; live), [Single])
$if($eq(%releasetype%,single; remix), [Single])
$if($eq(%releasetype%,soundtrack), [OST])

I would like to automate the process so that in the only %primaryreleasetype% albums the script would add in the name:
album = [Album]
single = [Single]
ep = [EP]
broadcast = [FM]
other = [Other]

In the %primaryreleasetype% and %secondaryreleasetype% albums, the script should add in the name:
soundtrack = [OST])
live = [Live])
remix = [Remix])
dj-mix = [DJ Mix])
mixtape/Street = [Mixtape])
compilation = [Compilation]) low prority

Any ideas how to do it?

Instead of $eq, use $in.


This will return true if “single” is in the release type, no matter what else is in there.


What @Billy_Yank says. You’re probably also going to need a nested if so you can return the text you want based on priority.

If the secondary type list is prioritized top-to-bottom you could do something like this:

$if($eq(%releasetype%, single), [Single])
$if($eq(%releasetype%, album), [Album])
$if($eq(%releasetype%, ep), [EP])
$if($eq(%releasetype%, broadcast), [FM])
$if($eq(%releasetype%, other), [Other])

$if($in(%releasetype%, soundtrack), [OST],
$if($in(%releasetype%, live), [Live],
$if($in(%releasetype%, remix), [Remix],
$if($in(%releasetype%, dj-mix), [DJ Mix],
$if($in(%releasetype%, mixtape/street), [Mixtape],
$if($in(%releasetype%, compilation), [Compilation],

So for primary types, it will only return an exact match (since there can be only one primary type), but for secondary types it will return the first match it finds and ignore the rest. If neither is found, it won’t return anything, but you can easily change this by adding the text you want after the [Compilation] line (but before any parentheses).

(Added: note this doesn’t totally fit your examples. For instance with “album; compilation; remix” you’ll get [Remix] rather than [Compilation]. And the EPs and Singles tend to override their secondary type in your examples, which wouldn’t happen with my script.)


@psychoadept, you still need to use $in for the primary types, unless you’re comparing against %primaryreleasetype% and not %releasetype%.

I just gave it a test and $eq(%releasetype%,album) works for me (and do you mean %_primaryreleasetype%)?

Yes, I meant _primaryreleasetype. Did you test on a release that had a secondary type? Like “album; soundtrack”.

No, because OP said they only wanted to match primary type if there is no secondary type.

I see. But looking over his code, that seems to only be true if the primary type is album. When it’s single or EP, he’s using the primary type only.

1 Like

Yeah, I noticed that too. Well, we’ll see what they say…

A small improvement would be to use $inmulti instead of $in:


The difference for release types probably isn’t that noticable. But $in will just look for a substring, $inmulti will actually look at the individual values and compare them.


I did not expect such a response. Thank you all. @psychoadept Your script works beautifully but with one small fix. After deleting the space between %releasetype% and releasetype, everything works fine.

$if($eq(%releasetype%,single), [Single])
$if($eq(%releasetype%,album), [Album])
$if($eq(%releasetype%,ep), [EP])
$if($eq(%releasetype%,broadcast), [FM])
$if($eq(%releasetype%,other), [Other])
$if($inmulti(%releasetype%,dj-mix), [DJ Mix],
$if($inmulti(%releasetype%,remix), [Remix],
$if($inmulti(%releasetype%,soundtrack), [OST],
$if($inmulti(%releasetype%,live), [Live],
$if($inmulti(%releasetype%,mixtape/street), [Mixtape],
$if($inmulti(%releasetype%,compilation), [Compilation],))))))

The script works exactly as I wanted. Only one tag is added in albums from %primaryreleasetype%. And in the albums with %primaryreleasetype% and %secondaryreleasetype%, only %secondaryreleasetype% is added. In addition, they have top-to-bottom prioritization.

For example, in the album with “album; dj-mix; compilation” will be added [DJ Mix] because it is in the first row. Fantastic!

Also i did not notice the difference between %in and &inmulti.

Beatiful job, TY!!!

EDIT: We have problem, %primaryreleasetype% with “album” adds double [Album] [Album]. Single, EP works fine.


Solved the problem with a double [Album]. Solution:

$if($eq(%releasetype%,album), [Album],
$if($eq(%releasetype%,single), [Single],
$if($eq(%releasetype%,ep), [EP],
$if($eq(%releasetype%,broadcast), [FM],
$if($eq(%releasetype%,other), [Other],
$if($inmulti(%releasetype%,dj-mix), [DJ Mix],
$if($inmulti(%releasetype%,remix), [Remix],
$if($inmulti(%releasetype%,soundtrack), [OST],
$if($inmulti(%releasetype%,live), [Live],
$if($inmulti(%releasetype%,mixtape/street), [Mixtape],
$if($inmulti(%releasetype%,compilation), [Compilation],)))))))))))

Glad you fixed it! I’m not sure how that change would have affected it, though, since it’s still only in there once. Are you sure it wasn’t coming from elsewhere in your script?

Strange, I went back to the previous script and it works like it should. I honestly do not know what happened. I use the 2.2.0.dev1 and maybe there is a problem. Either way, both scripts should be ok.