Library Fields: Difference between revisions

From wiki.jriver.com
Jump to navigation Jump to search
 
(9 intermediate revisions by 3 users not shown)
Line 42: Line 42:
== Predefined and Custom Fields ==
== Predefined and Custom Fields ==


{{See also|Predefined Library Fields}}
''See also:'' [[Predefined Library Fields]]


Media Center includes a number of predefined Fields, and you can add as many of your own custom fields as you'd like! To view and manage the Fields currently available in your Library, use the Library Field Manager available at <span style="color:#8B4513">Tools > Options > Library & Folders > Manage Library Fields</span>. A few of the predefined Library Fields have special meanings or behaviors in MC. These include:
Media Center includes a number of predefined Fields, and you can add as many of your own custom fields as you'd like! To view and manage the Fields currently available in your Library, use the Library Field Manager available at <span style="color:#8B4513">Tools > Options > Library & Folders > Manage Library Fields</span>. A few of the predefined Library Fields have special meanings or behaviors in MC. These include:
Line 56: Line 56:
In the Library Field Manager, you can view but not modify most of the settings for the Predefined fields. However, for most of them you can toggle whether MC should save them to in-file tags, and modify the search keywords and behavior. For more information about which predefined fields are included and other details, refer to the [[Predefined Library Fields]] article.
In the Library Field Manager, you can view but not modify most of the settings for the Predefined fields. However, for most of them you can toggle whether MC should save them to in-file tags, and modify the search keywords and behavior. For more information about which predefined fields are included and other details, refer to the [[Predefined Library Fields]] article.


As mentioned above, you can also create a nearly limitless array of custom fields to store any information about your files you can dream up. Custom fields may be added with the '''Add New Field''' button in the Manage Library Fields dialog. You can add both standard fields that look and act just like the predefined fields, and also calculated fields, that outputs the value of an [[Expression]] on the fly whenever displayed.
As mentioned above, you can also create a nearly limitless array of custom fields to store any information about your files you can dream up. Custom fields may be added with the '''Add New Field''' button in the Manage Library Fields dialog. You can add both standard fields that look and act just like the predefined fields, and also calculated fields, that output the value of an [[Expression]] on the fly whenever displayed.


== Field Characteristics ==
== Field Characteristics ==
Line 64: Line 64:
{| style="float: right;" border="0" cellspacing="0" cellpadding="1"
{| style="float: right;" border="0" cellspacing="0" cellpadding="1"
|-
|-
| [[File:Library_Fields.png]]
| [[File:Library_Fields2.png]]
|}
|}


Each field has the following characteristics:
Each field has the following characteristics (Note these are current as of Media Center 28):


