Application icon

File to Tag from Content

This function can be used to effectively scan a field or named variable by applying a File to Tag template. The supplied template can be chosen from the popup list or manually entered. The only reason to manually enter the template name is if you wish to specify the name at runtime. The template field may contain any of the escape sequences described in Escape Sequences. Note that regardless of the execution mode, the template field is only evaluated once. As this is the case it may be more appropriate to indirectly specify a template in a named variable as opposed to a track variable.

When specifying the content in a named variable, any extracted fields will be applied to all files in the current execution mode. ie. the template is only evaluated once. When specifying the content in a field, the template will be applied once per file (assuming stepwise execution mode).

Note that the content is always forced to have normalized newline sequences. This means that specifying \n as text in the template will always correctly match line terminators.

When the statement is first created, the Treat the content as simple text option will be enabled. When this is set the typical path component handling of the File to Tag functionality is disabled. ie. / characters will not be assumed to separate path components and Folder Start sequences will never match anything.

If you uncheck the Treat the content as simple text option, you can do some interesting things based on the underlying File to Tag functionality. The File to Tag functionality requires a valid path and a filename extension associated with an audio file type that Yate processes. If the content does not begin with a /, one is applied. If the content does not end with a valid filename extension, one will be supplied. In this mode you can take advantage of the template's ability to handle folder extraction via one or more Folder Start tokens. eg. for the following template:

❨Track❩·-·❨Title❩❨Folder Start❩❨Album❩❨Folder Start❩❨Artist❩

and the following content:

artist name/album name/## - title

all will work as expected.

Note that with the Treat the content as simple text option disabled, scanning for a / character will never work.


There is a special mode which disables the modification of any files and saves the results as a key-value list. The functionality is enabled via the Save results as a key-value list option. The functionality is only available when the content is in a named variable. The results are saved to the File to Tag from Content Results named variable. The keys are separated from values by the \k sequence. List items are separated by the \~ sequence. Most keys are the symbolic name of a Yate field which is suitable to be used with the Set Indirect statement. Note that you cannot indirectly assign to track variables. The keys Variable 0 thorough Variable 15 are intended to be used for content requiring special handling.

There is a second special mode called Save Template Layout. This mode returns the actual tokens and text represented by the template. The items are stored as a list in the File to Tag from Content Results named variable. List items are separated by the \~ sequence. Tokens are identifiable by having a character at start of the list item. All characters after the character represent the token name. The List Secondary Delimiter escape sequence \: can be used to test for this character. Note when Save Template Layout is enabled, no actual extraction takes place.

The action test state is set to true if for any execution mode at least one file had metadata applied or content was saved to the File to Tag from Content Results named variable. Note that a test state of true does not necessarily imply that changes were made as values applied might be the same as a file's current values.



Additional File to Tag information can be found in:

Preferences - File to Tag templates

The File to Tag Template Editor

The File to Tag Action Statement

Information on alternate means of parsing or scanning

Find and Remove

Regular Expression

Replace

Scanner

List Statements