filebot/website/naming.html
2011-11-27 05:15:52 +00:00

360 lines
20 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Episode Format Expression</title>
<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 analytics -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25379256-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<!-- google plus one -->
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
</head>
<body>
<div class="page">
<div class="navigation" style="position:absolute; top:36px; right:-40px">
<div>
<ul>
<li><a href="http://filebot.sourceforge.net/forums/">Forums</a></li>
<li><a href="http://filebot.sourceforge.net/forums/viewtopic.php?f=3&t=7">FAQ</a></li>
<li><a href="http://filebot.sourceforge.net/#download">Download</a></li>
</ul>
</div>
</div>
<div class="social">
<div class="twitter" style="position:relative; top:3px;">
<a href="https://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="filebot_renamer" data-url="http://filebot.sourceforge.net/">Tweet</a><script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
</div>
<div class="plusone" style="position:relative; left:25px; top:1px">
<g:plusone callback="_gaq.push(['_trackEvent','Social networking','Google Plus One',document.title])"></g:plusone>
</div>
</div>
<div class="header">
<a href="http://filebot.sourceforge.net"><img class="logo" alt="logo" src="images/icon.png" width="48" height="48" /></a>
<h1>
Episode Format Expressions
<span class="description">User defined episode naming scheme</span>
</h1>
</div>
<div class="content">
<div class="screenshot">
<a href="gallery.html#screenshots/original/dialog.format.png" title="Episode Format Dialog" target="_blank">
<img alt="screenshot" src="screenshots/medium/dialog.format.png" />
</a>
</div>
<div class="section about">
<h2>About</h2>
<p>
You can easily define your own episode naming scheme. It uses <a href="http://groovy.codehaus.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.
</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">s</span><span class="block end">}</span>.<span class="block start">{</span><span class="variable">e</span><span class="block end">}</span> - <span class="block start">{</span><span class="variable">t</span><span class="block end">}</span></code>
Dark Angel - 3.1 - Labyrinth
</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="string">'S'</span>+<span class="variable">s</span>.<span class="method"><span class="method">pad</span></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="block end">}</span></code>Dark Angel - S03E01 - 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="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="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="method">lower</span>()<span class="block end">}</span>.<span class="block start">{</span><span class="variable">ac</span>.<span class="method">lower</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>).<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, but with lots of cleanup operations.
</p>
<h2 class="reference" id="bindings">
Binding Reference
<a href="http://filebot.svn.sourceforge.net/viewvc/filebot/trunk/source/net/sourceforge/filebot/format/MediaBindingBean.java?view=markup" 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 epsiode 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>imdb</td>
<td>imdb id</td>
<td>0756683</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>video format</td>
<td>720p</td>
</tr>
<tr>
<td>af</td>
<td>audio channels</td>
<td>6ch</td>
</tr>
<tr>
<td>resolution</td>
<td>video size</td>
<td>1280x720</td>
</tr>
<tr>
<td>ws</td>
<td>widescreen flag</td>
<td>ws</td>
</tr>
<tr>
<td>sdhd</td>
<td>SD/HD video</td>
<td>SD or HD</td>
</tr>
<tr>
<td>source</td>
<td>source medium</td>
<td>BluRay</td>
</tr>
<tr>
<td>group</td>
<td><a href="http://filebot.sourceforge.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>fn</td>
<td>file name</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>&lt;default episode name&gt;</td>
</tr>
<tr>
<td>movie</td>
<td>movie object</td>
<td>&lt;default movie name&gt;</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>detect subtitle language</td>
<td>eng</td>
</tr>
<tr>
<td>file</td>
<td>file object</td>
<td>&lt;file path&gt;</td>
</tr>
<tr>
<td>media</td>
<td>general media info object</td>
<td>&lt;any general media parameter&gt;</td>
</tr>
<tr>
<td>video</td>
<td>video object [stream 0]</td>
<td>&lt;any video parameter&gt;</td>
</tr>
<tr>
<td>audio</td>
<td>audio object [stream 0]</td>
<td>&lt;any audio parameter&gt;</td>
</tr>
<tr>
<td>text</td>
<td>subtitle object [stream 0]</td>
<td>&lt;any subtitle parameter&gt;</td>
</tr>
</table>
<h2 class="reference" id="functions">
Function Reference
<a href="http://filebot.svn.sourceforge.net/viewvc/filebot/trunk/source/net/sourceforge/filebot/format/ExpressionFormat.lib.groovy?view=markup" 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">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">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>
</div>
<p class="suggestion">
Need some help getting started? Check the <a href="http://filebot.sourceforge.net/forums/viewforum.php?f=4">forums</a>.
</p>
<div class="metrics">
<script type="text/javascript" src="http://www.ohloh.net/p/16945/widgets/project_partner_badge.js"></script>
</div>
<div class="footer">
<div id="flattr">
<!-- flattr -->
<script type="text/javascript">
/* <![CDATA[ */
(function() {
var s = document.createElement('script'), t = document.getElementsByTagName('script')[0];
s.type = 'text/javascript';
s.async = true;
s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
t.parentNode.insertBefore(s, t);
})();
/* ]]> */
</script>
<a class="FlattrButton" rev="flattr;button:compact;" href="http://filebot.sourceforge.net"></a>
</div>
<div id="donate">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" style="display:inline" target="_blank">
<input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHNwYJKoZIhvcNAQcEoIIHKDCCByQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20C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C1dHHtrrA3SInH0HpIZG5RgDhLcgH1agjGbGGv4k/eKr9Bffte3kf6l3Qd92ZX5AUS1Rf/dD-----END PKCS7-----" />
<input onclick="_gaq.push(['_trackPageview', '/donate/paypal'])" type="image" src="images/donate.png" name="submit" alt="PayPal - The safer, easier way to pay online." />
</form>
</div>
Hosted on <a href="http://sourceforge.net">sourceforge.net</a> | Creative Commons License: Attribution-NonCommercial-ShareAlike © 2011
</div>
</div>
</div>
</body>
</html>