INTERACT FORUM

More => Old Versions => JRiver Media Center 22 for Windows => Topic started by: mattlovell on March 31, 2017, 09:17:47 am

Title: Carnac and regular expressions
Post by: mattlovell on March 31, 2017, 09:17:47 am
Hello,

Did anything ever come from the suggestion (back to the end of 2011) of adding regular expressions to Carnac?

I ask since I have a directory structure, for a subset of my classical music, that has files in varying depths of directories, but I'd like to extract the Composer name from the "top-most" directory.

Files generally reside in a structure like the following:

Opera\<Composer>\<File>

but there are times that an additional directory gets added to the path:

Opera\<Composer>\<Collection name>\<File>

and I would still like to extract the Composer properly.  The filenames also often have a Conductor present, parenthetically, after the name of the work.  It would be nice to be able to extract that field as well.

Any suggestions?

Thanks!
  Matt
Title: Re: Carnac and regular expressions
Post by: mattlovell on April 12, 2017, 11:56:43 am
Did anything ever come from the suggestion (back to the end of 2011) of adding regular expressions to Carnac?

Reading through older forum posts, I came across a tidbit I didn't realize -- namely that one can enter an expression when editing Tags!!

Using the expression

=regex(FilePath(), /#Opera\\([^\\]*)#/, 1)

gets Composer filled in correctly for all files!  Based on directory structure, I've always populated opera and other classical music into an F:\Opera directory.  The regular expression above picks off the first-level directory name.

(Carnac's templates, FWIW, appear to be anchored at the end of the filename.  So, it wasn't handling the varying directory depth present within a given composer's folder.)
Title: Re: Carnac and regular expressions
Post by: blgentry on April 12, 2017, 05:21:46 pm
One of the things that makes MC such a great tag editor is that it processes expressions right in the Tagging Window.  It's very, very powerful as you have just found out.  :)

Brian.