Welcome Guest

Pages: 1 2
If - Else? Conditional Actions.
clickjoyPostMay 8, 2013, 20:00
Newbie
Posts: 20
Registered:
April 29, 2013, 20:42
Normal topicIf - Else? Conditional Actions.

Can an action be made to rename a file after Album Artist, or, if that is not available, rename the file after the Artist?

(If Album Artist = true, do this. Or if Album Artist = false/empty, use Artist, otherwise rename as "Unknown Artist".

Is this possible with Yate? The "Exists Test" function seems promising. I'm just not sure how the logic in Yate works. Can one function in an action be dependent on another?

For Example, this action:
1 Exists Test: Album Artist (true)
2 Move: "move by album artist"
- ... what next?
3 Exists Test: Artist (true)
-... If #1 is false, then #3 starts? or does #3 start regardless of #1?
4 Move: "move by artist"
- ... otherwise... ? (If 1 and 3 false)
5 Rename: "Unknown Artist Rename"
6 Move: "move by artist"
- ... or do I need to test if Artist is empty?
5 Exists Test: Artist (false)
6 Rename: "Unknown Artist Rename"
7 Move: "move by artist".

Related question:

I would also use this for Disc #. So a Disc # would be added to the file name only if the Disc Total was greater than 1. This would need something similar to "exists test" but the function needs to test if a value is < > = a number or a word
Exists Test: Year > 1990
Exists Test: Grouping contains "Electronic"
Exists Test: Genre = "Ambient"

Does Yate have functions or operators like that?

2MR2PostMay 8, 2013, 20:24
Avatar photo
Administrator
Posts: 2083
Registered:
August 23, 2012, 19:27
Normal topicRe: If - Else? Conditional Actions.

There is no concept on an if-then-else in Yate scripting. When I'm doing stuff like this I use the Test function which conditionally allows you run an action. You can have two back to back Test functions one of which does something on True and one on False. These 'sub-actions' can be opened from within the action manager and they can be hidden from the Actions menu.

The sequence is:
Exists ...
Test on True run...
Test on False run...

As far as testing for a numeric value there is nothing that will do it now. I have been considering putting in more powerful conditional test and I'll do so. I'll move it close to the top of the list but not as high as the symbolic links which has a much better incentive 🙂

clickjoyPostMay 8, 2013, 21:55
Newbie
Posts: 20
Registered:
April 29, 2013, 20:42
Normal topicRe: If - Else? Conditional Actions.

Quote from 2MR2 on May 8, 2013, 20:24

The sequence is:
Exists ...
Test on True run...
Test on False run...

I tried something similar for batch processing, but I think I mixed up the True/False states (amongst other things ^^).

Have a look:
Link to iTunes
Run "Move if Album Artist Exists" -- (move action: exists test - move - artwork)
Test if false, run "move if Artist exists" -- (move action: exists test - move - artwork)
Test if false, run "rename "no artist"" -- (rename - move)

the thinking being...

If A is true, then move
if A is false, then B
if B is false, then C

It sorta worked, but all the files were named "no artist" even if they did have an artist... :-/

2MR2PostMay 8, 2013, 22:18
Avatar photo
Administrator
Posts: 2083
Registered:
August 23, 2012, 19:27
Normal topicRe: If - Else? Conditional Actions.

There is only one 'true/false' condition active at a time. The two 'Test false' steps will not work

You should have something like:

Exists Test (album artist) sets true if album artist is not empty
Test True, run "whatever you want to do if 'album artist' exists
Test False, run "whatever you want to do if 'album artist' does not exist
...whatever is common to both conditions

Whatever you do to the test state inside another sub-action does not percolate out. You can branch on a new condition inside any sub-action.

clickjoyPostMay 9, 2013, 00:24
Newbie
Posts: 20
Registered:
April 29, 2013, 20:42
Normal topicRe: If - Else? Conditional Actions.

Got it. Thanks.

2MR2PostMay 10, 2013, 11:35
Avatar photo
Administrator
Posts: 2083
Registered:
August 23, 2012, 19:27
Normal topicRe: If - Else? Conditional Actions.

I am going to change Rename, Move and Create Symbolic Links to fall back to the Artist field if Album Artist is specified and it is empty. This is the current semantics of the Search stuff and will make everyone's life easier.

clickjoyPostMay 13, 2013, 17:12
Newbie
Posts: 20
Registered:
April 29, 2013, 20:42
Normal topicRe: If - Else? Conditional Actions.

Another nice option would be for Yate to optionally add "unknown artist", "unknown album", "unknown year", "unknown genre", "missing field", and so on if a required field was empty.

So, instead of the action failing with "required field is missing!" or whatever it says, it could just add "unknown" and move on.

2MR2PostMay 13, 2013, 19:25
Avatar photo
Administrator
Posts: 2083
Registered:
August 23, 2012, 19:27
Normal topicRe: If - Else? Conditional Actions.

Okay, I'll make it a prefs option text field where leaving it empty is the current implementation. Leave it empty or put Unknown or any other text in the field to avoid the error messages.

Update:

Actually, it makes more sense to put a text field after each of the field selectors in the Move (and Create Symbolic Link) functions. That way you can leave them empty or put unique 'fillers' in for each field.

clickjoyPostMay 14, 2013, 16:43
Newbie
Posts: 20
Registered:
April 29, 2013, 20:42
Normal topicRe: If - Else? Conditional Actions.

yep. good idea.

Usually I tag tracks with "Unknown Artist" and such if that info is simply not available anywhere / if I have tried and failed to find it. That way the field is technically not blank. However I add "blank" or "null" (to the file / folder name) if the field is blank as an indication that I forgot or have not gotten around to searching for that info.

This way I have folders for null artist, album, label, year, etc that I know to look through and re-tag when I have free time.

angangPostAugust 22, 2013, 23:50
Beginner
Posts: 25
Registered:
August 23, 2013, 03:38
Normal topicRe: If - Else? Conditional Actions.

Hello,

I have 2 questions about if statement :

1. how to prevent the cd0 ?
I have tried this conditional :
IfExists+(

Pages: 1 2
Mingle Forum by Cartpauj | Version: 1.1.0beta | Page loaded in: 0.028 seconds.