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

From AniDB
Jump to navigation Jump to search
Line 112: Line 112:
 
filename
 
filename
 
</pre>
 
</pre>
 +
 +
----

Revision as of 16:19, 25 November 2015

Default pattern

Output: Transliterated anime name - 01v2 - English episode name [s-gn] (CCRCCRCC).ext

set('atitle', at('x-jat'))
if(length(atitle)=0, set('atitle', at('en')))
if(length(atitle)=0, set('atitle', A.Name))
set('atitle', replace(atitle, '\', ' '))
set('etitle', et('en'))
if(length(etitle)=0, set('etitle', et('x-jat')))
if(length(etitle)=0, set('etitle', et('ja')))
if(length(etitle)=0, set('etitle', E.Name))
set('etitle', replace(etitle, '\', ' '))
set('version', if(F.Version>1, 'v'+F.Version, ''))
set('mepno', max(A.TotalEpisodeCount, E.EpisodeTypeCount))
set('epno', padl(E.EpisodeNo, max(1, length(mepno)), '0') + version)
if(E.TypeId=2, set('epno', 'S'+epno))
if(E.TypeId=3, set('epno', 'C'+epno))
if(E.TypeId=4, set('epno', 'T'+epno))
if(E.TypeId=5, set('epno', 'P'+epno))
if(E.TypeId=6, set('epno', 'O'+epno))
set('groupname', if(G, if(length(G.Shortname)>0, G.Shortname, G.Name), 'no group'))
set('groupname', if(length(groupname)>0, '['+groupname+']'))
set('groupname', replace(groupname, '\', ' '))
set('crc', if(H, H.Crc32, F.Crc))
if(length(crc)>0, set('crc', '('+uc(crc)+')'))
set('filename', limit(limit(limit(atitle, 90) + ' - ' + epno + ' - ' + etitle, 200) + ' ' + groupname, 235) + crc + '.' + F.FileType)
set('filename', replace(filename, '*', ' '))
set('filename', replace(filename, '/', ' '))
set('filename', replace(filename, '?', ' '))
set('filename', replace(filename, ':', ' '))
set('filename', replace(filename, '"', ' '))
set('filename', replace(filename, '<', ' '))
set('filename', replace(filename, '>', ' '))
set('filename', replace(filename, '|', ' '))
set('filename', replace(filename, '`', "'"))
set('filename', replace(filename, '  ', ' '))
filename

Sample with subfolders

Output: A\Animename\Animename - 05 [Group][source](CCRCCRCC).mkv

and when you have less than 4 files
Output: A\Animename - S03v2 [Group][source](CCRCCRCC).mkv

and when you watch it for the plot
Output: Hentai\P\Plotname\Plotname - 123 [Group][source](CCRCCRCC).mkv

Warning! You must specify the "Base folder" in Options -> File manager for this to work.

set('atitle', at('x-jat'))
if(length(atitle)=0, set('atitle', at('en')))
if(length(atitle)=0, set('atitle', A.Name))
set('atitle', replace(atitle, '\', ' '))
if(start(atitle, '.'), set('atitle', copy(atitle, 2, length(atitle))))
set('atitle', replace(atitle, '...', ''))
set('atitle', replace(atitle, '1/2', '½'))
set('atitle', trim(atitle))
set('uncensored', (F.State and 64) > 1)
set('censored', (F.State and 128) > 1)

set('etitle', et('en'))
if(length(etitle)=0, set('etitle', et('x-jat')))
if(length(etitle)=0, set('etitle', et('ja')))
if(length(etitle)=0, set('etitle', E.Name))
set('etitle', replace(etitle, '\', ' '))
set('etitle', replace(etitle, '...', ''))
set('etitle', trim(etitle))

set('version', if(F.Version>1, 'v'+F.Version, ''))
set('v2n', version)

if(E.TypeId=1, set('mepno', max(A.TotalEpisodeCount, E.EpisodeTypeCount)))
if(E.TypeId<>1, set('mepno', E.EpisodeTypeCount))
set('epno', padl(E.EpisodeNo, max(1, length(mepno)), '0') + version)
if(E.TypeId=2, set('epno', 'S'+epno))
if(E.TypeId=3, set('epno', 'C'+epno))
if(E.TypeId=4, set('epno', 'T'+epno))
if(E.TypeId=5, set('epno', 'P'+epno))
if(E.TypeId=6, set('epno', 'O'+epno))

set('groupname', if(G, if(length(G.Shortname)>0, G.Shortname, G.Name), 'no group'))
set('groupname', if(length(groupname)>0, '['+groupname+']'))
set('groupname', replace(groupname, '\', ' '))

set('crc', if(H, H.Crc32, F.Crc))
if(length(crc)>0, set('crc', '('+uc(crc)+')'))

set('filename', limit(limit(atitle, 70) + ' - ' + epno + ' ' + groupname, 145) + '[' + F.Source + ']' +crc + '.' + F.FileType)
set('head', copy(atitle, 1, 1))
if(numeric(head) or (head='.'), set('head', '0-9'))
set('head', head+'\')
if ((A.MylistCurrentEpisodeCount + A.MylistSpecialEpisodeCount) > 2, set('head', head + limit(atitle, 80)  + '\'))

// subfolder for plot
set('filename', if(A.Restricted, 'Hentai\') + head + filename)

// remove invalid characters
set('filename', replace(filename, '*', ' '))
set('filename', replace(filename, '/', ' '))
set('filename', replace(filename, '?', ' '))
set('filename', replace(filename, ':', ' '))
set('filename', replace(filename, '"', ' '))
set('filename', replace(filename, '<', ' '))
set('filename', replace(filename, '>', ' '))
set('filename', replace(filename, '|', ' '))
set('filename', replace(filename, '`', "'"))
set('filename', replace(filename, '  ', ' '))

filename