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

Jump to navigation Jump to search
m (Added TOC)
mNo edit summary
Line 8: Line 8:


Here's a few sample patterns:
Here's a few sample patterns:
* "?a - ?ep - ?e [?g]" -> <br />"Anime - 02 - Episode name [Group name]"
* "?a - ?ep - ?e [?g]" -> <br>"Anime - 02 - Episode name [Group name]"
* "?a - ?epv?v - ?e?if(lg<><nowiki>''</nowiki>, ' ['+lg+']', <nowiki>''</nowiki>)" -> <br />With group: "Anime - 02v1 - Episode name [Group name]"<br />Without group:"Anime - 02v1 - Episode name"
* "?a - ?epv?v - ?e?if(lg<><nowiki>''</nowiki>, ' ['+lg+']', <nowiki>''</nowiki>)" -> <br>With group: "Anime - 02v1 - Episode name [Group name]"<br>Without group:"Anime - 02v1 - Episode name"
* "?if(wltw, 'To watch\', <nowiki>''</nowiki>)?a?if(isMovie, if(epps>1, ' - Part '+epp+if(v>1, 'v'+v, <nowiki>''</nowiki>), if(v>1, ' - v'+v, <nowiki>''</nowiki>)), ep+if(v>1, v, <nowiki>''</nowiki>)+'- ?e') ?if(lg<><nowiki>''</nowiki>, lg+' ', <nowiki>''</nowiki>){?crc32}" -> <br />For a movie: "Anime name - v2 [Group name]{crc32}"<br />For a movie with 2 parts: "Anime name - Part 2v2 [Group name]{crc32}<br />For a normal anime, marked as "to watch in wishlist": "To watch\Anime name - 02v2 - Episode name [Group name]{crc32}
* "?if(wltw, 'To watch\', <nowiki>''</nowiki>)?a?if(isMovie, if(epps>1, ' - Part '+epp+if(v>1, 'v'+v, <nowiki>''</nowiki>), if(v>1, ' - v'+v, <nowiki>''</nowiki>)), ep+if(v>1, v, <nowiki>''</nowiki>)+'- ?e') ?if(lg<><nowiki>''</nowiki>, lg+' ', <nowiki>''</nowiki>){?crc32}" -> <br>For a movie: "Anime name - v2 [Group name]{crc32}"<br>For a movie with 2 parts: "Anime name - Part 2v2 [Group name]{crc32}<br>For a normal anime, marked as "to watch in wishlist": "To watch\Anime name - 02v2 - Episode name [Group name]{crc32}


===Default pattern===
===Default pattern===
Split into multiple lines for easier viewing. ;)<br />
Split into multiple lines for easier viewing. ;)<br>
<code><pre>?set('V', if(v>1, 'v'+v, ''))
<code><pre>?set('V', if(v>1, 'v'+v, ''))
?set('A', a)
?set('A', a)
Line 30: Line 30:


===Constant expressions===
===Constant expressions===
There are two ways to specify string literals:<br />
There are two ways to specify string literals:<br>
'text' - use '' to insert a ' (e.g. 'her''s')<br />
'text' - use '' to insert a ' (e.g. 'her''s')<br>
or<br />
or<br>
"text" - use \" to insert a "  (e.g. "a \"quotation\"")<br />
"text" - use \" to insert a "  (e.g. "a \"quotation\"")<br>
<br />
<br>
Number literals are simply written as numbers:<br />
Number literals are simply written as numbers:<br>
1234<br />
1234<br>
<br />
<br>
There are also boolean consants:<br />
There are also boolean consants:<br>
true<br />
true<br>
false<br />
false<br>


