TG Templates Support Documentation

From WikiDLXTV
Jump to: navigation, search

THE ACTUAL DOCUMENTATION IS HERE: DOCUMENTATION

THE LIST BELOW IS OBSOLETE!!!!

List of supported tokens (v1.1.5)

NOTE: The original templates credits and ideas belong to TviXiE (www.tvixie.com) and some of the tokens are compatible with the TviXiE templates.


Token Name Meaning Example
 %PATH% Template folder without trailing backslash C:\ThumbGen\Templates\MyTemplate
 %BACKGROUND% Path to the backdrop selected in ThumbGen {image selected as backdrop}
 %FANART1% Path to the Fanart 1 selected in ThumbGen {image selected as fanart1}
 %FANART2% Path to the Fanart 2 selected in ThumbGen {image selected as fanart2}
 %FANART3% Path to the Fanart 3 selected in ThumbGen {image selected as fanart3}
 %TITLEPATH% Current movie folder path without trailing backslash C:\Movies\Cars
 %MOVIEFILENAME% Current movie filename Spread.2009.mkv (for c:\movies\spread\spread.2009.mkv)
 %MOVIEFILENAMEWITHOUTEXT% Current movie filename without extension Spread.2009 (for c:\Movies\Spread\Spread.2009.mkv)
 %MOVIEFOLDER% Current movie folder name Spread (for c:\Movies\Spread\Spread.2009.mkv)
 %MOVIEPARENTFOLDER% Current movie parent folder name Movies (for c:\Movies\Spread\Spread.2009.mkv)
 %COVER% Path to the Cover selected in ThumbGen {image selected as cover}
 %TITLE% Movie Title Inglorious Basterds
 %ORIGINALTITLE% Original movie title Inglourious Basterds
 %PLOT% Synopsis Some description of the movie.
 %TAGLINE% The Tagline Some tagline
 %COMMENTS% Free "joker" field for the user own data Some free test the user can place on the sheet
 %YEAR% Year 2009
 %RUNTIME% Duration of the movies (minutes) 135
 %ACTORS% List of actors John Wayne, Bridget Fonda *
 %GENRES% List of genres Comedy, Drama *
 %DIRECTORS% List of directors Quentin Tarantino *
 %CERTIFICATION% Movie certification PG-13
 %RELEASEDATE% Release date 12.03.2010 (formatted using collector's format)
 %MPAA% MPAA Rating from IMDb Rated R for strong sexual content, nudity and language
 %IMDBID% IMDb Id of the movie tt1186370
 %CERTIFICATIONTEXT% Movie certification PG-13
 %COUNTRIES% List of countries Germany, USA *
 %STUDIOS% List of studios Warner Bros., Pixar *
 %ALLSUBTITLES% List of distinct embedded/external subtitles (English names) English, Spanish,German *
 %ALLSUBTITLESTEXT% List of distinct embedded/external subtitles (native names) English, Espanol,Deutsch *
 %SUBTITLES% List of embedded subtitles (English names) English, French *
 %SUBTITLES1% … %SUBTITLES5% Individual embedded subtitles (English names) English
 %SUBTITLESTEXT% List of embedded subtitles (Native names) English, Francais, Deutsch *
 %EXTERNALSUBTITLESTEXT% List of embedded subtitles (Native names) English, Francais, Deutsch *
 %EXTERNALSUBTITLES% List of external subtitles (English names) English, French *
 %EXTERNALSUBTITLES1% … %EXTERNALSUBTITLES5% Individual external subtitles (English names) English
 %RATING% The rating of the movie (x of 10) 6.8/10
 %RATINGPERCENT% The rating as percent 68
 %RATINGSTARS% The rating stars (star image loaded from /Template/Settings/Rating/@Filename {the stars rating image}
 %SEASON% The autodetected season number for the current movie 4
 %EPISODE% The autodetected episode (or CD) number for the current movie 2
 %EPISODETITLE% The current episode name Fire + Water
 %EPISODEPLOT% Synopsis of the current episode Some description of the episode.
 %EPISODERELEASEDATE% Release date of the current episode 12.03.2010 (formatted using collector's format)
 %EPISODELIST% List of episodes for the current season 1, 2, 3 *
 %EPISODENAMESLIST% List of episodes titles for the current season Title One, Title Two *
 %EPISODEGUESTSTARS% List of guest stars for the current episode John B, John C *
 %EPISODEWRITERS% List of writers for the current episode John B, John C *
 %MEDIAFORMATTEXT% See below list of media values supported. Loaded from /Template/MediaFormats/MediaFormat/@Name Returns value from @Text attribute MKV
 %SOUNDFORMATTEXT% See below list of sound values supported. /Template/SoundFormats/SoundFormat/@Name Returns value from @Text attribute MP3
 %RESOLUTIONTEXT% See below list of resolution values supported. /Template/Resolutions/Resolution/@Name Returns value from @Text attribute 1080P
 %VIDEOFORMATTEXT% See below list of video values supported. /Template/VideoFormats/VideoFormat/@Name Returns value from @Text attribute AVC
 %FRAMERATETEXT% Frame rate of the movie (original value) 23.976
 %FRAMERATE% Formatted frame rate of the movie (to allow mapping to filenames). The ‘.’ character is replaced by the ‘_’ character. 23_976
 %ASPECTRATIOTEXT% Aspect ratio of the movie (original value) 16:9 or 2.35:1 or 4:3
 %ASPECTRATIO% Formatted aspect ration (to allow mapping to filenames). The ‘.’ character is replaced by the ‘_’ character and the ‘:’ character is replaced by ‘-’. 16-9 or 2_35-1 or 4-3
 %VIDEORESOLUTION% The movie resolution 1920x1080
 %VIDEORESOLUTIONTEXT% The movie resolution 1920x1080
 %VIDEOCODECTEXT% The CodecID value for the video codec AVC
 %VIDEOBITRATETEXT% The video bitrate 977 Kbps
 %AUDIOCODECTEXT% The CodecID value for the audio codec AC-3
 %AUDIOCHANNELSTEXT% The number of audio channels 2
 %AUDIOBITRATETEXT% The audio bitrate 128 Kbps
 %DURATIONTEXT% The detected (mediainfo) duration of the movie (formatted in hours and minutes) 1h 36m
 %DURATION% The detected (mediainfo) duration of the movie (minutes) 98
 %DURATIONSEC% The detected (mediainfo) duration of the movie (seconds) 5880
 %FILESIZETEXT% The detected (mediainfo) filesize of the movie (formatted using KB, MB and GB) 781.95 MB
 %CONTAINERTEXT% The detected (mediainfo) container format (as it comes from MediaInfo) Matroska
 %LANGUAGECODE% The two letter ISO code of the language of the first audio stream en
 %LANGUAGE% The language of the first audio stream (always the English name) Spanish
 %LANGUAGES% The languages of all audio streams (always the English names) Spanish/English/Italian *
 %LANGUAGECODES% The two letter ISO code of the languages of all audio streams es/en/it *
 %CERTIFICATIONCOUNTRYCODE% The two letter code of the country selected in Options/IMDB as Certification Country (default value: us) es

(*) You can control how many items and what the separator between each item will be by opening the template.xml file in a text editor (Notepad) and locate the following rows: <Actors Separator=", " MaximumValues="5" /> <Genres Separator=", " MaximumValues="5" /> <Directors Separator=", " MaximumValues="5" /> <Countries Separator=", " MaximumValues="5" /> <Studios Separator=", " MaximumValues="5" /> <Subtitles Separator=”,” MaximumValues=”5”/> <Episodes Separator=”,” MaximumValues=”5”/> <EpisodesNames Separator=”,” MaximumValues=”5”/> <Languages Separator=”,” MaximumValues=”5”/> <LanguageCodes Separator=”,” MaximumValues=”5”/>

Separator specifies which separator you want to use and MaximumValues specifies the maximum number of items you want to show.

To every text variable you can append different casing conversions:

{UPPER} - Makes the whole text in upper case (eg. %TITLE%{UPPER} will make the whole title uppercase)

{LOWER} - Makes the whole text in lower case (eg. %TITLE%{LOWER} will make the whole title lowercase)

{TITLECASE} - Makes the whole text in title casing format (eg. %TITLE%{TITLECASE} a title of "The whole nine yards" becomes "The Whole Nine Yards")

Possible values for 'TextAlignment:' are: BottomCenter, BottomLeft, BottomRight, MiddleCenter, MiddleLeft, MiddleRight, TopCenter, TopLeft, TopRight

List of media info values supported (v1.1.2)

Resolutions:

720P, 1080P, 288P, 480P, 576P

Formats:

BLURAY, DVD, MKV, mpeg4, Mov, rmvb

Video:

Divx, xvid, wmv, avc, mpeg

Audio:

AAC51, AAC, AAC20, DD51, DD20, DTS51, MP3, FLAC, WMA, VORBIS, DTSHD, DTRUEHD


XSL support for templates (v0.12.22)

Starting with v0.12.12 (beta) there is a basic support for XSL 1.0 (XSL 2.0 is (and will) NOT be supported) implemented. Here's how it works:

Currently we have a template.xml that is loaded by TG then filled with infos and then rendered using the rendering engine.

Optionally it is possible now to place a template.xslt file near the template.xml. This will change the processing flow as following:

Template.xml (with tokens)-> TG fills the tokens -> if template.xslt exists -> TG applies the XSL to the filled-up xml -> render the result

Author of the template/XSL must be very careful with the result of his transformation as that one is sent to the rendering engine. I recommend doing an identity copy and then processing individual cases. I also recommend checking log.txt when something goes wrong as most of the errors are logged there.

The XSL transformation is optional and may help defining conditions and other tasks right before rendering.

Here is a sample of an XSL file (it is complete, you can use it as start point):

<Cutbelow>

  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
  <xsl:template match="@*|node()">
     <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
     </xsl:copy>
  </xsl:template>
  <xsl:template match="//Elements">
     <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
     </xsl:copy>
  </xsl:template>
  <xsl:template match="TextElement[@Name='OriginalTitle']">
     <xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'"/>
     <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
     <xsl:variable name="originalTitleFinal" select="//tokens/token[@name='%ORIGINALTITLE%']"/>
     <xsl:variable name="originalTitle" select="translate(//tokens/token[@name='%ORIGINALTITLE%'], $smallcase, $uppercase)"/>
     <xsl:variable name="title" select="translate(//tokens/token[@name='%TITLE%'], $smallcase, $uppercase)"/>
     <xsl:choose>
        <xsl:when test="$originalTitle != $title ">
           <xsl:copy>
              <xsl:apply-templates select="@*|node()"/>
           </xsl:copy>
        </xsl:when>
     </xsl:choose>
  </xsl:template>
  </xsl:stylesheet>

</CutBelow>

There is also the following information available during transformation: list of available tokens and full mediainfo details

<Cutbelow>

 <ImageDrawTemplate SDKVersion="2.0">
  <OutputImageSettings ColorDepth="Format32bppAlpha" ImageFormat="Png" JpegCompressionLevel="0" Dpi="96" />
  <Canvas AutoSize="False" CenterElements="False" Height="720" Width="1280" Fill="Solid,-16777216,-16777216,BackwardDiagonal,-1,-16777216,0,,Tile,None,50,100,,,,0,0,0,0,Line,True" />
  <Elements>
  </Elements>
  <tokens>
     <token name="%STUDIOS%">Barbarian Films</token>
     <token name="%EXTERNALSUBTITLESTEXT%">Espa&#241;ol/Rom&#226;na</token>
     <token name="%SUBTITLESTEXT%">Rom&#226;na</token>
     <token name="%VIDEOFORMATTEXT%" />
     <token name="%AUDIOCHANNELSTEXT%">2</token>
     <token name="%EPISODE%" />
     <token name="%FRAMERATETEXT%">23.976</token>
     <token name="%CONTAINERTEXT%">Matroska</token>
     <token name="%AUDIOCODECTEXT%">MP3</token>
     <token name="%FANART1%">c:\temp\af51b55a-71d7-4df3-aa6b-2ae416d3f67f.jpg</token>
     <token name="%PATH%">c:\Program Files\Babel\BabelOut\Templates\WindeTiny</token>
     <token name="%RUNTIME%">97</token>
     <token name="%COVER%">c:\temp\b24bf8d4-7579-445f-b1c3-b1978d20630a.jpg</token>
     <token name="%YEAR%">2009</token>
     <token name="%MEDIAFORMATTEXT%" />
     <token name="%TITLE%">Spread</token>
     <token name="%RATING%">6.1/10</token>
     <token name="%SUBTITLES2%" />
     <token name="%EXTERNALSUBTITLES4%" />
     <token name="%EXTERNALSUBTITLES3%" />
     <token name="%DURATIONTEXT%">1h 36m</token>
     <token name="%VIDEORESOLUTIONTEXT%">768x576</token>
     <token name="%AUDIOBITRATETEXT%">128 Kbps</token>
     <token name="%TITLEPATH%">D:\Test\Spread</token>
     <token name="%DIRECTORS%">David Mackenzie</token>
     <token name="%SUBTITLES3%" />
     <token name="%SUBTITLES4%" />
     <token name="%EXTERNALSUBTITLES2%">Romanian</token>
     <token name="%ORIGINALTITLE%">Spread</token>
     <token name="%FANART2%">c:\temp\33bd378a-3505-4d55-a722-7473b5ecd206.jpg</token>
     <token name="%SUBTITLES5%" />
     <token name="%SOUNDFORMATTEXT%" />
     <token name="%PLOT%">A sex comedy centered on a serial womanizer and his jilted lover.</token>
     <token name="%COUNTRIES%">USA</token>
     <token name="%GENRES%">Comedy, Drama, Romance</token>
     <token name="%CERTIFICATION%">R</token>
     <token name="%SUBTITLES%">Romanian</token>
     <token name="%FILESIZETEXT%">781.95 MB</token>
     <token name="%BACKGROUND%">c:\temp\e6e966f4-cdf1-4ebd-8a4a-b42b2bd91c30.jpg</token>
     <token name="%MPAA%">Rated R for strong sexual content, nudity and language</token>
     <token name="%SUBTITLES1%">Romanian</token>
     <token name="%FRAMERATE%">23_976</token>
     <token name="%EXTERNALSUBTITLES1%">Spanish</token>
     <token name="%VIDEOCODECTEXT%">AVC</token>
     <token name="%CERTIFICATIONTEXT%">R</token>
     <token name="%ASPECTRATIO%">16-9</token>
     <token name="%ACTORS%">Ashton Kutcher, Anne Heche, Margarita Levieva</token>
     <token name="%RELEASEDATE%">17.01.2009</token>
     <token name="%ASPECTRATIOTEXT%">16:9</token>
     <token name="%VIDEORESOLUTION%">768x576</token>
     <token name="%VIDEOBITRATETEXT%">977 Kbps</token>
     <token name="%RESOLUTIONTEXT%" />
     <token name="%EXTERNALSUBTITLES5%" />
     <token name="%SEASON%" />
     <token name="%FANART3%">c:\temp\d89114df-bfe3-48ff-a1be-01aa9affc085.jpg</token>
     <token name="%EXTERNALSUBTITLES%">Spanish/Romanian</token>
  </tokens>
  <File>
     <track type="General">
        <Complete_name>D:\Test\Spread\Spread.mkv</Complete_name>
        <Format>Matroska</Format>
        <File_size>782 MiB</File_size>
        <Duration>1h 36mn</Duration>
        <Overall_bit_rate>1 128 Kbps</Overall_bit_rate>
        <Encoded_date>UTC 2009-11-26 05:33:59</Encoded_date>
        <Writing_application>mkvmerge v2.9.8 ('C'est le bon') built on Aug 13 2009 12:49:06</Writing_application>
        <Writing_library>libebml v0.7.7 + libmatroska v0.8.1</Writing_library>
     </track>
     <track type="Video">
        <ID>1</ID>
        <Format>AVC</Format>
        <Format_Info>Advanced Video Codec</Format_Info>
        <Format_profile>High@L3.1</Format_profile>
        <Format_settings__CABAC>Yes</Format_settings__CABAC>
        <Format_settings__ReFrames>2 frames</Format_settings__ReFrames>
        <Muxing_mode>Container profile=Unknown@3.1</Muxing_mode>
        <Codec_ID>V_MPEG4/ISO/AVC</Codec_ID>
        <Duration>1h 36mn</Duration>
        <Bit_rate>977 Kbps</Bit_rate>
        <Nominal_bit_rate>1 000 Kbps</Nominal_bit_rate>
        <Width>768 pixels</Width>
        <Height>576 pixels</Height>
        <Display_aspect_ratio>16:9</Display_aspect_ratio>
        <Frame_rate_mode>Variable</Frame_rate_mode>
        <Frame_rate>23.976 fps</Frame_rate>
        <Resolution>8 bits</Resolution>
        <Colorimetry>4:2:0</Colorimetry>
        <Scan_type>Progressive</Scan_type>
        <Bits__Pixel_Frame_>0.092</Bits__Pixel_Frame_>
        <Stream_size>678 MiB (87%)</Stream_size>
        <Writing_library>x264 core 78 r1309 4d77de8</Writing_library>
        <Encoding_settings>cabac=1 / ref=1 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=6 / psy=1 / psy_rd=1.0:0.0 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / chroma_qp_offset=-2 / threads=5 / nr=0 / decimate=1 / mbaff=0 / constrained_intra=0 / bframes=3 / b_pyramid=0 / b_adapt=1 / b_bias=0 / direct=3 / wpredb=1 / keyint=250 / keyint_min=25 / scenecut=40 / rc_lookahead=40 / rc=abr / mbtree=1 / bitrate=1000 / ratetol=1.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00</Encoding_settings>
     </track>
     <track type="Audio">
        <ID>2</ID>
        <Format>MPEG Audio</Format>
        <Format_version>Version 1</Format_version>
        <Format_profile>Layer 3</Format_profile>
        <Format_Settings_Mode>Joint stereo</Format_Settings_Mode>
        <Format_Settings_ModeExtension>MS Stereo</Format_Settings_ModeExtension>
        <Codec_ID>A_MPEG/L3</Codec_ID>
        <Codec_ID_Hint>MP3</Codec_ID_Hint>
        <Duration>1h 36mn</Duration>
        <Bit_rate_mode>Constant</Bit_rate_mode>
        <Bit_rate>128 Kbps</Bit_rate>
        <Channel_s_>2 channels</Channel_s_>
        <Sampling_rate>48.0 KHz</Sampling_rate>
        <Stream_size>88.8 MiB (11%)</Stream_size>
        <Writing_library>LAME3.98 </Writing_library>
        <Encoding_settings>-m j -V 4 -q 2 -lowpass 17 -b 128</Encoding_settings>
     </track>
     <track type="Text">
        <ID>3</ID>
        <Format>UTF-8</Format>
        <Codec_ID>S_TEXT/UTF8</Codec_ID>
        <Codec_ID_Info>UTF-8 Plain Text</Codec_ID_Info>
        <Language>Romanian</Language>
     </track>
  </File>
 </ImageDrawTemplate>

</Cutbelow>

RECOMMENDED: Download a sample template and adapt it to your needs.

For example: http://www.mediafire.com/?jdxwzym52b1

For more templates visit: http://www.wdtvforum.com