Advertisement
Ashaneil

Filebot Preset 1a

Mar 28th, 2020
1,097
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 4.92 KB | None | 0 0
  1. {ny.colon(' - ').replace('?', '!')}/
  2. {
  3.     def space = call{' '};
  4.     //def dir_root = 'I/Movies/'+
  5.     call{hd.matches(/(?i)SD/) ? '480p-720p/' : ' '}+
  6.     call{hd.matches(/(?i)HD/) ? '720p-1080p/' : ' '}+
  7.     call{hd.matches(/(?i)UHD/) ? '4k/' : ' '};
  8.  
  9.     // Main Title e.g.
  10.     // 1408 (2007) (Director's Cut) 1080p HD Blu-ray non-HDR x264 DTS5.1ch_SiNNERS
  11.     // 300 (2007) 720p HD BRRip non-HDR x265 DTS 5.1ch_ESiR
  12.     // Deadpool (2016) 2160p UHD WEB-DL non-HDR AVC DTS-HD MA 7.1ch_DDR
  13.     // Deadpool 2 (2018) (Super Duper Cut) 2160p UHD Blu-ray REMUX HDR10bit ATEME TrueHD Atmos 13Obj 7.1ch_EPSiLON
  14.         def main_title = call{ny.colon(' - ').replace('?', '!')}+
  15.         space + call{fn.matches(/(?i).+\b25th.+?anniv.+/) ? '(25th Anniv. Edition)' : ' '}+
  16.         space + call{fn.matches(/(?i).+\b\(limited\b.*?\).+/) ? '(Limited Edition)' : ' '}+
  17.         space + call{fn.matches(/(?i).+\b\(uncut\b.*?\).+/) ? '(Uncut)' : ' '}+
  18.         space + call{fn.matches(/(?i).+\bcollector.+?s.+?edition\b.+/) ? '(Collector\'s Edition)' : ' '}+
  19.         space + call{fn.matches(/(?i).+\bdirect.+?cut\b.+/) ? '(Director\'s Cut)' : ' '}+
  20.         space + call{fn.matches(/(?i).+\bextended.+?\b.+/) ? '(Extended)' : ' '}+
  21.         space + call{fn.matches(/(?i).+\bextended.+?edit\b.+/) ? '(Extended Edition)' : ' '}+
  22.         space + call{fn.matches(/(?i).+\bimax\b.+/) ? '(IMAX Edition)' : ' '}+
  23.         space + call{fn.matches(/(?i).+\blimited\b.+/) ? '(Limited)' : ' '}+
  24.         space + call{fn.matches(/(?i).+\bremastered\b.+/) ? '(Remastered)' : ' '}+
  25.         space + call{fn.matches(/(?i).+\bsuper.+duper.+cut\b.+/) ? '(Super Duper Cut)' : ' '}+
  26.         space + call{fn.matches(/(?i).+\btheatrical\b.+/) ? '(Theatrical)' : ' '}+
  27.         space + call{fn.matches(/(?i).+\bunrated\b.+/) ? '(Unrated)' : ' '}+
  28.         space + call{any{fn.match(/\([^\()+?[^\d]+?\)\s*/)} {' '}{' '}}+
  29.  
  30.     ////space + call{hd}+
  31.         space + '['+ call{source.matches(/(?i)blu.*ray/) ? 'BluRay -' : {source} ?: 'WEB-DL -'} +
  32.         space + call{fn.matches(/(?i).+\bremux\b.+/) ? 'REMUX -' : ' '} +
  33.         space + call{fn.matches(/(?i).+\bwebrip\b.+/) ? 'WEBRip -' : ' '} +
  34.         call{self.vf ? self.vf : self.hpi} + ']' +
  35.  
  36.     //Sets the x265/x264 and the bit
  37.         space + '[' +
  38.         //call{vc.matches(/x264/) ? 'x264' : ''} +
  39.         //space + call{vc.matches(/x265/) ? 'x265' : ''} +
  40.         call{vc.matches(/(?i)hevc/) ? 'x265' : ''} +
  41.         space + call{any{vc.match(/x26[45]|hevc/)}{vc}} +
  42.         call{if (bitdepth == 10) '-10bit' else ''} +
  43.         ']'
  44.  
  45.      space + '[' +
  46.         // Call audio
  47.         // Thread here where I got the base code: https://www.filebot.net/forums/viewtopic.php?f=5&t=5285
  48.         call {
  49.         def mCFP =
  50.             [
  51.             'AAC LC SBR PS' : 'AAC',
  52.             'AAC LC SBR' : 'AAC',
  53.             'AAC LC' : 'AAC',
  54.             'AC 3 Dep' : 'E-AC3',
  55.             'AC 3' : 'AC3',
  56.             'DTS 96 24' : 'DTS 96-24',
  57.             'DTS ES XBR' : 'DTS-HD HRA',
  58.             'DTS ES XLL' : 'DTS-HD MA',
  59.             'DTS ES XXCH XBR' : 'DTS-HD HRA',
  60.             'DTS ES XXCH XLL' : 'DTS-HD MA',
  61.             'DTS ES XXCH' : 'DTS-ES',
  62.             'DTS ES' : 'DTS-ES',
  63.             'DTS XBR' : 'DTS-HD HRA',
  64.             'DTS XLL X' : 'DTS X',
  65.             'DTS XLL' : 'DTS-HD MA',
  66.             'DTS' : 'DTS',
  67.             'E AC 3 JOC' : 'EAC3 Atmos',
  68.             'E AC 3' : 'EAC3',
  69.             'MLP FBA 16 ch' : 'TrueHD Atmos',
  70.             'MLP FBA' : 'TrueHD',
  71.             'MP3' : 'MP3',
  72.             'MPEG Audio' : 'MP2',
  73.             'PCM' : 'PCM'
  74.             ];
  75.             def audioClean = {
  76.             it.replaceAll(/[\p{Pd}\p{Space}]/, ' ').replaceAll(/\p{Space}{2,}/, ' ').slash(' ')
  77.         };
  78.             def channelClean = {
  79.             it.replaceAll(/Debug.+|Object\sBased\s?\/?|(\d+)?\sobjects\s\/\s|0.(?=\d.\d)|20/).replaceAll(/6/,'5.1').replaceAll(/8/,'7.1')
  80.         };
  81.             def audioCollection = audio.collect;
  82.             { au ->
  83.             def channels = any{ channelClean(au['ChannelPositionsString2'])}{ channelClean(au['ChannelsOriginal'])}{ channelClean(au['Channels']) };
  84.             def ch = channels.tokenize('\\/').take(3)*.toDouble().inject(0, { a, b -> a + b }).findAll { it > 0 }.max().toString() + 'ch';
  85.             def codec = audioClean(any{ au['CodecID/Hint'] }{ au['Format'] });
  86.             def format_profile = { ( au['Format_AdditionalFeatures'] != null) ? audioClean(au['Format_AdditionalFeatures']) : '' };
  87.             def combined = allOf{codec}{format_profile}.join(' ');
  88.             def stream = allOf { mCFP.get(combined, 'UNKNOWN_FORMAT--'+combined+'--') } { dynChannel } { ch };
  89.             };
  90.             return audioCollection[0].join( ' ' )
  91.     } +
  92.     // Group -- do not want to display group
  93.         //call{any{"$group"}{fn.match(/(?<=[_-])[^\s_-]+?$/)}{''}.replaceAll(/[-_\[\]]\s*|\.\w{3}$/, '')};
  94.     // Language
  95.         call{''};
  96.         def lang = allOf
  97.             {'.'+lang}
  98.             {fn ==~ /(?i).+sdh.+/ ? '_SDH' : null}
  99.             {fn.match(/(?i)\(foreignpartsonly\)/)}
  100.             .join()
  101.  
  102.     // Extension
  103.         def ext = call{'.'+ext};
  104.         // Call all the bindings to create the result
  105.         (
  106.             call(main_title).replace(':', ';') + call(lang)
  107.         ).replaceAll(/null/,'')
  108.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement