Difference between revisions of "Tag on Import"

From JRiverWiki
Jump to: navigation, search
 
(35 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[File:MC19-AutoImport-Folder Settings.png|thumb|right|350px|The Tag on Import section of the Folder Settings dialog here has a number of useful rules added.]]
+
[[File:AutoImport-Folder Settings.png|thumb|right|380px|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 section of the [[Auto-Import#Folder_Settings|Folder Settings]] dialog called ''Apply these tags''.
+
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 [[Auto-Import#Folder_Settings|Folder Settings]] dialog.
  
Tag On Import rules can be set up for:
+
Tag on Import rules can be set up for:
 
* Each [[Auto-Import#Watched_Folders|Watched Folder]] in Auto-Import can have their own set of rules
 
* Each [[Auto-Import#Watched_Folders|Watched Folder]] in Auto-Import can have their own set of rules
 
* [[Import#Importing_a_Single_Folder|Importing a Single Folder]]
 
* [[Import#Importing_a_Single_Folder|Importing a Single Folder]]
Line 10: Line 10:
 
Files imported via [[Import#One_Time_Imports|other mechanisms]] (such as Drag-and-Drop or the Windows Explorer Shell Extensions) '''do not''' obey any Tag on Import rules you have defined.
 
Files imported via [[Import#One_Time_Imports|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 ==
+
== 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".
 
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".
Line 20: Line 20:
  
 
If none of the suggestions match what you'd like to do, pick ''Custom''. This opens up the custom Tag on Import dialog. Then:
 
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 to match the field where you'd like the tag to be applied.
+
* 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.
 
* 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.
 
* 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.
 
[[File:TagOnImport-Dialog-Simple.png|frame|none]]
 
[[File:TagOnImport-Dialog-Simple.png|frame|none]]
 +
 +
=== 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 ===
 
=== 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''.
+
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_Language|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:
+
This is actually easy to do! The Value field in the Tag on Import rule dialog can be set to an [[Expression_Language|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:
 
[[File:TagOnImport-Dialog-Expression.png|frame|none]]
 
[[File:TagOnImport-Dialog-Expression.png|frame|none]]
  
Line 37: Line 41:
 
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).
 
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 ==
+
== 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 do those manually, and your Tag On Import rule will apply to new files you import in the future.
+
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.
+
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.
  
 
[[File:TagOnImport-Expression-Fixing Series.png|frame|none|This rule changes any file already tagged "NCISLA" to "NCIS Los Angeles" instead, which allows it to be found automatically on [http://thetvdb.com theTVDB].]]
 
[[File:TagOnImport-Expression-Fixing Series.png|frame|none|This rule changes any file already tagged "NCISLA" to "NCIS Los Angeles" instead, which allows it to be found automatically on [http://thetvdb.com theTVDB].]]
  
Also, as is noted above, Tag On Import rules are '''only''' applied when when files are imported via certain mechanisms:
+
=== Conflicts with JRSidecar.xml Files ===
* Auto-Import [[Auto-Import#Watched_Folders|Watched Folders]] (whether run in the background or manually via the Run Auto-Import Now function)
 
* [[Import#Importing_a_Single_Folder|Import a Single Folder]]
 
* Television recording schedules
 
  
Files which are imported via other mechanisms do not obey the Tag On Import settings set up elsewhere.
+
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).
  
== Conflicts Between In-File Tags and Tag On Import Rules ==
+
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.
  
When Importing files, MC always respects embedded tags above all other things. Tag On Import rules '''will not''' overwrite a field that is filled explicitly by an in-file tag, or via a JRSidecar.xml file (if you have these enabled and they exist).
+
=== Re-Imported Files ===
  
Also, note that if testing Tag On Import rules, and re-importing files you've already imported once before as a test, you may need to [http://yabb.jriver.com/interact/index.php?topic=72593.msg491631#msg491631 remove the file from Media Center's hidden "deleted items" database]. 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), but can make testing Tag On Import rules difficult in some cases.
+
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 [http://yabb.jriver.com/interact/index.php?topic=72593.msg491631#msg491631 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 ==
 
== 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.
+
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:
 
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:
Line 69: Line 70:
  
 
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.
 
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 ==
 +
[[File:TagOnImport-Rating Example.png|frame|right|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: <code>0</code>
 +
 +
;Force the [Name] field to match the filename (without the file extension)
 +
: Field: Name
 +
: Value: <code>Filename(,0)</code>
 +
 +
;Change the [Genre] of Voice Memos Imported from iTunes
 +
: Field: Genre
 +
: Value: <code>If(IsEqual([Filename],\iTunes\iTunes Media\Voice Memos,8),Voice Memo,[Genre])</code>
 +
 +
;Fix a [Series] name that doesn't match your preference
 +
: Field: Series
 +
: Value: <code>If(IsEqual([Series],CSI Crime Scene Investigation,1),CSI,[Series])</code>
 +
 +
;Fix a [Series] name for a show that sometimes isn't parsed by Carnac correctly
 +
: Field: Series
 +
: Value: <code>If(IsEqual([Name],How The Universe Works,8),How The Universe Works,[Series])</code>
 +
 +
;Set a [Genre] for all episodes imported of a particular Series
 +
: Field: Genre
 +
: Value: <code>If(IsEqual([Series],Jeopardy,8),Game Show,[Genre])</code>
 +
 +
;Set the [Name] field to a formatted version of Date Created for a news program
 +
: Field: Name
 +
: Value: <code>If(IsEqual([Series],BBC World News,1),FormatDate([Date Created,0],DateTime,Unknown Date),[Name])</code>
 +
 +
;Set [Media Sub Type] to Music for all Audio files (if you haven't already set it previously)
 +
: Field: Media Sub Type
 +
: Value: <code>If(IsEqual([Media Type],Audio,1),Music,[Media Sub Type])</code>
 +
: Skip for files that already have a value in this field: checked
 +
 +
;Pick on Matt for your own amusement
 +
: Field: Comment
 +
: Value: <code>If(IsEqual([Artist],ABBA,1),Matt loves this band,[Comment])</code>
  
 
== More ==
 
== More ==
  
* [http://yabb.jriver.com/interact/index.php?topic=68462.0/ "How To: Use Tag on Import rules In Auto-Import For Fun and Profit"]: A detailed tutorial showing how to construct Tag On Import expressions like those discussed above.
+
* [http://yabb.jriver.com/interact/index.php?topic=68462.0/ "How To: Use Tag on Import rules In Auto-Import For Fun and Profit"]: A detailed tutorial showing how to construct Tag on Import expressions like those discussed above.
  
 
[[Category:Import]]
 
[[Category:Import]]
 +
[[Category:Metadata and Tags]]

Latest revision as of 16:30, 18 April 2015

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