INTERACT FORUM
More => Old Versions => JRiver Media Center 18 for Windows => Topic started by: yannis on January 10, 2013, 11:46:26 pm
-
Is there a way to append/prepend a string in some field? Or to remove one?
-
In the tag window, click on an artist to edit it, and type in there: =removeright([artist],6) and press enter to have MC remove the last six characters from the artist data. =removeleft([artist],6) would remove the first six characters.
To add, simply type =string[artist] or =[artist]string
You could do this wholesale on a multiple selection of files if you wanted.
-marko
-
There is a wiki page dedicated to this stuff which you may find helpful. They are called expressions. String manipulation stuff is here (http://wiki.jriver.com/index.php/Media_Center_expression_language#String_Manipulation), and the removeleft/right stuff is here (http://wiki.jriver.com/index.php/Media_Center_expression_language#RemoveLeft.28....29:_Trims_characters_from_the_start_of_a_value)
It all makes MC a very powerful data manipulation tool indeed.
marko
-
Another tip...
If you have a complex pattern that you regularly use to modify other fields, you can make your life easier by making that pattern into its own calculated field. So, for example, say you want to regularly do something like this:
=RemoveRight(FixSpacing(FixCase([Name], 0)), 6)
Make that (everything above except the leading equals sign) into its own Calculated Field and give it a name (like [NameFixer] or something). Then, in the future, when you need to fix the same field in the same way, you can just do:
=[NameFixer]
With the Regex() function, these replacements can be very powerful, but quite complex to write. Making it once and then using it over and over again is a very good thing.
-
Thank you all, it's exactly what I was looking for.
But, to be sincere, I think that for such a common need, there should be an easier way, through the interface, maybe in Library options. Having been a user of BulkRename for quite a while, I expected some similar functionality in MC.
-
I have a specific request from an expert in the expression language. I do some expressions, things like fixcase, and things like adding "(DSD)" and "(SHM)" and "(MFSL)" to certain categories of my albums, thereby helping me if I have multiples (i.e compare or identify the MFSL to the regular one). I've put these qualifiers (especially DSD which is now a huge section) in parentheses using the / command so as to use the parens as text and not as an expression argument, such as =[album] /(DSD/) .
Ok, so here is what I need. Some of my rips are still yelling at me (i.e album titles are in all caps) and yet I stupidly went ahead and categorized them with the parentheses above. I do not want the fixcase logic to be used on these qualifiers. So, can I write an expression that is =fixcase([album])up-to-first parentheses ?
Thanks
Ted
-
You could try FixCase(ListItem([Album],0,/()).
EDIT: The reply might be too brief.
Try to put this in an expression column to see the result without changing any tags: FixCase(ListItem([Album],0,/())ListItem([Album],1,/()
If it looks good you can change the tags by entering the expression in the [Album] tag prefixed with =: =FixCase(ListItem([Album],0,/())ListItem([Album],1,/()
I have not tried out the expression, so I do not really know how well it will work with the space you probably have before the "(", and the expression will not work correctly in the tag if the album name contains more than one "(".
-
Thanks
The results:
A WONDERFUL WORLD (DSD)
becomes
A Wonderful WorldDSD)
Almost there. Also, I have lots of dual paren albums (MFSL) (DSD) so I think maybe I won;t worry about it....
-
I think you will need MrC's Regex skills here. My limited Regex knowledge is a bit rusty.
-
OK, MrC seems temporarily unavailable so I will have a go.
Try this in an expression column:
Regex([Album],/#^(.+?)(\(.*)$#/,-1)FixCase([R1])[R2]
Sort by that column so that files with a value in that column are visible. If you like what you see, use the expression prefixed with = in the [Album] field for _only_ those files with a value in that column. Ctrl+c should be able to undo the change (but I would try it out on just a few files first).
MrC would have a more elegant solution I am sure, and he would actually understand what he is doing (which I do not really so proceed with caution).
-
Works great!! Thanks! :)