In
another thread, maid just asked the obvious question. I'd been planning to write this up since they introduced the wonderful new Tag on Import feature, and had never gotten around to it. There's no time like the present.
sorry to be a newb but can you please explain how to insert the rule for Hawaii Five-0
No worries. It is a bit weird.
I'm going to start with a simpler example. Instead of Hawaii Five-0, I'm going to use an episode of CSI recorded by SageTV as an example.
Side Note: I used SageTV recordings as the example files in these instructions, but the ideas behind this are really generalized. Any time you know something ahead of time about the filename of future files themselves, or about how Carnac will interpret those types of filenames, you can use a similar system to get whatever resulting metadata you want.
Tip: Carnac is the name of the new "logic" in MC 17's auto-import system that looks at the filename of files it imports, and it tries to "figure out" what the file likely is based on that filename. It knows common naming patterns like "s06e19" mean the file is Season 6, Episode 19 of some TV Show.
CSI Example (simple):So, assuming your files come in with filenames like this:
CSICrimeSceneInvestigation-S12E10-GeneticDisorder-7091620-0.ts"Carnac" (which is MC's new auto-tagging feature) will set the following:
[Media Sub Type]=TV Show
[Series]=CSI Crime Scene Investigation
[Season]=12
[Episode]=10
All of that is right, except that it is silly that the episodes of CSI are called "CSI Crime Scene Investigation" (a bit redundant, like when people go to an ATM Machine). So, you want to turn the [Series] tag automatically into "CSI" instead. What you need is a rule that replaces the [Series] tag, with something you can calculate using the stuff you already know at import time.
So, open MC's Auto Import options, and edit the settings for the folder where you want these rules to apply. In the lower section of the dialog, add an "Apply these tags" rule:
1. Choose Custom as the type to open the editor.
2. In the Field box, you want to choose Series. That's because the goal is to replace whatever MC would normally decide [Series]
should be, with the results of an expression instead.
3. In the Value box, add the following expression:
If(IsEqual([Series],CSI Crime Scene Investigation,1),CSI,[Series])
That will do it. To be clear, this does NOT go through your existing library and fix files already there, it only impacts new files that Auto-Import picks up (though that same expression would work if you applied it to your whole library). Also note, it has to be Auto-Import that does it (though you can use "Run Auto-Import Now" from the Tools menu). If you import files by drag-dropping them onto MC itself, or from the context menu in Windows Explorer, these rules don't get triggered.
Why does it work?
The first part says
If(<TEST>, <is True do this>, <Otherwise do this>). So, this breaks down as:
1.
Test:
IsEqual([Series],CSI Crime Scene Investigation,1)That just tests if the [Series] tag matches "CSI Crime Scene Investigation". The number 1 at the end, tells IsEqual to work in "case-insensitive string compare for equality" mode.
There are 9 possible modes for the IsEqual command. You can do numeric greater than and less than tests, substring searches, and other things too.
2.
True Result:
CSIThat's pretty simple, if your test comes back positive, you want to fill the [Series] tag (the field you picked in the top box) with "CSI", so you put that in that spot.
3.
False Result:
[Series]This is important, these rules apply to
every file you import from that directory. If, instead of putting an expression in that Value box, you just typed "CSI" in the value box, then no matter what the file MC imported from that directory was called before, the rule would override it and set [Series] to "CSI" every time. So, in this case, you want the result if your test is false, to just keep [Series] set to what it was set to before and move on. To do this, you put the tag in the False spot of your If() statement.
Hawaii Five-0 Example (escape characters):So, moving on to the Hawaii Five-0 example. I saved this because the text we want to put in the True Result part of the If() statement
happens to contain parenthesis. Parenthesis alone will mess up the expression. So, assuming you have files like this one:
HawaiiFive0-S02E12-AlaheoPauole-7091569-0.tsCarnac will set the following:
[Media Sub Type]=TV Show
[Series]=Hawaii Five 0
[Season]=2
[Episode]=12
You want to turn the [Series] tag automatically into "Hawaii Five-0 (2010)". So, add a [Series] Tag on Import rule with its Value set to:
If(IsEqual([Name],Hawaii Five 0,8),Hawaii Five-0 /(2010/),[Series])
The "/" character inserted before those parenthesis are escape characters. That tells the expression engine "this next character is just a text character, don't treat it as anything special".