25 May 2019

Help

  1. Way to produce metadata
    1. Video properties mapping
    2. Parsing original title
  2. Metadata overriding
  3. Properties overriding

Metadata

Way to produce metadata

Component supports two ways to produce metadata. First one is to map video properties to metadata fields as is. Second one is to parse video title and extract metadata out of it. Video properties mapping is default way, because it gives consistent results for all videos. However if you mostly or always play music from Youtube, consider using video title parsing way.

Video properties mapping

For tracks representing videos this approach is straightforward: use channel title as %artist% and original video title from the site as %title%.

Tracks representing playlists, channels and search have more metadata fields. In addition to properties like title they include info about number of items and current position.

MetadataChannel trackPlaylist trackSearch track
%title%channel titleplaylist titlesearch query string
%album%"Channel""Playlist""Search"
%album_artist%-title of the channel where this playlist comes from-
%tracknumber%index that would have the first item fetched from this track
%totaltracks%number of playlists in the channelnumber of videos in the playlistnumber of search results
%discnumber%index of this portion, like page number for search results on the site
%totaldiscs%total number of portions

Additionally track duration represents number of items in this portion (one second represents single item).

Parsing original title

In context of metadata there is not much you can rely on when getting info from video page. In most cases the only reliable text there is a video title given to it by the person who had uploaded it. And many music videos have title of the form similar to "%artist% - %title%" e.g. "Manowar - Mountains".

The idea behind this way of producing metadata is to split video title to multiple metadata fields. Edit box Metadata Pattern contains the rule used when splitting it.

This rule is a regular expressions with named subexpressions. If subexpression matches to non-empty string, this string is used as metadata field value and subexpression name is used then as metadata field name.

Video title must fully match regular expression. Otherwise no metadata is added.

Metadata overriding

Metadata can be overridden on URL basis. This can be done by extending video URL with pairs field=value where field is metadata field name prepended with fb2k_ prefix (to distinguish metadata fields from regular URL parameters). Like any other URL parameters, these should be separated by ampersand and should use percent-encoding when needed (expected character encoding is UTF-8).

Example:

https://www.youtube.com/watch?v=oozJH6jSr2U&fb2k_artist=Queen&fb2k_title=Bohemian%20Rhapsody

If URL has fb2k_ fields, none of the ways to produce metadata is applied to it.

foobar2000 uses two properties to identify the track: location and subsong index. Two tracks are treated as identical if these properties are equal for them. In context of metadata overriding this brings a question how to make two tracks referencing the same video page but having different overridden metadata to be different from foobar2000 point of view. If they will not be different then metadata update of one of them will automatically trigger update to the same values for the other one.

Solution taken by the component is to embed all given fb2k_ fields into location string. This way tracks with different overridden metadata will be unique for foobar2000 even when they are referencing the same video page.

Properties overriding

Track properties also can be specified when adding video URL. This is done similarly to metadata overriding except that the prefix is fb2kx_. Also unlike fb2k_ fields these ones do not become part of track location string. Component strips them from URL before creating track and stores corresponding properties in the cache (without overwriting existing ones).

Possible values for track properties are the same as in custom metadata fields except that the suffixes are different (for example, to specify view count one should use fb2kx_view_count). One addition here is fb2kx_length property, using which one can specify the track length (in seconds). Example (track length is 5 minutes 39 seconds):

https://www.youtube.com/watch?v=oozJH6jSr2U&fb2kx_lenght=339

Help Metadata