# '''Name''': The internal name actually given to the field in the Library. This cannot be changed for any field created, and is the text to be used in [[square bracket notation]] references to the field.
# '''Name''': The internal name actually given to the field in the Library. This cannot be changed for any field created, and is the text to be used in [[square bracket notation]] references to the field.
# '''Display''': This is the name (and its pluralized version) that will be used used throughout the user interface. By default this matches the field's real name, but this can be modified to make it look nicer for display.
# '''Display''': This is the name (and its pluralized version) that will be used used throughout the user interface. By default this matches the field's real name, but this can be modified to make it look nicer for display.
# '''Description''': Optionally enter a description for custom fields here. This description will also show as a tooltip for the list column header.
# '''Flags''': Indicates what Media Types the field is available for use with (Audio, Image, Video, Data, TV).
# '''Flags''': Indicates what Media Types the field is available for use with (Audio, Image, Video, Data, TV).
# '''Hidden''': Available for user fields only, when checked, hides it, and adds the field to the hidden field list.
# '''Field Type''': Sets the field to either a standard field (user data) or one automatically generated based on an expression (calculated data).
# '''Field Type''': Sets the field to either a standard field (user data) or one automatically generated based on an expression (calculated data).
# '''Data Type''': The kind of data the field contains (text string, integer, date, etc).
# '''Data Type''': The kind of data the field contains (text string, integer, date, etc).
Line 78: Line 80:
# '''Acceptable Values''': This can be set to a semicolon-delimited list, which limits the field so it can only contain one of the listed values and not free-form text (Note: no spaces after the semicolons).
# '''Acceptable Values''': This can be set to a semicolon-delimited list, which limits the field so it can only contain one of the listed values and not free-form text (Note: no spaces after the semicolons).
# '''Save in file tags (when possible)''': If enabled, Media Center will attempt to write the field value to the in-file tags.
# '''Save in file tags (when possible)''': If enabled, Media Center will attempt to write the field value to the in-file tags.
# '''Show a link checkbox''': Linkable columns can be enabled/disabled at Options>General>Features. When that is enabled, this checkbox allows the user control over what is linkable and what is not.
# '''Allow custom data to override the expression''': Available in Media Center 28 and later, when checked, the calculated data field becomes editable, either in-line or via the tag window, with any entered data replacing the calculated data. To return to using the calculated result, simply delete the manually entered data.
# '''Search keywords''': Used in queries as abbreviated or alternate names for the field.
# '''Search keywords''': Used in queries as abbreviated or alternate names for the field.
# '''Default search field''': Sets the field to be searched by default when simple searches are entered in the search box.
# '''Default search field''': Sets the field to be searched by default when simple searches are entered in the search box.
Line 92: Line 96:
'''Calculated Data Fields''' are fields that are automatically calculated on the fly. They output the value of an [[Expression]] which is defined in the Manage Library Fields dialog. The value is recalculated on the fly each time the value is accessed or displayed. A calculated field can be thought of as a way to "save" a useful Expression and allow it to be named and used like any other Field.
'''Calculated Data Fields''' are fields that are automatically calculated on the fly. They output the value of an [[Expression]] which is defined in the Manage Library Fields dialog. The value is recalculated on the fly each time the value is accessed or displayed. A calculated field can be thought of as a way to "save" a useful Expression and allow it to be named and used like any other Field.


