mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-23 08:18:52 -05:00
460 lines
21 KiB
HTML
460 lines
21 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml" itemscope itemtype="http://schema.org/Product">
|
||
<head>
|
||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||
<meta name="keywords" content="rename tv shows, rename movies, download subtitles, check sfv files" />
|
||
|
||
<title>Format Expressions</title>
|
||
<meta name="description" content="Define your own naming scheme and customize it to your liking. FileBot format expressions give you ultimate control over how FileBot will rename and move your media files. Anything is possible." />
|
||
|
||
<meta itemprop="name" content="FileBot Format Expressions" />
|
||
<meta itemprop="description" content="Define your own naming scheme and customize it to your liking. FileBot format expressions give you ultimate control over how FileBot will rename and move your media files. Anything is possible." />
|
||
<meta itemprop="image" content="http://www.filebot.net/icon.png" />
|
||
|
||
<link rel="stylesheet" href="base.css" type="text/css" />
|
||
<link rel="stylesheet" href="code.css" type="text/css" />
|
||
<link rel="icon" href="favicon.png" />
|
||
|
||
<!-- google +1 -->
|
||
<script type="text/javascript">
|
||
window.___gcfg = {lang: 'en-GB'};
|
||
|
||
(function() {
|
||
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
|
||
po.src = 'https://apis.google.com/js/plusone.js';
|
||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
|
||
})();
|
||
</script>
|
||
|
||
<!-- twitter -->
|
||
<script type="text/javascript">
|
||
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
|
||
</script>
|
||
</head>
|
||
<body>
|
||
<!-- Facebook Like Button-->
|
||
<div id="fb-root"></div>
|
||
<script>(function(d, s, id) {
|
||
var js, fjs = d.getElementsByTagName(s)[0];
|
||
if (d.getElementById(id)) return;
|
||
js = d.createElement(s); js.id = id;
|
||
js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1";
|
||
fjs.parentNode.insertBefore(js, fjs);
|
||
}(document, 'script', 'facebook-jssdk'));</script>
|
||
|
||
<div class="page">
|
||
<div class="navigation">
|
||
<div>
|
||
<ul>
|
||
<li><a href="http://www.filebot.net/forums/">Forums</a></li>
|
||
<li><a href="http://www.filebot.net/forums/viewtopic.php?f=3&t=7">FAQ</a></li>
|
||
<li><a href="http://www.filebot.net/#download">Download</a></li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="social">
|
||
<div class="twitter">
|
||
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.filebot.net/" data-text="FileBot - The ultimate tv renamer and subtitle downloader" data-via="filebot_renamer" data-lang="en"></a>
|
||
</div>
|
||
|
||
<div class="facebook">
|
||
<div class="fb-like" data-href="https://www.facebook.com/filebot" data-send="false" data-layout="button_count" data-width="80" data-show-faces="false"></div>
|
||
</div>
|
||
|
||
<div class="plusone">
|
||
<g:plusone href="http://www.filebot.net/"></g:plusone>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="header">
|
||
<a href="http://www.filebot.net"><img class="logo" alt="logo" src="images/filebot.logo.svg" width="64" height="64" /></a>
|
||
<h1>
|
||
Format Expressions
|
||
<span class="description">User defined episode / movie naming scheme</span>
|
||
</h1>
|
||
</div>
|
||
|
||
<div class="content">
|
||
<div class="screenshot">
|
||
<a href="screenshots/format.png" title="Format Dialog" target="_blank">
|
||
<img alt="Edit Format Dialog" width="230" height="157" src="screenshots/format.png" />
|
||
</a>
|
||
</div>
|
||
<div class="section about">
|
||
<h2>About</h2>
|
||
<p>
|
||
You can easily define your own episode and movie naming schemes. It uses <a href="http://groovy-lang.org/">Groovy</a> expressions,
|
||
which means that you can do pretty much anything, especially if you know a little bit about programming.
|
||
You even get media info bindings. You can find <a href="http://www.filebot.net/forums/viewtopic.php?f=5&t=2#p51">predefined format expressions</a> for all kinds of scenarios in the forums. Ready for you to just copy & paste.
|
||
</p>
|
||
<h2 id="examples">Examples</h2>
|
||
<p>
|
||
<code><span class="block start">{</span><span class="variable">n</span><span class="block end">}</span> - <span class="block start">{</span><span class="variable">s00e00</span><span class="block end">}</span> - <span class="block start">{</span><span class="variable">t</span><span class="block end">}</span></code>Dark Angel - S03E01 - Labyrinth
|
||
</p>
|
||
<p>
|
||
<code>V:/TV Shows/<span class="block start">{</span><span class="variable">n</span><span class="block end">}</span>/Season <span class="block start">{</span><span class="variable">s</span><span class="block end">}</span>/<span class="block start">{</span><span class="variable">sxe</span><span class="block end">}</span> - <span class="block start">{</span><span class="variable">t</span><span class="block end">}</span></code>V:\TV Shows\Dark Angel\Season 3\3x01 - Labyrinth
|
||
</p>
|
||
<p>
|
||
<code><span class="block start">{</span><span class="variable">n</span>.<span class="method">space</span>(<span class="string">'.'</span>).<span class="method">lower</span>()<span class="block end">}</span>.<span class="block start">{</span><span class="variable">s</span><span class="block end">}</span><span class="block start">{</span><span class="variable">e</span>.<span class="method">pad</span>(<span class="numeral">2</span>)<span class="block end">}</span></code>dark.angel.301
|
||
</p>
|
||
<p>
|
||
<code><span class="block start">{</span><span class="variable">n</span><span class="block end">}</span> (<span class="block start">{</span><span class="variable">y</span><span class="block end">}</span>)<span class="block start">{</span><span class="string">" CD<span class="variable">$pi</span>"</span><span class="block end">}</span></code>The Man from Earth (2007) CD1
|
||
</p>
|
||
<p>
|
||
<code><span class="block start">{</span><span class="variable">n</span><span class="block end">}</span> [<span class="block start">{</span><span class="variable">y</span><span class="block end">}</span>] <span class="block start">{</span><span class="variable">vf</span><span class="block end">}</span> <span class="block start">{</span><span class="variable">af</span><span class="block end">}</span></code>The Man from Earth [2007] 720p 6ch
|
||
</p>
|
||
<h2>Advanced Examples</h2>
|
||
<p>
|
||
<code><span class="block start">{</span><span class="variable">n</span>.<span class="method">upperInitial</span>().<span class="method">space</span>(<span class="string">'.'</span>)<span class="block end">}</span>.<span class="block start">{</span><span class="variable">y</span><span class="block end">}</span>.<span class="block start">{</span><span class="variable">source</span><span class="block end">}</span>.<span class="block start">{</span><span class="variable">vc</span><span class="block end">}</span><span class="block start">{</span><span class="string">'-'</span>+<span class="variable">group</span><span class="block end">}</span></code>The.Man.From.Earth.2007.DVDRip.XviD-ALLiANCE
|
||
</p>
|
||
<p>
|
||
<code><span class="block start">{</span><span class="variable">n</span><span class="block end">}</span> (<span class="block start">{</span><span class="variable">y</span><span class="block end">}</span>) by <span class="block start">{</span><span class="variable">director</span><span class="block end">}</span> [<span class="block start">{</span><span class="variable">genres</span>[<span class="numeral">0</span>]<span class="block end">}</span>, <span class="block start">{</span><span class="variable">certification</span><span class="block end">}</span>, <span class="block start">{</span><span class="variable">rating</span><span class="block end">}</span>]</code>The Terminator (1984) by James Cameron [Action, PG-13, 8.5]
|
||
</p>
|
||
<p>
|
||
<code><span class="block start">{</span><span class="variable">n</span>.<span class="method">space</span>(<span class="string">'_'</span>)<span class="block end">}</span>_-_<span class="block start">{</span><span class="variable">e</span>.<span class="method">pad</span>(<span class="numeral">2</span>)<span class="block end">}</span>_[<span class="block start">{</span><span class="variable">resolution</span><span class="block end">}</span>_<span class="block start">{</span><span class="variable">vc</span><span class="block end">}</span>_<span class="block start">{</span><span class="variable">ac</span><span class="block end">}</span>][<span class="block start">{</span><span class="variable">crc32</span><span class="block end">}</span>]</code>Juuni_Kokuki_-_01_[1280x720_XviD_MP3][3E16AF40]
|
||
</p>
|
||
<p>
|
||
<code><span class="block start">{</span><span class="variable">n</span>.<span class="method">space</span>(<span class="string">'.'</span>)<span class="block end">}</span>.<span class="block start">{</span><span class="string">'s'</span>+<span class="variable">s</span>.<span class="method">pad</span>(<span class="numeral">2</span>)<span class="block end">}</span>e<span class="block start">{</span><span class="variable">e</span>.<span class="method">pad</span>(<span class="numeral">2</span>)<span class="block end">}</span>.<span class="block start">{</span><span class="variable">t</span>.<span class="method">space</span>(<span class="string">'.'</span>)<span class="block end">}</span>.<span class="block start">{</span><span class="variable">vf</span><span class="block end">}</span>.<span class="block start">{</span><span class="variable">vc</span><span class="block end">}</span>.<span class="block start">{</span><span class="variable">ac</span><span class="block end">}</span></code>Firefly.s01e01.Serenity.720p.x264.ac3
|
||
</p>
|
||
<p>
|
||
<code><span class="block start">{</span><span class="variable">n</span><span class="block end">}</span> [<span class="block start">{</span><span class="variable">airdate</span>.<span class="method">format</span>(<span class="string">'<a style="color:inherit" href="http://download.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html" target="_blank">yyyy.MM.dd</a>'</span>)<span class="block end">}</span>] <span class="block start">{</span><span class="variable">t</span><span class="block end">}</span></code>The Daily Show [2010.01.05] George Lucas
|
||
</p>
|
||
<p>
|
||
<code>E:/Complete/<span class="block start">{</span><span class="variable">n</span><span class="block end">}</span> (<span class="block start">{</span><span class="variable">y</span><span class="block end">}</span>)<span class="block start">{</span><span class="string">'/Season '</span>+<span class="variable">s</span><span class="block end">}</span>/<span class="block start">{</span><span class="variable">s</span>+<span class="string">'x'</span><span class="block end">}</span><span class="block start">{</span><span class="variable">e</span>.<span class="method">pad</span>(<span class="numeral">2</span>)<span class="block end">}</span> - <span class="block start">{</span><span class="variable">t</span><span class="block end">}</span></code>Rename and <strong>move</strong> files. The directory structure is completely up to you.
|
||
</p>
|
||
<p>
|
||
<code><span class="block start">{</span><span class="variable">n</span>.<span class="method">replaceTrailingBrackets</span>()<span class="block end">}</span> - <span class="block start">{</span><span class="variable">s</span>+<span class="string">'x'</span><span class="block end">}</span><span class="block start">{</span><span class="variable">e</span>.<span class="method">pad</span>(<span class="numeral">2</span>)<span class="block end">}</span> - <span class="block start">{</span><span class="variable">t</span>.<span class="method">replaceAll</span>(<span class="regex">/[!?.]+$/</span>).<span class="method">replaceAll</span>(<span class="regex">/[`´‘’ʻ]/</span>, <span class="string">"'"</span>)<br/>.<span class="method">lowerTrail</span>().<span class="method">replacePart</span>(<span class="string">', Part $1'</span>)<span class="block end">}</span></code>My personal favorite. Pretty much 1x01, normalizing accents, and lots of other cleanup operations.
|
||
</p>
|
||
|
||
<h2 class="reference" id="bindings">
|
||
Binding Reference
|
||
<a href="https://github.com/filebot/filebot/tree/master/source/net/filebot/format/MediaBindingBean.java" class="source" target="_blank">source</a>
|
||
</h2>
|
||
<table class="reference binding">
|
||
<tr>
|
||
<th>Name</th>
|
||
<th>Description</th>
|
||
<th>Example</th>
|
||
</tr>
|
||
<tr>
|
||
<td>n</td>
|
||
<td>series/movie name</td>
|
||
<td>Dark Angel</td>
|
||
</tr>
|
||
<tr>
|
||
<td>y</td>
|
||
<td>series/movie year</td>
|
||
<td>2009</td>
|
||
</tr>
|
||
<tr>
|
||
<td>s</td>
|
||
<td>season number</td>
|
||
<td>3</td>
|
||
</tr>
|
||
<tr>
|
||
<td>e</td>
|
||
<td>episode number</td>
|
||
<td>1</td>
|
||
</tr>
|
||
<tr>
|
||
<td>t</td>
|
||
<td>episode title</td>
|
||
<td>Labyrinth</td>
|
||
</tr>
|
||
<tr>
|
||
<td>airdate</td>
|
||
<td>episode airdate</td>
|
||
<td>2009-06-01</td>
|
||
</tr>
|
||
<tr>
|
||
<td>absolute</td>
|
||
<td>absolute episode number</td>
|
||
<td>42</td>
|
||
</tr>
|
||
<tr>
|
||
<td>special</td>
|
||
<td>special number</td>
|
||
<td>1</td>
|
||
</tr>
|
||
<tr>
|
||
<td>sxe</td>
|
||
<td>season / episode numbers</td>
|
||
<td>1x01</td>
|
||
</tr>
|
||
<tr>
|
||
<td>s00e00</td>
|
||
<td>season / episode numbers</td>
|
||
<td>S01E01</td>
|
||
</tr>
|
||
<tr>
|
||
<td>plex</td>
|
||
<td><a href="https://support.plex.tv/hc/en-us/categories/200028098-Media-Preparation" target="_blank">Plex Naming Standard</a></td>
|
||
<td><path></td>
|
||
</tr>
|
||
<tr>
|
||
<td>imdbid</td>
|
||
<td>imdb id</td>
|
||
<td>tt0756683</td>
|
||
</tr>
|
||
<tr>
|
||
<td>vc</td>
|
||
<td>video codec</td>
|
||
<td>x264</td>
|
||
</tr>
|
||
<tr>
|
||
<td>ac</td>
|
||
<td>audio codec</td>
|
||
<td>ac3</td>
|
||
</tr>
|
||
<tr>
|
||
<td>cf</td>
|
||
<td>container format</td>
|
||
<td>mkv</td>
|
||
</tr>
|
||
<tr>
|
||
<td>vf</td>
|
||
<td>standard video format</td>
|
||
<td>720p</td>
|
||
</tr>
|
||
<tr>
|
||
<td>hpi</td>
|
||
<td>exact video format</td>
|
||
<td>384p</td>
|
||
</tr>
|
||
<tr>
|
||
<td>af</td>
|
||
<td>audio channels</td>
|
||
<td>6ch</td>
|
||
</tr>
|
||
<tr>
|
||
<td>channels</td>
|
||
<td>audio channels</td>
|
||
<td>5.1</td>
|
||
</tr>
|
||
<tr>
|
||
<td>resolution</td>
|
||
<td>video size</td>
|
||
<td>1280x720</td>
|
||
</tr>
|
||
<tr>
|
||
<td>minutes</td>
|
||
<td>Duration in minutes</td>
|
||
<td>42</td>
|
||
</tr>
|
||
<tr>
|
||
<td>ws</td>
|
||
<td>widescreen tag</td>
|
||
<td>WS</td>
|
||
</tr>
|
||
<tr>
|
||
<td>sdhd</td>
|
||
<td>SD/HD video</td>
|
||
<td>SD or HD</td>
|
||
</tr>
|
||
<tr>
|
||
<td>s3d</td>
|
||
<td>Stereoscopic 3D tag</td>
|
||
<td>3D SBS</td>
|
||
</tr>
|
||
<tr>
|
||
<td>source</td>
|
||
<td>source medium</td>
|
||
<td>BluRay</td>
|
||
</tr>
|
||
<tr>
|
||
<td>group</td>
|
||
<td><a href="http://www.filebot.net/forums/viewtopic.php?f=5&t=4" target="_blank">release group</a></td>
|
||
<td>ALLiANCE</td>
|
||
</tr>
|
||
<tr>
|
||
<td>crc32</td>
|
||
<td>crc32 checksum</td>
|
||
<td>3E16AF40</td>
|
||
</tr>
|
||
<tr>
|
||
<td>gigabytes</td>
|
||
<td>Filesize in gigabytes</td>
|
||
<td>4.2</td>
|
||
</tr>
|
||
<tr>
|
||
<td>fn</td>
|
||
<td>original filename</td>
|
||
<td>Serenity</td>
|
||
</tr>
|
||
<tr>
|
||
<td>ext</td>
|
||
<td>file extension</td>
|
||
<td>mkv</td>
|
||
</tr>
|
||
<tr>
|
||
<td>episode</td>
|
||
<td>episode object</td>
|
||
<td><default episode name></td>
|
||
</tr>
|
||
<tr>
|
||
<td>movie</td>
|
||
<td>movie object</td>
|
||
<td><default movie name></td>
|
||
</tr>
|
||
<tr>
|
||
<td>pi</td>
|
||
<td>movie part index</td>
|
||
<td>1</td>
|
||
</tr>
|
||
<tr>
|
||
<td>pn</td>
|
||
<td>number of movie parts</td>
|
||
<td>2</td>
|
||
</tr>
|
||
<tr>
|
||
<td>lang</td>
|
||
<td>language tag</td>
|
||
<td>eng</td>
|
||
</tr>
|
||
<tr>
|
||
<td>subt</td>
|
||
<td>subtitle tags</td>
|
||
<td>.eng.forced</td>
|
||
</tr>
|
||
<tr>
|
||
<td>collection</td>
|
||
<td>movie set</td>
|
||
<td>Avatar Collection</td>
|
||
</tr>
|
||
<tr>
|
||
<td>director</td>
|
||
<td>movie director</td>
|
||
<td>James Cameron</td>
|
||
</tr>
|
||
<tr>
|
||
<td>actors</td>
|
||
<td>list of actors</td>
|
||
<td>[Sam Worthington, Zoe Saldana, ...]</td>
|
||
</tr>
|
||
<tr>
|
||
<td>genres</td>
|
||
<td>list of genres</td>
|
||
<td>[Science Fiction, Action, ...]</td>
|
||
</tr>
|
||
<tr>
|
||
<td>languages</td>
|
||
<td>list of spoken languages</td>
|
||
<td>[English, German, ...]</td>
|
||
</tr>
|
||
<tr>
|
||
<td>certification</td>
|
||
<td>content rating</td>
|
||
<td>PG-13</td>
|
||
</tr>
|
||
<tr>
|
||
<td>rating</td>
|
||
<td>movie rating</td>
|
||
<td>8.5</td>
|
||
</tr>
|
||
<tr>
|
||
<td>info</td>
|
||
<td>extended metadata</td>
|
||
<td><any movie / series info></td>
|
||
</tr>
|
||
<tr>
|
||
<td>omdb</td>
|
||
<td><a href="http://www.omdbapi.com/">OMDb</a> info</td>
|
||
<td><any movie / series info></td>
|
||
</tr>
|
||
<tr>
|
||
<td>file</td>
|
||
<td>file object</td>
|
||
<td><file path></td>
|
||
</tr>
|
||
<tr>
|
||
<td>dim</td>
|
||
<td>video dimensions</td>
|
||
<td><width and height></td>
|
||
</tr>
|
||
<tr>
|
||
<td>media</td>
|
||
<td>general media info object</td>
|
||
<td><any general media parameter></td>
|
||
</tr>
|
||
<tr>
|
||
<td>video</td>
|
||
<td>video streams</td>
|
||
<td><any video parameter></td>
|
||
</tr>
|
||
<tr>
|
||
<td>audio</td>
|
||
<td>audio streams</td>
|
||
<td><any audio parameter></td>
|
||
</tr>
|
||
<tr>
|
||
<td>text</td>
|
||
<td>subtitle streams</td>
|
||
<td><any subtitle parameter></td>
|
||
</tr>
|
||
</table>
|
||
|
||
<h2 class="reference" id="functions">
|
||
Function Reference
|
||
<a href="https://github.com/filebot/filebot/tree/master/source/net/filebot/format/ExpressionFormatMethods.java" class="source" target="_blank">source</a>
|
||
</h2>
|
||
<p>
|
||
<code><span class="method">pad</span>(<span class="numeral">length</span>, <span class="string">padding</span> = <span class="string">"0"</span>)</code>Pad strings or numbers with given characters ('0' by default).
|
||
</p>
|
||
<p>
|
||
<code><span class="method">match</span>(<span class="regex">pattern</span>)</code>Get a substring matching the given pattern or break.
|
||
</p>
|
||
<p>
|
||
<code><span class="method">matchAll</span>(<span class="regex">pattern</span>)</code>Get a list of substrings matching the given pattern or break.
|
||
</p>
|
||
<p>
|
||
<code><span class="method">space</span>(<span class="string">replacement</span>)</code>Replace all spaces (e.g. "Doctor Who" -> "Doctor_Who").
|
||
</p>
|
||
<p>
|
||
<code><span class="method">upperInitial</span>()</code>Upper-case all initials (e.g. "The Day a new Demon was born" -> "The Day A New Demon Was Born").
|
||
</p>
|
||
<p>
|
||
<code><span class="method">lowerTrail</span>()</code>Lower-case all letters that are not initials (e.g. "Gundam SEED" -> "Gundam Seed").
|
||
</p>
|
||
<p>
|
||
<code><span class="method">acronym</span>()</code>Get acronym, i.e. first letter of each word. (e.g. "Deep Space 9" -> "DS9").
|
||
</p>
|
||
<p>
|
||
<code><span class="method">before</span>(<span class="regex">pattern</span>)</code>Get the substring before the given pattern or the original value.
|
||
</p>
|
||
<p>
|
||
<code><span class="method">after</span>(<span class="regex">pattern</span>)</code>Get the substring after the given pattern or the original value.
|
||
</p>
|
||
<p>
|
||
<code><span class="method">replaceAll</span>(<span class="regex">pattern</span>, <span class="string">replacement</span> = <span class="string">""</span>)</code>Replace or remove all occurrences of the pattern.
|
||
</p>
|
||
<p>
|
||
<code><span class="method">replaceTrailingBrackets</span>(<span class="string">replacement</span> = <span class="string">""</span>)</code>Replace trailing parenthesis including any leading whitespace (e.g. "The IT Crowd (UK)" -> "The IT Crowd").
|
||
</p>
|
||
<p>
|
||
<code><span class="method">replacePart</span>(<span class="string">replacement</span> = <span class="string">""</span>)</code>Replace part identifier (e.g. "Today Is the Day (1)" -> "Today Is the Day, Part 1").
|
||
</p>
|
||
<p>
|
||
<code><span class="method">ascii</span>()</code>Convert Unicode to ASCII. (e.g. "Österreich" -> "Osterreich" or "カタカナ" -> "katakana").
|
||
</p>
|
||
<p>
|
||
<code><span class="method">transliterate</span>(<span class="regex">identifier</span>)</code>Apply any <a target="_blank" href="http://userguide.icu-project.org/transforms/general">ICU script transliteration</a>. e.g. "中国".transliterate("han-latin") -> "zhōng guó".
|
||
</p>
|
||
</div>
|
||
|
||
<p class="suggestion">
|
||
Need some help getting started? Check the <a href="http://www.filebot.net/forums/viewforum.php?f=5">forums</a>.
|
||
</p>
|
||
|
||
<div class="metrics">
|
||
</div>
|
||
|
||
<div class="footer">
|
||
<p>Hosted on <a href="http://sourceforge.net/projects/filebot/">sourceforge.net</a> | Creative Commons License: Attribution-NonCommercial-ShareAlike © @{tstamp.year}</p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</body>
|
||
</html>
|