Tag on Import

From JRiverWiki
Jump to: navigation, search
The Tag on Import section of the Folder Settings dialog here has a number of useful rules added.

Media Center's Auto-Import system includes a powerful tool which can automatically apply tags for you to files as they are imported. This allows you to automate repetitive tagging tasks, and can "pre-tag" all files that enter your Library from particular folders. You set this up in the Apply these tags section of the Folder Settings dialog.

Tag on Import rules can be set up for:

Files imported via other mechanisms (such as Drag-and-Drop or the Windows Explorer Shell Extensions) do not obey any Tag on Import rules you have defined.

Adding Tag on Import Rules

The simplest types of rules apply the same tag value to all files imported in from that folder. For example, the following simple rule forces all files imported in the selected folder to import with the value of [Media Sub Type] set to "Music".

TagOnImport-Simple-MediaSubType Music-Cropped.png

To add a new rule, open the Folder Settings dialog for the item for which you need the rule, and click the Add button in the Apply these rules section. This button shows a pop-out menu that allows you to choose from a few common default examples.

TagOnImport-Add Rule.png

If none of the suggestions match what you'd like to do, pick Custom. This opens up the custom Tag on Import dialog. Then:

  • Set the Field box with the field where you'd like the rule to write new values.
  • Set the Value box to the value you'd to set for this field for each new file imported.
  • If you only want to apply this value for files that otherwise do not have a value already, check the Skip for files that already have a value box.
TagOnImport-Dialog-Simple.png

List Type Fields

If you add a Tag on Import rule that applies a value to a List Type field, such as [Keywords] or [Genre], the value will be added to any existing value rather than replacing the value already there (from an embedded ID3 tag, for example).

Using Expressions in Rules

The simplest Tag on Import rules apply the exact same tag value to every file imported from the selected folder. This is occasionally useful if the folder in question contains only certain types of files. However, it is often useful to apply a value to the field only conditionally based on some other characteristic of the file. For example, you might want to set the [Genre] to "Kids" only if the file imported is an episode of Dora the Explorer.

This is actually easy to do! The Value field in the Tag on Import rule dialog can be set to an Expression, using any of the features of the expression language. So, to accomplish the example given above, you check to see if [Series] tag already contains "Dora the Explorer", and then apply the tag if it does. Like this:

TagOnImport-Dialog-Expression.png

Value Expression: If(IsEqual([Series],Dora the Explorer,8),Kids,[Genre])

You can usually use simple expressions following this pattern to apply tags to only certain files in the import folder. Look at the value of some existing field (such as [Filename] or something else that you know will already have a good value) and then if it matches the result you want, apply the particular value. If not, just pass through the pre-existing value (so you don't overwrite anything already there).

When Tag on Import Is Applied

Tag on Import rules are only applied when files are first Imported. They do not run continuously on files that are already in your Library. If you want to tag files you've already imported, you need to tag those manually, and your Tag on Import rule will apply to new files you import in the future. Also, as is noted above, Tag on Import rules are only applied when when files are imported via the Auto-Import and Television recording systems. If you import files by drag-and-drop or via the Windows Explorer Shell Extensions, any Tag on Import rules you've defined in your Auto-Import settings are not applied.

During the Import process, Tag on Import rules are run after all other parsing and analysis Media Center does as part of importing the file. This means that you can count on all normally filled tags to already be filled before these rules are applied, including filename parsing done by Carnac and reading any embedded file tags (and information stored in JRSidecar.xml files if enabled). The only major step of Importing that is not done before Tag on Import rules are run is the Automatic Metadata Lookup system (which downloads metadata for TV Shows and Movies from online databases). This is useful because it allows you to "massage" the needed fields (such as the [Series] field) for files which otherwise wouldn't be looked up properly.

This rule changes any file already tagged "NCISLA" to "NCIS Los Angeles" instead, which allows it to be found automatically on theTVDB.

Conflicts with JRSidecar.xml Files

Tag on Import rules will not overwrite fields that are filled explicitly by a JRSidecar.xml file (if these are enabled and already exist). If the field in question is a list-type field, the Tag on Import rules can add values to the ones defined in the JRSidecar files, but if there is a conflict between the two, the sidecar data always "wins". If you are testing with files which might have a JRSidecar.xml file on disk, you will usually need to delete any existing JRSidecar.xml files before you will see the proper results (also see below).

However, you are able to overwrite values applied during import from embedded in-file tags, Carnac, and those applied by previous Tag on Import rules.

Re-Imported Files

If are testing a Tag on Import rule and you try to re-import files you've already imported once before and removed, you will need to remove the file from Media Center's hidden "deleted items" database before the Tag on Import rules will be triggered. When you re-import a file that MC has already seen in the past, it "undeletes" it from the database, instead of importing it from scratch. This preserves any metadata for files you may have accidentally deleted (and makes the files import more quickly). However, this means the Tag on Import rules are not run for these files unless you first clear them from the hidden Deleted Items database.

Rule Order

Tag on Import Rules are applied in order from top to bottom as they are shown in the Apply these tags list. To reorder rules you've already created, you can simply drag them up and down in the list.

This allows you to use simple expressions to set one value with a previous rule, and then apply other values later on depending on value of other fields. For example, you can make a bunch of rules that set the [Genre] of files to "Kids" if the Series matches particular values:

TagOnImport-Kids Genre Example-1.png

Then, further down in the list, you can apply a single common tag to all files where [Genre] is equal to "Kids":

TagOnImport-Kids Genre Example-2.png

The order also makes it easier to use the Skip for files that already have a value checkbox (described above) to conditionally apply tags to files. This allows you to use simple expressions (like those shown above) to set values for fields based on the file properties already known at import time, and still have a default (down at the bottom of the list) that "catches everything else" and sets a default value for those otherwise not set earlier.

Useful Examples

Use this Tag on Import rule to set all files to unrated automatically when imported.

Here are a few simple useful examples you can use to override the default import behavior in Media Center.

Reset any embedded Ratings tags to unrated
Field: Rating
Value: 0
Force the [Name] field to match the filename (without the file extension)
Field: Name
Value: Filename(,0)
Change the [Genre] of Voice Memos Imported from iTunes
Field: Genre
Value: If(IsEqual([Filename],\iTunes\iTunes Media\Voice Memos,8),Voice Memo,[Genre])
Fix a [Series] name that doesn't match your preference
Field: Series
Value: If(IsEqual([Series],CSI Crime Scene Investigation,1),CSI,[Series])
Fix a [Series] name for a show that sometimes isn't parsed by Carnac correctly
Field: Series
Value: If(IsEqual([Name],How The Universe Works,8),How The Universe Works,[Series])
Set a [Genre] for all episodes imported of a particular Series
Field: Genre
Value: If(IsEqual([Series],Jeopardy,8),Game Show,[Genre])
Set the [Name] field to a formatted version of Date Created for a news program
Field: Name
Value: If(IsEqual([Series],BBC World News,1),FormatDate([Date Created,0],DateTime,Unknown Date),[Name])
Set [Media Sub Type] to Music for all Audio files (if you haven't already set it previously)
Field: Media Sub Type
Value: If(IsEqual([Media Type],Audio,1),Music,[Media Sub Type])
Skip for files that already have a value in this field: checked
Pick on Matt for your own amusement
Field: Comment
Value: If(IsEqual([Artist],ABBA,1),Matt loves this band,[Comment])

More