Advertisement
Ashaneil

FileBot Preset1

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