AniDB O'Matic - Documentation: Local file renaming: Difference between revisions

From AniDB
Jump to navigation Jump to search
No edit summary
(wiki markup)
Line 24: Line 24:


'''Default tags'''<br />
'''Default tags'''<br />
<table>
{|
<tr><td>?a</td><td>Anime name</td></tr>
|?a||Anime name
<tr><td>?ab</td><td>Audio bitrate</td></tr>
|-
<tr><td>?ac</td><td>Audio codec</td></tr>
|?ab||Audio bitrate
<tr><td>?aid</td><td>Anime ID</td></tr>
|-
<tr><td>?e</td><td>Episode name</td></tr>
|?ac||Audio codec
<tr><td>?eid</td><td>Episode ID</td></tr>
|-
<tr><td>?ep</td><td>Episode number</td></tr>
|?aid||Anime ID
<tr><td>?ep2, ?ep3, ?ep4</td><td>Zero padded episode number, eg ?ep3 = 007</td></tr>
|-
<tr><td>?fid</td><td>File ID</td></tr>
|?e||Episode name
<tr><td>?fs</td><td>File source</td></tr>
|-
<tr><td>?g</td><td>Group name, long (?lg) if available, otherwise short (?sg)</td></tr>
|?eid||Episode ID
<tr><td>?gid</td><td>Group ID</td></tr>
|-
<tr><td>?lang</td><td>Shows 1-2 Audio and 1-2 Subtitle languages</td></tr>
|?ep||Episode number
<tr><td>?la</td><td>Shows all audio languages</td></tr>
|-
<tr><td>?la1, ?la2, ?la3, ?la4</td><td>Shows 1-4 audio languages</td></tr>
|?ep2, ?ep3, ?ep4||Zero padded episode number, eg ?ep3 = 007
<tr><td>?lg</td><td>Long group name</td></tr>
|-
<tr><td>?ls</td><td>Shows all subtitle languages</td></tr>
|?fid||File ID
<tr><td>?ls1, ?ls2, ?ls3, ?ls4</td><td>Shows 1-4 subtitle languages</td></tr>
|-
<tr><td>?mid</td><td>Mylist ID</td></tr>
|?fs||File source
<tr><td>?sg</td><td>Short group name</td></tr>
|-
<tr><td>?v</td><td>File version</td></tr>
|?g||Group name, long (?lg) if available, otherwise short (?sg)
<tr><td>?vb</td><td>Video bitrate</td></tr>
|-
<tr><td>?vc</td><td>Video codec</td></tr>
|?gid||Group ID
<tr><td></td><td></td></tr>
|-
<tr><td></td><td></td></tr>
|?lang||Shows 1-2 Audio and 1-2 Subtitle languages
</table>
|-
|?la||Shows all audio languages
|-
|?la1, ?la2, ?la3, ?la4||Shows 1-4 audio languages
|-
|?lg||Long group name
|-
|?ls||Shows all subtitle languages
|-
|?ls1, ?ls2, ?ls3, ?ls4||Shows 1-4 subtitle languages
|-
|?mid||Mylist ID
|-
|?sg||Short group name
|-
|?v||File version
|-
|?vb||Video bitrate
|-
|?vc||Video codec
|}
Note that all tags are greedy, that means that ?ep2 will always be read as ep2, never as ?e or ?ep. If you need a tag to not be greedy you can use ?out(ep).
Note that all tags are greedy, that means that ?ep2 will always be read as ep2, never as ?e or ?ep. If you need a tag to not be greedy you can use ?out(ep).


'''Function tags'''<br />
'''Function tags'''<br />
<table>
{|
<tr><td>?if()</td><td>If statement.<br /> Example: ?if(a=b, 'equal', 'not equal')</td></tr>
|?if()||If statement.<br /> Example: ?if(a=b, 'equal', 'not equal')
<tr><td>?lc()</td><td>Converts the supplied parameter to lower case.<br />Example ?lc(crc)</td></tr>
|-
<tr><td>?uc()</td><td>Converts the supplied parameter to upper case.<br />Example ?uc(crc)</td></tr>
|?lc()||Converts the supplied parameter to lower case.<br />Example ?lc(crc)
</table>
|-
|?uc()||Converts the supplied parameter to upper case.<br />Example ?uc(crc)
|}

Revision as of 12:32, 28 August 2007

File renaming patterns

AoM contains a comprehensive number of patterns to fully customize file names and paths. In order for the pattern to allow very complex rules it essentially allows light scripting. The path can be a complete path or a partial path, in case of a partial path the current file manager is used to place the file based on a known root or from the root folder of the file manager, see file managers below for more details. File extensions are automatically added to the end of the pattern.

Here's a few sample patterns:

  • "?a - ?ep - ?e [?g]" ->
    "Anime - 02 - Episode name [Group name]"
  • "?a - ?epv?v - ?e?if(lg<>'', ' ['+lg+']', '')" ->
    With group: "Anime - 02v1 - Episode name [Group name]"
    Without group:"Anime - 02v1 - Episode name"
  • "?if(wltw, 'To watch\', '')?a?if(isMovie, if(moviePartCount>1, ' - Part '+partno+if(v>1, 'v'+v, ''), if(v>1, ' - v'+v, '')), ep+if(v>1, v, '')+'- ?e') ?if(lg<>'', lg+' ', ''){?crc32}" ->
    For a movie: "Anime name - v2 [Group name]{crc32}"
    For a movie with 2 parts: "Anime name - Part 2v2 [Group name]{crc32}
    For a normal anime, marked as "to watch in wishlist": "To watch\Anime name - 02v2 - Episode name [Group name]{crc32}

Custom tags
AOM still supports custom tags to simplify rules. Custom tags works as follows:

  • Specified like a normal tag but in all uppercase, for example "?G".
  • If any subpart of the tag is empty, the whole tag is skipped, except:
  • If the tag contains ?if statements, these are not checked if they're empty.

With this you could simplify the group rule, for example you could write it:

  • Using ?if: "?if(lg<>'', '['+lg+']', '')" -> "?G"
  • Simplest form: "[?lg]" -> "?G"
  • More advanced example: "?if(lg<>'', '['+lg']', if(sg<>'', '['+sg']', '[RAW]'))" -> "?G"

Default tags

?a Anime name
?ab Audio bitrate
?ac Audio codec
?aid Anime ID
?e Episode name
?eid Episode ID
?ep Episode number
?ep2, ?ep3, ?ep4 Zero padded episode number, eg ?ep3 = 007
?fid File ID
?fs File source
?g Group name, long (?lg) if available, otherwise short (?sg)
?gid Group ID
?lang Shows 1-2 Audio and 1-2 Subtitle languages
?la Shows all audio languages
?la1, ?la2, ?la3, ?la4 Shows 1-4 audio languages
?lg Long group name
?ls Shows all subtitle languages
?ls1, ?ls2, ?ls3, ?ls4 Shows 1-4 subtitle languages
?mid Mylist ID
?sg Short group name
?v File version
?vb Video bitrate
?vc Video codec

Note that all tags are greedy, that means that ?ep2 will always be read as ep2, never as ?e or ?ep. If you need a tag to not be greedy you can use ?out(ep).

Function tags

?if() If statement.
Example: ?if(a=b, 'equal', 'not equal')
?lc() Converts the supplied parameter to lower case.
Example ?lc(crc)
?uc() Converts the supplied parameter to upper case.
Example ?uc(crc)