INTERACT FORUM

More => Old Versions => JRiver Media Center 18 for Windows => Topic started by: InflatableMouse on May 09, 2013, 01:45:02 pm

Title: Expression in Rename dialog
Post by: InflatableMouse on May 09, 2013, 01:45:02 pm
Is it possible to use an expression in the rename window to evaluate a field value and rename based on the outcome?

I have an [Album Version] field that I've been using to record the album release version. But the majority of albums don't have anything for that value though, so its empty.

I tried a couple of things, for instance:

Code: [Select]
[Artist]\/[[Year]/] [Album] if(isempty([Album Version]),,/([Album Version]/))

The preview works fine when [Album Version] has a value, but if its empty it adds (Unknown Album Version). I don't want it to add anything in that case but I can't seem to get it to work that way.

If anyone knows how to fix that I'd appreciate it.

Thanks!
Title: Re: Expression in Rename dialog
Post by: 6233638 on May 09, 2013, 02:11:43 pm
Delimit() (http://wiki.jriver.com/index.php/Media_Center_expression_language#Delimit.28....29:_Outputs_a_value_with_head.2Ftail_strings_when_value_is_non-empty) should cover this, though you might have to use [Tag,0] for some values.

Code: [Select]
[Artist]\/[[Year]/] [Album]Delimit([Album Version,0],/),/ /()
Title: Re: Expression in Rename dialog
Post by: InflatableMouse on May 09, 2013, 02:38:02 pm
That easy huh :D.

Works fine on a few samples I've tried, thank!

Title: Re: Expression in Rename dialog
Post by: marko on May 10, 2013, 12:44:35 am
[Artist]\/[[Year]/] [Album] if(isempty([Album Version,0]),,/([Album Version]/))

Adding the ",0" to [album version] in your original expression would also have worked.

Using ",0" inside the field name tells MC to use the literal field contents. Before we got this, I would use isequal instead of isempty, asking, if the field contains 'unknown', output nothing, otherwise use the field.

-marko