===Custom tags===
===Custom tags===
Line 118: Line 118:
|?me||number||End month of anime
|?me||number||End month of anime
|-
|-
|?mid||number||Mylist ID
|?mid||number||MyList ID
|-
|-
|?seps||number||Total number of special episodes
|?seps||number||Total number of special episodes
Line 152: Line 152:
===Function tags===
===Function tags===
{|
{|
|?if(test, trueval, falseval)||any||If statement, returns trueval if test is true, otherwise returns falseval.<br /> Example: ?if(a=b, 'equal', 'not equal')
|?if(test, trueval, falseval)||any||If statement, returns trueval if test is true, otherwise returns falseval.<br> Example: ?if(a=b, 'equal', 'not equal')
|-
|-
|?in(find, text)||boolean||Checks if find is present text.<br />Example ?in('complete movie', lc(e))
|?in(find, text)||boolean||Checks if find is present text.<br>Example ?in('complete movie', lc(e))
|-
|-
|?join(glue, text...)||text||Joins together two or more texts, empty parameters are ignored with no glue added.<br />Example ?join(' ', 'a', 'b', 'c')
|?join(glue, text...)||text||Joins together two or more texts, empty parameters are ignored with no glue added.<br>Example ?join(' ', 'a', 'b', 'c')
|-
|-
|?lc(text)||text||Converts text to lower case.<br />Example ?lc(crc)
|?lc(text)||text||Converts text to lower case.<br>Example ?lc(crc)
|-
|-
|?length(text)||number||Returns the text length of text.<br />Example ?length(a)
|?length(text)||number||Returns the text length of text.<br>Example ?length(a)
|-
|-
|?limit(text, length[, end])||text||Limits the length of text to at most length characters. End is optional, if specified and the text is cropped, it'll be added at the end of text.<br />Example ?limit(e, 100) or ?limit(e, 100, '...')
|?limit(text, length[, end])||text||Limits the length of text to at most length characters. End is optional, if specified and the text is cropped, it'll be added at the end of text.<br>Example ?limit(e, 100) or ?limit(e, 100, '...')
|-
|-
|?min(number...)||number||Returns the lowest supplied number<br />Example ?min(1, 7, 3, 9, 2) returns 1
|?min(number...)||number||Returns the lowest supplied number<br>Example ?min(1, 7, 3, 9, 2) returns 1
|-
|-
|?max(number...)||number||Returns the highest supplied number<br />Example ?max(1, 7, 3, 9, 2) returns 9
|?max(number...)||number||Returns the highest supplied number<br>Example ?max(1, 7, 3, 9, 2) returns 9
|-
|-
|?out(variable)||any||Returns variable.<br />Example ?out(crc)
|?out(variable)||any||Returns variable.<br>Example ?out(crc)
|-
|-
|?sc(text)||text||Converts text to sentence case.<br />Example ?sc(a)
|?sc(text)||text||Converts text to sentence case.<br>Example ?sc(a)
|-
|-
|?set(name, data)||nothing||Declares a new tag called name containing data, same as custom tags internally.<br />Example ?set('temp', 'text')
|?set(name, data)||nothing||Declares a new tag called name containing data, same as custom tags internally.<br>Example ?set('temp', 'text')
|-
|-
|?split(text, find, index)||text||Splits text on find and returns the specified index. Index starts from 1.<br />Example ?split(ym, '-', 2)
|?split(text, find, index)||text||Splits text on find and returns the specified index. Index starts from 1.<br>Example ?split(ym, '-', 2)
|-
|-
|?start(text, find)||boolean||Checks if find matches the start of text.<br />Example ?start(y, '199')
|?start(text, find)||boolean||Checks if find matches the start of text.<br>Example ?start(y, '199')
|-
|-
|?tc(text)||text||Converts text to title case.<br />Example ?tc(a)
|?tc(text)||text||Converts text to title case.<br>Example ?tc(a)
|-
|-
|?uc(text)||text||Converts text to upper case.<br />Example ?uc(crc)
|?uc(text)||text||Converts text to upper case.<br>Example ?uc(crc)
|}
|}


Line 210: Line 210:
|A&gt;=B||true if A is more or equal to B
|A&gt;=B||true if A is more or equal to B
|}
|}
'''Logical operators'''<br />
'''Logical operators'''<br>
{|
{|
|A and B||true if both A and B are true
|A and B||true if both A and B are true
Line 247: Line 247:


===Automatically update the storage field of MyList entries===
===Automatically update the storage field of MyList entries===
This will make the file manager automatically update the storage field of MyList entries based on the volume it's stored on. This field currently only works for files on a removable storage such as a DVD. The label used will be the label of the removable media, eg. DVD #013.
This will make the file manager automatically update the storage field of MyList entries based on the volume it's stored on. This field currently only works for files on a removable storage such as a DVD. The label used will be the label of the removable media, e.g. DVD #013.


===Automatically mark found files as OnHDD or OnRemovable in MyList===
===Automatically mark found files as OnHDD or OnRemovable in MyList===