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 (→‎E / EPISODE: fandubs are normal eps with audio track type fandub)
 
(40 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==
<code><pre>set('atitle', at('x-jat'))
 
'''ATTENTION!''' The default pattern has a bug. See below for instructions to fix it.
<pre>set('atitle', at('x-jat'))
if(length(atitle)=0, set('atitle', at('en')))
if(length(atitle)=0, set('atitle', at('en')))
if(length(atitle)=0, set('atitle', A.Name))
if(length(atitle)=0, set('atitle', A.Name))
Line 117: Line 136:
set('filename', replace(filename, '  ', ' '))
set('filename', replace(filename, '  ', ' '))
filename
filename
</pre></code>
</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 123: Line 146:
===A / ANIME===
===A / ANIME===
{|
{|
! scope="col" width="180" | Name
! scope="col" width="60" | Type
! scope="col" | Description
|-valign=top
|-valign=top
|Category||integer||Anime Type<br>
|Category||integer||Anime Type<br>
Line 182: 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 195: Line 221:
===E / EPISODE===
===E / EPISODE===
{|
{|
! scope="col" width="180" | Name
! scope="col" width="60" | Type
! scope="col" | Description
|-valign="top"
|-valign="top"
|AirDate||integer||Episode first air date.
|AirDate||integer||Episode first air date.
Line 219: 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 227: Line 256:
===F / FILE===
===F / FILE===
{|
{|
! scope="col" width="180" | Name
! scope="col" width="60" | Type
! scope="col" | Description
|-valign="top"
|-valign="top"
|Crc||string||AniDB CRC32 value.
|Crc||string||AniDB CRC32 value.
Line 236: Line 268:
|-valign="top"
|-valign="top"
|Ed2k||string||AniDB ED2K value.
|Ed2k||string||AniDB ED2K value.
|-valign="top"
|EpisodeStart||integer||Lowest related episode number of the same type within this anime.
|-valign="top"
|EpisodeEnd||integer||Highest related episode number of the same type within this anime.
|-valign="top"
|EpisodeList||string||List of episodes within this anime covered by this file.<br>Format: 1,2,3,7,17,93,O1,C3,U77
|-valign="top"
|EpisodeListDetails||string||Detailed list of episodes covered by this file.<br>Format: (EpisodeStr:EpisodeTypeId:AnimeId:EpisodeId:StartPercent:EndPercent)<br>Example:
1:1:357:95304:0:10,2:1:357:95960:0:100,6:1:357:108200:0:100,C1:3:357:108202:0:100
|-valign="top"
|-valign="top"
|FileType||string||File extension.
|FileType||string||File extension.
Line 257: 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 293: 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.
|}
|}


===G / GROUP===
===G / GROUP===
{|
{|
! scope="col" width="180" | Name
! scope="col" width="60" | Type
! scope="col" | Description
|-
|-
|colspan="3"|''Warning, this object might be unassigned. If so all values return False.''
|colspan="3"|''Warning, this object might be unassigned. If so all values return False.''
Line 314: Line 358:
===H / HASH===
===H / HASH===
{|
{|
! scope="col" width="180" | Name
! scope="col" width="60" | Type
! scope="col" | Description
|-valign="top"
|-valign="top"
|colspan="3"|''Warning, this object might be unassigned. If so all values return False.''
|colspan="3"|''Warning, this object might be unassigned. If so all values return False.''
Line 330: Line 377:
===M / MYLIST===
===M / MYLIST===
{|
{|
! scope="col" width="180" | Name
! scope="col" width="60" | Type
! scope="col" | Description
|-valign="top"
|-valign="top"
|colspan="3"|''Warning, this object might be unassigned. If so all values return False.''
|colspan="3"|''Warning, this object might be unassigned. If so all values return False.''
Line 348: Line 398:
|-valign="top"
|-valign="top"
|WatchedDate||integer||Watched date in unixtime.
|WatchedDate||integer||Watched date in unixtime.
|}
==Properties==
{|
|-valign=top
|ACTIVEPATTERN||string||The current rename pattern after cleanup.
|-valign=top
|PATH||string||Current path to the file. May be ''.
|-valign=top
|BASEPATH||string||Base path of the current file manager. May be ''.
|}
|}


==Functions==
==Functions==
{|
{|
! scope="col" | Function
! scope="col" width="60" | Type
! scope="col" | Description
|-valign="top"
|at(lang)||text||Returns a main/official anime title in '''lang'''. '''lang''' can be either a text or a number. <br>Example: at(2) = japanese title<br>Example: at('japanese (transcription)') = japanese transcription<br>Example: at('en') = english title
|at(lang)||text||Returns a main/official anime title in '''lang'''. '''lang''' can be either a text or a number. <br>Example: at(2) = japanese title<br>Example: at('japanese (transcription)') = japanese transcription<br>Example: at('en') = english title
|-
|-valign="top"
|atr(id, lang)||text||Returns a main/official anime title of anime with '''id''' in '''lang'''. '''lang''' can be either a text or a number. <br>Example: at(2) = japanese title<br>Example: at('japanese (transcription)') = japanese transcription<br>Example: at('en') = english title
|-valign="top"
|contains(find, text)||boolean||Returns true if '''find''' is found in '''text'''.<br>Example: contains('bcd', 'abcdef') = true
|contains(find, text)||boolean||Returns true if '''find''' is found in '''text'''.<br>Example: contains('bcd', 'abcdef') = true
|-
|-valign="top"
|copy(text, start[, length])||string||Returns '''length''' letters from letter number '''start''' of '''text'''.<br>Example: copy('abcdefgh', 3, 2) = 'cd'
|copy(text, start[, length])||string||Returns '''length''' letters from letter number '''start''' of '''text'''.<br>Example: copy('abcdefgh', 3, 2) = 'cd'
|-
|-valign="top"
|et(lang)||text||Returns an episode title in '''lang'''. '''lang''' can be either a text or a number.<br>Example: et(2) = japanese title<br>Example: et('en') = english title
|et(lang)||text||Returns an episode title in '''lang'''. '''lang''' can be either a text or a number.<br>Example: et(2) = japanese title<br>Example: et('en') = english title
|-
|-valign="top"
|etr(id, lang)||text||Returns an episode title of episode with '''id''' in '''lang'''. '''lang''' can be either a text or a number.<br>Example: et(2) = japanese title<br>Example: et('en') = english title
|-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'
|-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"
|getanime(name, id)||object||Sets the variable '''name''' to the anime object for '''id'''.<br>Example: getanime('a2', 78)
|-valign="top"
|getepisode(name, id)||object||Sets the variable '''name''' to the episode object for '''id'''.<br>Example: getepisode('e2', 8878)
|-valign="top"
|if(test, trueval[, falseval])||any||If statement, returns '''trueval''' if '''test''' is true, otherwise returns '''falseval'''.<br> Example: if(23=23, 'equal', 'not equal') = 'equal'
|if(test, trueval[, falseval])||any||If statement, returns '''trueval''' if '''test''' is true, otherwise returns '''falseval'''.<br> Example: if(23=23, 'equal', 'not equal') = 'equal'
|-
|-valign="top"
|in(find, text...)||boolean||Checks if '''find''' is present in a number of '''text''' parameters.<br>Example: in('bb', 'aa', 'bb', 'cc', 'dd') = true
|in(find, text...)||boolean||Checks if '''find''' is present in a number of '''text''' parameters.<br>Example: in('bb', 'aa', 'bb', 'cc', 'dd') = true
|-
|-valign="top"
|join(glue, text...)||string||Joins together two or more '''text'''s, empty parameters are ignored with no glue added.<br>Example: join(' ', 'a', 'b', 'c') = 'a b c'
|join(glue, text...)||string||Joins together two or more '''text'''s, empty parameters are ignored with no glue added.<br>Example: join(' ', 'a', 'b', 'c') = 'a b c'
|-
|-valign="top"
|lc(text)||string||Converts '''text''' to lower case.<br>Example: lc('ABCDEF') = 'abcdef'
|lc(text)||string||Converts '''text''' to lower case.<br>Example: lc('ABCDEF') = 'abcdef'
|-
|-valign="top"
|length(text)||number||Returns the length of '''text'''.<br>Example: length('abcdef') = 6
|length(text)||number||Returns the length of '''text'''.<br>Example: length('abcdef') = 6
|-
|-valign="top"
|limit(text, length[, end])||string||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('abcdefghijklmnop', 7, '...') = 'abcd...'
|limit(text, length[, end])||string||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('abcdefghijklmnop', 7, '...') = 'abcd...'
|-
|-valign="top"
|max(number...)||number||Returns the highest supplied number<br>Example: max(1, 7, 3, 9, 2) = 9
|max(number...)||number||Returns the highest supplied number<br>Example: max(1, 7, 3, 9, 2) = 9
|-
|-valign="top"
|min(number...)||number||Returns the lowest supplied number<br>Example: min(1, 7, 3, 9, 2) = 1
|min(number...)||number||Returns the lowest supplied number<br>Example: min(1, 7, 3, 9, 2) = 1
|-
|-valign="top"
|numeric(var)||boolean||Returns true if '''var''' contains a numeric value.<br>Example: numeric('11') = true
|numeric(var)||boolean||Returns true if '''var''' contains a numeric value.<br>Example: numeric('11') = true
|-
|-valign="top"
|pad(text, newlength[, padchar])||string||Pads '''text''' on both sides to make it '''length''' characters long.<br>Example ?pad('hello', 9, '_') = '__hello__'
|pad(text, newlength[, padchar])||string||Pads '''text''' on both sides to make it '''length''' characters long.<br>Example ?pad('hello', 9, '_') = '__hello__'
|-
|-valign="top"
|padl(text, newlength[, padchar])||string||Pads '''text''' on the left side to make it '''length''' characters long.<br>Example ?padl('hello', 9, '_') = '____hello'
|padl(text, newlength[, padchar])||string||Pads '''text''' on the left side to make it '''length''' characters long.<br>Example ?padl('hello', 9, '_') = '____hello'
|-
|-valign="top"
|padr(text, newlength[, padchar])||string||Pads '''text''' on the right side to make it '''length''' characters long.<br>Example ?padr('hello', 9, '_') = 'hello____'
|padr(text, newlength[, padchar])||string||Pads '''text''' on the right side to make it '''length''' characters long.<br>Example ?padr('hello', 9, '_') = 'hello____'
|-
|-valign="top"
|replace(text, find[, replace])||string||Replaces all occurences of '''find''' with '''replace''' in '''text'''.<br>Example: replace('HELLO THERE!', 'THERE', 'TREES') = 'HELLO TREES!'
|replace(text, find[, replace])||string||Replaces all occurences of '''find''' with '''replace''' in '''text'''.<br>Example: replace('HELLO THERE!', 'THERE', 'TREES') = 'HELLO TREES!'
|-
|-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||Removes leading and trailing spaces from '''text'''.
|-
|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!'
|-
|-valign="top"
|set(name, data)||nothing||Declares a new variable called '''name''' containing '''data'''.<br>Example: set('temp', 'text')
|set(name, data)||nothing||Declares a new variable called '''name''' containing '''data'''.<br>Example: set('temp', 'text')
|-
|-valign="top"
|split(text, find, index)||string||Splits '''text''' on '''find''' and returns the specified '''index'''. Index starts from 1.<br>Example: split('2011-05-19', '-', 2) = 05
|split(text, find, index)||string||Splits '''text''' on '''find''' and returns the specified '''index'''. Index starts from 1.<br>Example: split('2011-05-19', '-', 2) = 05
|-
|-valign="top"
|start(text, find)||boolean||Checks if '''find''' matches the start of '''text'''.<br>Example: start('1999', '199') = true
|start(text, find)||boolean||Checks if '''find''' matches the start of '''text'''.<br>Example: start('1999', '199') = true
|-
|-valign="top"
|starti(text, find)||boolean||Checks if '''find''' matches the start of '''text'''. Case insensitive.<br>Example: start('1999', '199') = true
|-valign="top"
|substr(text, start[, length])||string||Alias for copy.
|substr(text, start[, length])||string||Alias for copy.
|-
|-valign="top"
|tc(text)||string||Converts '''text''' to title case.<br>Example: tc('HELLO THERE!') = 'Hello There!'
|tc(text)||string||Converts '''text''' to title case.<br>Example: tc('HELLO THERE!') = 'Hello There!'
|-
|-valign="top"
|trim(text)||string||Removes leading and trailing spaces from '''text'''.
|trim(text)||string||Removes leading and trailing spaces from '''text'''.
|-
|-valign="top"
|uc(text)||string||Converts '''text''' to upper case.<br>Example: uc('abcd') = 'ABCD'
|uc(text)||string||Converts '''text''' to upper case.<br>Example: uc('abcd') = 'ABCD'
|}
|}
Line 457: Line 534:
true<br>
true<br>
false
false
==Comments==
Start a line with // if you wish to write a comment:<br>
<pre>// This is a comment</pre>


==File managers==
==File managers==
File managers are used to automatically manage file renaming / removing and adding / updating files in your MyList.
File managers are used to automatically manage file renaming / removing and adding / updating files in your MyList.
83

edits

Navigation menu

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