Storage for calculated fields does not add additional library storage per file, since they are evaluated when used. If configured to be default search fields, calculated fields will produce some search performance penalty in search box suggestions, and possibly other library searches. The values of calculated fields cannot be stored in file tags. Also, since Calculated Fields always output the value of the expression, they act like read-only fields throughout Media Center, and most of the other settings about the field are disabled. However, you are still able to modify the Edit Type so that you can create a calculated field that ''displays'' as Stars or a Checkbox when displayed. Expressions output string values by default, but if you need an expression to output a different data type, you can define this in the expression itself (see [[Expression_Language#Data_Types|Expression Language Data Types]] for more information).
Storage for calculated fields does not add additional library storage per file, since they are evaluated when used. If configured to be default search fields, calculated fields will produce some search performance penalty in search box suggestions, and possibly other library searches. The values of calculated fields cannot be stored in file tags. Also, in versions earlier than Media Center 28, since Calculated Fields always output the value of the expression, they act like read-only fields throughout Media Center. Using Media Center 28 or later however, it is possible, providing the option detailed above is checked, to override the calculated results by editing the field in the normal fashion. Most of the other settings about the field are disabled. However, you are still able to modify the Edit Type so that you can create a calculated field that ''displays'' as Stars or a Checkbox when displayed. Expressions output string values by default, but if you need an expression to output a different data type, you can define this in the expression itself (see [[Expression_Language#Data_Types|Expression Language Data Types]] for more information).


=== Data Types ===
=== Data Types ===
Line 174: Line 178:
:[Some Field Name]
:[Some Field Name]


That is the standard notation Media Center uses to indicate that you want to substitute the value of a field. It is used throughout the [[Expression Language]] and [[Search Language]] and in many other places throughout the application. If you are writing your own expression or search, and you want to substitute in or refer to the values of a particular field, then this is the way you do it.
This is a shortcut for the [[Field()]] function of the [[Expression Language]], and is the standard notation used whenever you need to substitute the value of a field. It is used throughout the [[Expression Language]] and [[Search Language]] and in many other places throughout the application. Media Center will parse this notation for all fields (including custom fields) and substitute in the ''values of'' that field on the fly for each file.

Note that square bracket notation always evaluates to the ''values of'' the field, and is not used to refer to the field ''itself''. This is an important distinction when using some expression language and search functions such as [[GroupCount()]] and {{monospace|~expand}}. Refer to [http://yabb.jriver.com/interact/index.php?topic=81766.0 this thread for Matt's explanation].

==== Formatted, Raw & Referenced Values ====


By default, Media Center formats the output of the field and displays it in a friendly, human-readable way. However, you can provide an optional parameter to any field you reference using standard square bracket field notation that controls whether the output is the "regular" formatted value (the default) or the raw value actually stored in the [[Library]]:
By default, Media Center formats the output of the field and displays it in a friendly, human-readable way. However, you can provide an optional parameter to any field you reference using standard square bracket field notation that controls whether the output is the "regular" formatted value (the default) or the raw value actually stored in the [[Library]]:
Line 180: Line 188:
* [Some Field,0] : Outputs raw value from the database.
* [Some Field,0] : Outputs raw value from the database.
* [Some Field,1] : Outputs formatted value. This is the default so is equivalent to [Some Field].
* [Some Field,1] : Outputs formatted value. This is the default so is equivalent to [Some Field].
* [Some Field, 1, 1653] : Outputs formatted value of the field ''Some Field'' for the file referenced by the [[FileKey()]] ''1653''.


This parameter corresponds to the [[MJFileAutomation#string_Get.28string_strField.2C_boolean_bFormatted.29|bFormatted parameter of the Get() function]] in the COM API, and the parameter available for [[Expression_Language#Fields|the field() function in the Expression Language]].
This parameter corresponds to the [[MJFileAutomation#string_Get.28string_strField.2C_boolean_bFormatted.29|bFormatted parameter of the Get() function]] in the COM API, and the parameter available for [[Expression_Language#Fields|the field() function in the Expression Language]].

Latest revision as of 11:17, 12 May 2024

Media Center helps you manage, organize and view your files by maintaining a collection of metadata fields, or properties, about each file in the Library. These properties are called Library Fields (or often just Fields). Library Fields are managed in the Library Fields Manager available via:

Tools > Options > Library & Folders > Manage Library Fields

Some examples of Library Fields are:

  • [Artist], [Album] and [Genre] for audio files
  • [Actor], [Director], and [Aspect Ratio] for movies
  • [Series], [Season], and [Episode] for TV show episodes
  • [Width], [Height], [Caption], and [Focal Length] for images.
  • [Media Type], [Media Sub Type], [File Type], and [Name] for all file types.

When used in expressions or searches, a field is usually written by surrounding its name with square brackets, as shown above. So, Album Artist is written and used as [Album Artist], and that convention is used here on the Wiki and generally on Interact.

Fields are the main system that Media Center uses to manage, search, sort, and organize files. It is how Media Center shows Audio files under the Audio part of the Tree, and Video files under the video part of the Tree, and are the fundamental underlying structure that makes features like Media Views, Smartlists, Play Doctor, and Automatic Metadata Lookup work.

Fields, Properties, and Tags

The terms properties, fields, and tags are sometimes used synonymously in common language. Generally, we use the terms in the following manner:

  • Fields: each of the database "columns" MC uses to store metadata for each file (the idea of [Artist], [Genre], or [Series])
  • Properties (or Values): the individual characteristic stored for an actual file (ABBA, Disco, or The Big Bang Theory).
  • Tags: the pieces of metadata that are embedded within the files themselves, where possible (the stuff written to the files for interchange with other applications).

It might help to think of a spreadsheet, where column headers are fields, rows are files, and each individual cell's values are the file's properties. If each row were saved to an external file, the row's cells would be called tags.

Initially, a file's Fields are filled with default values when the file is Imported or created by Media Center (e.g. when ripping a CD or DVD). Typically, this data comes from a file's internal tags, information you enter when ripping a disc, or is looked up from external databases (YADB and the Automatic Metadata Lookup system for videos). In addition, several Library Tools are available to assist in creating or modifying properties and tags.

File Tags

For many file types, Media Center can also save the Library Fields into the tags within the file on disk. These tags are then available for use by other programs that support the specific file types, and can serve as a backup in case your Media Center Library is damaged or lost. The tags supported by a given file type are file type-specific, but there is often commonality or overlap in various media or file formats. Media Center helps manage this by automatically mapping its own Fields to essentially similar tags with different names in the various standard tagging formats.

For more information on tag/metadata specifications for file formats, refer to the following external websites:

In addition, Media Center allows creation of an almost limitless number of custom (or user) Fields. This allows for managing information about files that is not predefined by Media Center or by a given format's standard tags. These custom properties may also be saved to a file's tags, should the format support user-defined or extensible tags.

Saving file properties to the physical file allows tags to be re-imported by Media Center, and used by other programs on a variety of systems. While typical metadata consumes a trivial amount of extra disk storage (relative to the file's size), larger metadata such as cover art, lyrics or extensive notes may be more noticeable, especially when files are exported to smaller devices such as handhelds. See Update Tags When File Info Changes for more information.

Predefined and Custom Fields

See also: Predefined Library Fields

Media Center includes a number of predefined Fields, and you can add as many of your own custom fields as you'd like! To view and manage the Fields currently available in your Library, use the Library Field Manager available at Tools > Options > Library & Folders > Manage Library Fields. A few of the predefined Library Fields have special meanings or behaviors in MC. These include:

  • Media Type: The primary media type categories (Audio, Images, Video, and Data).
  • Media Sub Type: The secondary media type categories (Audiobook, Music, Podcast, TV Show, Movie, etc)
  • Album Artist (Auto): Used to automatically display the [Album Artist] or [Artist] fields for multi-artist albums.
  • [The TVDB Series ID], [Series], [Season], and [Episode]: Used for Automatic Metadata Lookup of TV Show episodes.
  • [Date], [Date (day)], [Date (month)], [Date (year)]: The primary [Date] field is automatically split into individual components so they can easily be used independently.
  • [Last Played], [Number Plays], [Last Skipped], [Skip Count]: Used to track Play Statistics.
  • [Bookmark] and [Use Bookmarking]: Used for the Bookmarking (automatic playback resume) system.

In the Library Field Manager, you can view but not modify most of the settings for the Predefined fields. However, for most of them you can toggle whether MC should save them to in-file tags, and modify the search keywords and behavior. For more information about which predefined fields are included and other details, refer to the Predefined Library Fields article.

As mentioned above, you can also create a nearly limitless array of custom fields to store any information about your files you can dream up. Custom fields may be added with the Add New Field button in the Manage Library Fields dialog. You can add both standard fields that look and act just like the predefined fields, and also calculated fields, that output the value of an Expression on the fly whenever displayed.

Field Characteristics

Fields in Media Center have several defined characteristics. You can view how the built-in fields are configured, and manage the settings for any custom fields you have created, using the Manage Library Fields dialog available at Tools > Options > Library & Folders > Manage Library Fields.

Library Fields2.png

Each field has the following characteristics (Note these are current as of Media Center 28):

  1. Name: The internal name actually given to the field in the Library. This cannot be changed for any field created, and is the text to be used in square bracket notation references to the field.
  2. Display: This is the name (and its pluralized version) that will be used used throughout the user interface. By default this matches the field's real name, but this can be modified to make it look nicer for display.
  3. Description: Optionally enter a description for custom fields here. This description will also show as a tooltip for the list column header.
  4. Flags: Indicates what Media Types the field is available for use with (Audio, Image, Video, Data, TV).
  5. Hidden: Available for user fields only, when checked, hides it, and adds the field to the hidden field list.
  6. Field Type: Sets the field to either a standard field (user data) or one automatically generated based on an expression (calculated data).
  7. Data Type: The kind of data the field contains (text string, integer, date, etc).
  8. Relational: Stores a single value for each file, each series, each album, or each artist.
  9. Edit Type: Sets how the field is displayed and edited in Media Center's interface.
  10. Acceptable Values: This can be set to a semicolon-delimited list, which limits the field so it can only contain one of the listed values and not free-form text (Note: no spaces after the semicolons).
  11. Save in file tags (when possible): If enabled, Media Center will attempt to write the field value to the in-file tags.
  12. Show a link checkbox: Linkable columns can be enabled/disabled at Options>General>Features. When that is enabled, this checkbox allows the user control over what is linkable and what is not.
  13. Allow custom data to override the expression: Available in Media Center 28 and later, when checked, the calculated data field becomes editable, either in-line or via the tag window, with any entered data replacing the calculated data. To return to using the calculated result, simply delete the manually entered data.
  14. Search keywords: Used in queries as abbreviated or alternate names for the field.
  15. Default search field: Sets the field to be searched by default when simple searches are entered in the search box.

Field Types

When fields are created, they can be one of two main types:

  • User Data
  • Calculated Data

User Data Fields are standard fields which contain a value provided by the user or intrinsic to the file. Values for User Data fields are stored directly in the Library (database) and (optionally) in the embedded file tags as well.

Calculated Data Fields are fields that are automatically calculated on the fly. They output the value of an Expression which is defined in the Manage Library Fields dialog. The value is recalculated on the fly each time the value is accessed or displayed. A calculated field can be thought of as a way to "save" a useful Expression and allow it to be named and used like any other Field.

Storage for calculated fields does not add additional library storage per file, since they are evaluated when used. If configured to be default search fields, calculated fields will produce some search performance penalty in search box suggestions, and possibly other library searches. The values of calculated fields cannot be stored in file tags. Also, in versions earlier than Media Center 28, since Calculated Fields always output the value of the expression, they act like read-only fields throughout Media Center. Using Media Center 28 or later however, it is possible, providing the option detailed above is checked, to override the calculated results by editing the field in the normal fashion. Most of the other settings about the field are disabled. However, you are still able to modify the Edit Type so that you can create a calculated field that displays as Stars or a Checkbox when displayed. Expressions output string values by default, but if you need an expression to output a different data type, you can define this in the expression itself (see Expression Language Data Types for more information).

Data Types

Fields can store different types of data, such as strings of text or integers. For User Data fields, this is set with the Data Type dropdown in the Manage Library Fields dialog, and can be one of the following types:

Field Data Types
Data Type Description
String An unformatted sequence of characters.
Integer A whole number (no decimal portion).
Decimal A floating point number.
Percentage A decimal from 0 to 1 indicating 0% to 100%.
List A semicolon-separated list of strings.
Date A complex type that is either date-only, or date and time.

Relational Fields

Most fields store one discreet value for each file stored in the Library. However, Relational fields allow you to instead store a single value for all files from a particular Album, Series, or Artist. So, if the value of a relational field is changed for one file in a set, then the value is simultaneously changed for all files in that set. In all other aspects, these fields work identically to normal fields.

An example of this is the built-in [The TVDB Series ID] field, which stores one value for each Series. This is used by the Automatic Metadata Lookup system for TV Show episodes. When the lookup occurs, the system saves the Series ID from thetvdb.com to this field, and then future lookups for any additional episode of that same series search for this ID number instead of the text [Series] name value. That lets you save files in your Library using a different naming scheme for a particular Series than thetvdb.com prefers, without having to manually look up each and every episode to have good metadata.

You can make your own relational fields and store a value keyed off of:

  • [Artist]
  • [Album]
  • [Series]

At this time it is not possible to key a relational field off of any other arbitrary or user-defined fields in the Library.

Field Edit Types

A field's Edit Type controls how it is displayed and how it can be edited throughout the application. Most fields use the Standard Edit Type, which displays a simple text string and allows you to edit it in a text box, with a drop-down menu providing the values available in other files in the Library.

But other fields have special behavior. [Lyrics] is a Large Value field, and opens in a full-height text editor, allowing you to add paragraphs and returns. [Ratings], on the other hand, shows 5 stars that you can click on to modify the current rating. Other values are read-only or clear-only, are treated as lists, or handle filenames. The full list of Edit Types available are:

Field Edit Types
Edit Type Description
Standard A free-format, editable field.
Clear-only A field that can only be cleared, and not set manually within Media Center.
Large Value A free-format, editable field, used for multi-line text (e.g. lyrics, notes, descriptions).
Cannot be edited A non-editable field.
Filename A file-path specification field.
Five stars A selectable, 5-star graphical field, typically used for ratings.
DVD video info Used internally.
List List fields display using the list-type editors in the Tag Action Window and Panes.
Check Check fields display with a check box that sets a 1 value when checked, and a 0 value when unchecked.
Ten Stars A selectable, 10-star graphical field, typically used for ratings.

Field Values

Field values are stored in the Library. They can be viewed and edited in a variety of ways. Everywhere in Media Center you see information about your files, it is displaying the values of fields. Also, the entire Media View system itself is driven by the values of fields. For example, the reason that, when you open the Audio part of the Tree, it displays your audio files, and not your image or video files, is because the Audio Media View searches for files where the [Media Type] field is set to Audio.

When you view your files in details view or navigate using Categories or Panes, the program is displaying the contents of various fields like [Artist], [Album], and [Genre].

The process of editing field values to apply metadata to your files is called Tagging. It is essential to fill in at least some of the basic fields in order to make the most of Media Center, because so many of the powerful tools are built on the flexible metadata system (including Media Views, Smartlists, and Search functions). To this end, MC includes a number of powerful Library Tools which can be used to quickly and painlessly apply metadata to your files, even if the proper details aren't picked up automatically at import. For more information, refer to the Tagging article.

Square Bracket Notation

As mentioned above we refer to fields throughout this wiki using a notation surrounded by square brackets like so:

[Some Field Name]

This is a shortcut for the Field() function of the Expression Language, and is the standard notation used whenever you need to substitute the value of a field. It is used throughout the Expression Language and Search Language and in many other places throughout the application. Media Center will parse this notation for all fields (including custom fields) and substitute in the values of that field on the fly for each file.

Note that square bracket notation always evaluates to the values of the field, and is not used to refer to the field itself. This is an important distinction when using some expression language and search functions such as GroupCount() and ~expand. Refer to this thread for Matt's explanation.

Formatted, Raw & Referenced Values

By default, Media Center formats the output of the field and displays it in a friendly, human-readable way. However, you can provide an optional parameter to any field you reference using standard square bracket field notation that controls whether the output is the "regular" formatted value (the default) or the raw value actually stored in the Library:

  • [Some Field,0] : Outputs raw value from the database.
  • [Some Field,1] : Outputs formatted value. This is the default so is equivalent to [Some Field].
  • [Some Field, 1, 1653] : Outputs formatted value of the field Some Field for the file referenced by the FileKey() 1653.

This parameter corresponds to the bFormatted parameter of the Get() function in the COM API, and the parameter available for the field() function in the Expression Language.

A simple example is numeric fields, such as [Track #]. When these fields are set to 0, then they display blank when viewed. If you want [Track #] to actually output these zeroes (to do math on them in an Expression, perhaps) you need to use [Track #,0] instead. Another example is Date values, which are stored internally as floating point numbers, and to see the "real" value you need to set the bFormatted parameter to zero.

Tag Import Options

When you Import a file, Media Center will automatically fill the corresponding fields for many standard Tags and store these in the Library. It also calculates a number of characteristics about the files and imports these into the Library (file size, encoding type, etc).

To import non-default file tags into Media Center, first create a custom field named exactly as the physical tag appears in the media file. Subsequent imports, or Update library (from tags) will populate the custom field with the file tag values. A tag dump will show the physical file tags for a single selected file.

More