This guide is for use as a reference to creating a template to export the media within Media Companion (MC) to an external file. Commonly referred to as an HTML template, due to its original function, this has been extended to include XML and CSV exports.
Examples of each type of output can be found in the html_templates folder of Media Companion. In most cases, it would be easiest to copy and/or modify an existing template.
A template is simply a text file written in the format of the resultant file, and uses “tags” to indicate that MC should substitute it with the relevant information.
Before exploring the tags specific to media files, we need to set up the document structure. Some tags are mandatory to enable MC to recognise and execute the templates, while others are optional. Document tags differ from the media tags in that each tag requires a matching closing tag.\
At the bare minimum, the template needs to contain:
<title>name_of_template</title>
<<MC HTML Page>>
<</MC HTML Page>>
The <<MC HTML Page>> tag defines the text file as a movie template, and adds it to the Movie toolbar drop-down menu as a template named according to the value of the <title> tag. If either of these tags is missing, the file is considered an ordinary text file, and is ignored.
A <<MC TV HTML Page>> tag identifies the text file as a TV template, and adds it to the TV Show toolbar drop-down menu.
Of course, with only the mandatory tags in place, our export will produce a static and probably blank file! One or more of the optional tags will provide extra information, and a typical HTML template will look something like this:
<title>name_of_template</title>
<<MC HTML Page>>
<<header>>
<meta content="text/html; charset=UTF-8” http-equiv="Content-Type">
<link href="name_of_css_file.css" rel="stylesheet" type="text/css">
<</header>>
<<body>>
<<media_item>>
<</media_item>>
<</body>>
<<footer>><</footer>>
<</MC HTML Page>>
<<css>>
<filename>name_of_css_file*.css</filename>
@charset "utf-8";\
<</css>>
Typically, XML and CSV templates will only require the <<media_item>> tag (and the best advice is to start from the examples), so we will look at the above example.
Each tag indicates a block typical of HTML documents.
The <<header>> block represents the HTML header and will insert the <html><head></head> HTML tags where appropriate. It also processes any media tags in this block just once, and usually the only value that is useful here it the total number of media items present - any other information is derived from the first media item.
The <<body>> block represents the HTML body and will insert the <body></body> HTML tags where appropriate. Any HTML is output just once, however, the <<body>> block also supports legacy templates as described below.
The <<media_item>> block, as the name suggests, represents each media item in the list. This block is repeated for every media item in the list, and inserts the relevant information for each tag contained within. If the <<media_item>> block is absent, the <<body>> block performs the same function, mainly to support legacy templates.
The <<footer>> block is allowed, but is currently unused.
The <<css>> block creates a separate CSS file that is referenced from the HTML header, designated by the <filename> tag. Obviously, it is imperative that the filenames match!
*************************************** GENERAL TAGS *************************************** <<filename>> Default output filename. E.g. usage: <<filename>>CopyMoviesInFolders.cmd<</filename>> <<textencoding>> Change the text encoding. Default is UTF8. Only ASCII alternative supported. E.g. usage: <<textencoding>>ASCII<</textencoding>> *************************************** MOVIE TAGS *************************************** <<media_item[:limit]>> <<smallimage>> <<createimage[:sizelimit][:nopath]>> <<moviecount>> <<htmlcreatedate>> Date and time of exported file <<counter>> <<imdb_id>> <<imdb_num>> Same as imdb_id, but without the "tt" prefix <<imdb_url>> <<title[:none|append|article]>> <<movieyear>> <<movietitleandyear>> <<rating>> <<votes>> <<userrating>> <<runtime>> <<outline>> <<fullpathandfilename>> <<fullplot>> <<director>> <<stars>> <<actors[:name][:role][:thumb][:limit]>> <<writer>> <<moviegenre>> <<releasedate>> <<movieset>> <<moviesetid>> <<release_date>> Movie set release date. <<file_size>> Size of specific video file. May cause issue if DVD/BluRay folder structure. <<folder_size>> Size of the containing movie folder <<folder>> Movie folder inc drive and path. - See CopyMoviesInFolders.txt for example usage <<folder_no_drive>> Movie folder ex drive, including path - See CopyMoviesInFolders.txt for example usage <<filename[:root][:path][:file][:ext]>> <<format[:container][:source][:resolution]>> <<nfo:[nfo parameter][:char_limit]>> <<nfo:createdate[:dateformat][:separator]>> Special Parameters: [sizelimit] - Integer. Defines the height of the movie poster. Maintains aspect ratio. A zero(0) will keep the images original size. [nfo parameter] - Any tag specified in the movie NFO file. File parameters accessed by cascading tags e.g. <<nfo:file:video:container>> [char_limit] - Integer. Limit the number of characters displayed, followed by a pseudo-ellipses. Available for all NFO parameters except file parameters. From Nfo: EG. <<nfo:file:video:width>> <<nfo: file video width height aspect codec duration container audio language channels bitrate codec subtitles language filesize title originaltitle sorttitle year set setid createdate premiered rating userrating votes top250 outline plot tagline country runtime mpaa genre credits director studio trailer playcount id stars source ratings imdb rating votes tmdb rating votes metacritic rating votes tomatometerallcritics rating votes tomatometerallaudience rating votes >> *************************************** TV TAGS *************************************** <<media_item>> <<season[:missing|all]>> <<episode[:missing|all]>> Special Parameters: [:missing|all] - If no extra instruction, will only output media present in MC. 'Missing' will only output missing media (must have scraped missing episodes). 'All' will output both present media and missing (if scraped) media. SHOW TAGS <<createimage[:sizelimit][:imagetype]>> <<show_title>> <<show_year>> <<show_titleandyear>> <<show_imdbid>> <<show_imdburl>> <<show_tvdbid>> <<show_tvdburl>> <<show_genre>> <<show_episodeactorsource>> <<show_language>> <<show_locked>> <<show_rating>> <<show_sortorder>> <<show_status>> <<show_count>> <<show_counter>> <<show_seasons[:text]>> <<class:[row|classname]>> <<show_nfo:[nfo parameter][:char_limit]>> Special Parameters: [sizelimit] - Integer. Defines the height of a poster, or the width of a banner. Maintains aspect ratio. A zero(0) will retain the image's original size. [imagetype] - Can be either 'poster' or 'banner'. The aspect ratio is checked, and the default image is substituted if needed. If not included, defaults to 'poster'. [text] - Intelligently adds the word 'Season' or 'Seasons' if number is one(1) or other. [classname] - Adds text in the form of " class=[classname]" for CSS. If 'row' is specified, adds text in the form of " class=show_row_[odd|even}". [nfo parameter] - Any tag specified in the TV show NFO file. (<url> not required for <episodeguide> tag.) [char_limit] - Integer. Limit the number of characters displayed, followed by a pseudo-ellipses. Available for all NFO parameters except <episodeguide>. <<show_nfo:ratings:[source]:[value_type]>> Special Parameters [source] - tvdb, imdb, themoviedb, tomatometerallcritics, tomatometerallaudience [value_type] - rating, votes SEASON TAGS <<createimage:[sizelimit]:[imagetype]>> <<show_counter>> <<seas_number[:text|pad]>> <<seas_episodes[:text|pad]>> <<seas_episodesof[:text]>> <<class:[row|missing|missingepisode|classname]>> Special Parameters: [sizelimit] - Integer. Defines the height of a poster, or the width of a banner. Maintains aspect ratio. A zero(0) will retain the image's original size. [imagetype] - Can be either 'poster' or 'banner'. The aspect ratio is checked, and the default image is substituted if needed. If not included, defaults to 'poster'. [text] - Adds the word 'Season' or 'Episode', and the plural if number is not one(1). [pad] - Pads a single digit number with a leading zero(0). [classname] - If 'row' is specified, adds text in the form of " class=show_row_[odd|even]". If class name contains 'missing', returns " class=[classname]" if the season does not exist, and have scraped missing episodes. The parameter 'missingepisode' is a special case where if there are any missing episodes in that season, " class=missingseason" is returned. (Must have a 'missingseason' CSS class for this to have any affect.) Adds text in the form of " class=[classname]" for CSS. EPISODE TAGS <<show_counter>> <<ep_title>> <<ep_season:[pad]>> <<ep_number:[pad]>> <<ep_rating>> <<ep_playcount>> <<ep_imdbid>> <<ep_imdburl>> <<ep_tvdbid>> <<ep_tvdburl>> <<class:[row|missing|classname]>> <<ep_nfo:[nfo parameter][:char_limit]>> Special Parameters: [pad] - Pads a single digit number with a leading zero(0). [classname] - If 'row' is specified, adds text in the form of " class=show_row_[odd|even]". If class name contains 'missing', returns " class=[classname]" if the season does not exist, and have scraped missing episodes. Adds text in the form of " class=[classname]" for CSS. [nfo parameter] - Any tag specified in the TV show NFO file. File parameters accessed by cascading tags e.g. <<ep_nfo:file:video:container>>. [char_limit] - Integer. Limit the number of characters displayed, followed by a pseudo-ellipses. Available for all NFO parameters except file parameters. <<ep_nfo:ratings:[source]:[value_type]>> Special Parameters [source] - tvdb, imdb, themoviedb, tomatometerallcritics, tomatometerallaudience [value_type] - rating, votes NOTE: any NFO parameter that is a list will be ignored at this stage. May be included in future versions.
Wiki: Home
Wiki: MovToolBar
Wiki: MovToolbar
Wiki: TVToolBar