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

Jump to navigation Jump to search
m
→‎E / EPISODE: fandubs are normal eps with audio track type fandub
m (→‎Default pattern: removing redundant code tags)
m (→‎E / EPISODE: fandubs are normal eps with audio track type fandub)
 
(10 intermediate revisions by 3 users not shown)
Line 7: Line 7:
File extensions are automatically added to the end of the pattern.
File extensions are automatically added to the end of the pattern.


==Sample patters==
==Sample patterns==
'''English anime title with fallback'''
'''English anime title with fallback'''
<pre>
<pre>
Line 47: Line 47:
if(length(etitle)=0, set('etitle', E.Name))
if(length(etitle)=0, set('etitle', E.Name))
</pre>
</pre>
'''File version
'''File version and censor flag
<pre>
<pre>
set('version', if(F.Version>1, 'v'+F.Version,))
set('censored', 'unknown')
set('version', F.Version)
set('state_map', F.State mod 4096)
if(state_map>=2048, set('version', 9) + set('state_map', state_map - 2048))
if(state_map>=1024, if(version<9,set('version', 8)) + set('state_map', state_map - 1024))
if(state_map>=512, if(version<9,set('version', 7)) + set('state_map', state_map - 512))
if(state_map>=256, if(version<9,set('version', 6)) + set('state_map', state_map - 256))
if(state_map>=128, set('censored', 'yes') + set('state_map', state_map - 128))
if(state_map>=64, set('censored', 'no') + set('state_map', state_map - 64))
set('version', if(version>1, 'v'+F.Version, ''))
set('censored',if(censored='yes','[Censored]',''))
</pre>
</pre>
'''Padded episode number'''
'''Padded episode number'''
<pre>
<pre>
set('mepno', max(A.TotalEpisodeCount, E.EpisodeTypeCount))
set('mepno', if(E.TypeId=1, max(A.TotalEpisodeCount, E.EpisodeTypeCount), E.EpisodeTypeCount))
set('epno', padl(E.EpisodeNo, max(1, length(mepno)), '0'))
set('epno', padl(E.EpisodeNo, max(1, length(mepno)), '0'))
if(E.TypeId=2, set('epno', 'S'+epno))
if(E.TypeId=2, set('epno', 'S'+epno))
Line 81: Line 91:
if(length(crc)>0, set('crc', '('+uc(crc)+')')
if(length(crc)>0, set('crc', '('+uc(crc)+')')
</pre>
</pre>
'''Current filename (removing the path)'''
<pre>set('path_filename', PATH)
set('path_parts', 1)
for('i', 1, length(path_filename), if(copy(path_filename, i, 1) = '\', set('path_parts', path_parts+1)))
set('path_filename', split(path_filename, '\', path_parts))</pre>
===Complex samples===
See [[AniDB O'Matic - Documentation: Local file renaming - Samples | the article with samples]]


==Default pattern==
==Default pattern==
'''ATTENTION!''' The default pattern has a bug. See below for instructions to fix it.
<pre>set('atitle', at('x-jat'))
<pre>set('atitle', at('x-jat'))
if(length(atitle)=0, set('atitle', at('en')))
if(length(atitle)=0, set('atitle', at('en')))
Line 118: Line 137:
filename
filename
</pre>
</pre>
'''ATTENTION!''' The default pattern has a bug. To fix it, find the following line:
<pre>set('mepno', max(A.TotalEpisodeCount, E.EpisodeTypeCount))</pre>
And replace it with:
<pre>set('mepno', if(E.TypeId=1, max(A.TotalEpisodeCount, E.EpisodeTypeCount), E.EpisodeTypeCount))</pre>


==Objects==
==Objects==
Line 185: Line 208:
|EndDate||integer||End date in unix time, AniDB format.
|EndDate||integer||End date in unix time, AniDB format.
|-valign=top
|-valign=top
|Restricted||boolean||True for hentai, otherwise false.
|Restricted||boolean||'''Unreliable''' True for hentai, otherwise false.
|-valign=top
|-valign=top
|MylistCurrentEpisodeCount||integer||Number of episodes in mylist.
|MylistCurrentEpisodeCount||integer||Number of episodes in mylist.
Line 225: Line 248:
3: Opening/Ending/Credits<br>
3: Opening/Ending/Credits<br>
4: Trailer/Promo/Ads<br>
4: Trailer/Promo/Ads<br>
5: Parody/Fandub<br>
5: Parody<br>
6: Other
6: Other
|-valign="top"
|-valign="top"
Line 275: Line 298:
|Released||integer||Release date in unix time.
|Released||integer||Release date in unix time.
|-valign="top"
|-valign="top"
|ResolutionHeight||integer||Video height in pixels.
|ResolutionHeight||integer||'''Does not work''' Video height in pixels.
|-valign="top"
|-valign="top"
|ResolutionWidth||integer||Video width in pixels.
|ResolutionWidth||integer||'''Does not work''' Video width in pixels.
|-valign="top"
|-valign="top"
|Sha1||string||AniDB SHA1 value.
|Sha1||string||AniDB SHA1 value.
Line 311: Line 334:
|GroupLong||string||Long group name.
|GroupLong||string||Long group name.
|-valign="top"
|-valign="top"
|ResolutionString||string||Video WidthxHeight.
|ResolutionString||string||'''Does not work''' Video WidthxHeight.
|}
|}


Line 407: Line 430:
|-valign="top"
|-valign="top"
|for(name, start, end, task)||string||Runs '''task''' '''start''' to '''end''' times setting '''name''' to t1he current position each round.<br>Example: for('i', 1, 5, '?'+i) = '?1?2?3?4?5'
|for(name, start, end, task)||string||Runs '''task''' '''start''' to '''end''' times setting '''name''' to t1he current position each round.<br>Example: for('i', 1, 5, '?'+i) = '?1?2?3?4?5'
|-valign="top"
|function(name, stmt, stmt, ...)||string||Declares the function '''name''' which will execute stmt1, stmt2 etc. Parameters can be sent to function calls but there is only 1 GLOBAL scope.<br>Example: function('rreplace', set('temp', param1), for('i', 1, 10, set('temp', replace(temp, '&nbsp;&nbsp;', ' '))), temp)<br>rreplace(somevalue)
|-valign="top"
|-valign="top"
|getanime(name, id)||object||Sets the variable '''name''' to the anime object for '''id'''.<br>Example: getanime('a2', 78)
|getanime(name, id)||object||Sets the variable '''name''' to the anime object for '''id'''.<br>Example: getanime('a2', 78)
Line 439: Line 464:
|-valign="top"
|-valign="top"
|replacei(text, find[, replace])||string||Case insensitive replace of all occurences of '''find''' with '''replace''' in '''text'''.<br>Example: replace('HELLO tHeRe!', 'ThErE', 'TREES') = 'HELLO TREES!'
|replacei(text, find[, replace])||string||Case insensitive replace of all occurences of '''find''' with '''replace''' in '''text'''.<br>Example: replace('HELLO tHeRe!', 'ThErE', 'TREES') = 'HELLO TREES!'
|-valign="top"
|replacerepeat(text, find[, replace])||string||Runs replace repeatedly until the result stops changing.
|-valign="top"
|-valign="top"
|sc(text)||string||Converts '''text''' to sentence case.<br>Example: sc('HELLO THERE!') = 'Hello there!'
|sc(text)||string||Converts '''text''' to sentence case.<br>Example: sc('HELLO THERE!') = 'Hello there!'
83

edits

Navigation menu

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