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

no edit summary
No edit summary
No edit summary
Line 10: Line 10:
* "?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(moviePartCount>1, ' - Part '+partno+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'''<br />
Split into multiple lines for easier viewing. ;)<br />
<code><pre>?set('V', if(v>1, 'v'+v), '')
?set('A', a)
?set('E', if(isMovie and (eps=1), if(epps>1, if(length(V)>0, V+' - ', '')+'Part '+epp, if(length(V)>0, V, '')), if(eps>1, ep+V+' - '+e, if(length(V)>0, V+' - '+e, e))))
?set('LANG', la2+if((length(la2)>0) and (length(ls2)>0), '-')+ls2)
?set('LANG', if(length(LANG)>0, '('+LANG+')'))
?set('G', if(gid>0, g, if((lac<=1) and (lsc=0) and ((la='ja') or (la='')), '[RAW]')))
?set('CRC', if(length(crc)>0, '{'+crc+'}', ''))
?set('TAIL', join(' ', LANG, G, CRC))
?set('TAIL', if(length(TAIL)>0, ' '+TAIL))
?set('TOTLEN', length(A)+length(E)+length(TAIL))
?if(TOTLEN>240, if(length(E)>50, set(E, limit(E, max(50, 240-length(A)-length(TAIL))))))
?set('TOTLEN', length(A)+length(E)+length(TAIL))
?if(TOTLEN>240, if(length(A)>50, set(A, limit(A, max(50, 240-length(E)-length(TAIL))))))
?out(A+if(length(E)>0, ' - '+E)+TAIL)</pre></code>


'''Custom tags'''<br />
'''Custom tags'''<br />
AOM still supports custom tags to simplify rules. Custom tags works as follows:
AOM still supports custom tags to simplify rules. Custom tags are simply new tags that contains a text or collection of subtags.
* 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:
With custom tags you could simplify for example the group rule, for example you could write it:
* Using ?if: "?if(lg<><nowiki>''</nowiki>, '['+lg+']', <nowiki>''</nowiki>)" -> "?G"
* Using ?if: "?if(lg<><nowiki>''</nowiki>, '['+lg+']', <nowiki>''</nowiki>)" -> "?G"
* Simplest form: "[?lg]" -> "?G"
* Simplest form: "[?lg]" -> "?G"
Line 74: Line 88:
|-
|-
|?la||text||Shows all audio languages
|?la||text||Shows all audio languages
|-
|?lac||number||Number of audio languages
|-
|-
|?la1, ?la2, ?la3, ?la4||text||Shows 1-4 audio languages
|?la1, ?la2, ?la3, ?la4||text||Shows 1-4 audio languages
Line 80: Line 96:
|-
|-
|?ls||text||Shows all subtitle languages
|?ls||text||Shows all subtitle languages
|-
|?lsc||number||Number of subtitle languages
|-
|-
|?ls1, ?ls2, ?ls3, ?ls4||text||Shows 1-4 subtitle languages
|?ls1, ?ls2, ?ls3, ?ls4||text||Shows 1-4 subtitle languages
|-
|?m||number||Release month of anime
|-
|?me||number||End month of anime
|-
|-
|?mid||number||Mylist ID
|?mid||number||Mylist ID
Line 111: Line 133:
|?ym||text||Release year and month of anime
|?ym||text||Release year and month of anime
|-
|-
|?yme||text||End release year and month of anime
|?yme||text||End year and month of anime
|}
|}
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).
Line 117: Line 139:
'''Function tags'''<br />
'''Function tags'''<br />
{|
{|
|?if()||If statement.<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))
|-
|?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)
|-
|?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
|-
|?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)
|-
|-
|?lc()||Converts the supplied parameter to lower case.<br />Example ?lc(crc)
|?sc(text)||text||Converts text to sentence case.<br />Example ?sc(a)
|-
|-
|?out()||Returns the specified variable.<br />Example ?out(crc)
|?set(name, data)||nothing||Declares a new tag called name containing data, same as custom tags internally.<br />Example ?set(temp, 'text')
|-
|-
|?sc()||Converts the supplied parameter to sentence case.<br />Example ?sc(a)
|?split(text, find, index)||text||Splits text on find and returns the specified index. Index starts from 1.<br />Example ?split(ym, '-', 2)
|-
|-
|?set()||Declares a new tag with the specified value, same as custom tags internally.<br />Example ?set(temp, 'text')
|?start(find, text)||boolean||Checks if find matches the start of text.<br />Example ?start(y, '199')
|-
|-
|?tc()||Converts the supplied parameter to title case.<br />Example ?tc(a)
|?tc(text)||text||Converts text to title case.<br />Example ?tc(a)
|-
|-
|?uc()||Converts the supplied parameter to upper case.<br />Example ?uc(crc)
|?uc(text)||text||Converts text to upper case.<br />Example ?uc(crc)
|}
|}


254

edits

MediaWiki spam blocked by CleanTalk.
MediaWiki spam blocked by CleanTalk.