Point to external file in GUI ?

Any questions? Need some help?
stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Point to external file in GUI ?

Post by stephen147 » 23 May 2019, 22:13

Would this:

Code: Select all

DriveLetter:\Path\{@"external_format.ext"}
or this:

Code: Select all

{@"external_format.ext"}
currently, be possible at the moment?


E.G. for formatFile

Code: Select all

{@"Z:\Movies & TV\New Downloads\_FileBot Bindings\Format_Movie.groovy"}
E.G. for just path/formatFile

Code: Select all

[*]{@"Z:\Movies & TV\New Downloads\_FileBot Bindings\Format_Movie.groovy"}

User avatar
rednoah
The Source
Posts: 16430
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Point to external file in GUI ?

Post by rednoah » 24 May 2019, 03:13

Unfortunately, the format engine itself currently does not support any kind of @file syntax.
:idea: Please read the FAQ and How to Request Help.

devster
Posts: 332
Joined: 06 Jun 2017, 22:56

Re: Point to external file in GUI ?

Post by devster » 24 May 2019, 08:50

But wouldn't this be possible with normal Groovy code?
Like new File("path/to/file") or similar?
I only work in black and sometimes very, very dark grey. (Batman)

User avatar
rednoah
The Source
Posts: 16430
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Point to external file in GUI ?

Post by rednoah » 24 May 2019, 09:54

I'm not aware of any way that would allow you to execute code from a String within the current script context (i.e. with the same bindings and everything). Though I wouldn't be surprised if there was a way to somehow make it work without any changes to the current code base. :lol:



EDIT:

It's so straight-forward and self-explanatory, I almost feel stupid for not knowing this was working all along. :lol:

Code: Select all

{evaluate('plex.name')}

Code: Select all

{evaluate('/path/to/file.groovy' as File)}
:arrow: http://docs.groovy-lang.org/latest/html ... cript.html

:!: r6394 is required though, since older revisions wouldn't allow dynamic script execution.
:idea: Please read the FAQ and How to Request Help.

devster
Posts: 332
Joined: 06 Jun 2017, 22:56

Re: Point to external file in GUI ?

Post by devster » 24 May 2019, 11:09

Leaving security implications aside, could this be the basis for format templating?

Code: Select all

{evaluate('/path/to/video.groovy' as File)}
{evaluate('/path/to/audio.groovy' as File)}
I only work in black and sometimes very, very dark grey. (Batman)

User avatar
rednoah
The Source
Posts: 16430
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Point to external file in GUI ?

Post by rednoah » 24 May 2019, 11:14

Yep, you can pass in String or File arguments to evaluate() so you can do pretty much anything, dynamically.

e.g. these two can be considered equivalent:

Code: Select all

{plex}

Code: Select all

{evaluate('plex')}
:idea: Please read the FAQ and How to Request Help.

stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: Point to external file in GUI ?

Post by stephen147 » 24 May 2019, 14:16

Code: Select all

{evaluate('Z:/Movies & TV/New Downloads/_FileBot/Format_Movie.groovy' as File)}
Doesn't work this code in the Format_Movie.groovy file.

Code: Select all

{
  //////////////////////////////////////////////
  // MOVIE BINDING
  //////////////////////////////////////////////
  // Posted here: https://www.filebot.net/forums/viewtopic.php?f=4&t=10766&p=43842#p43842
  //////////////////////////////////////////////
  def space = call{' '};
  // Root Directory
  def dir_root = 'Z:\\Movies & TV\\'+
  call{hd.matches(/(?i)SD/) ? '1. SD\\' : ' '}+
  call{hd.matches(/(?i)HD/) ? '2. HD\\' : ' '}+
  call{hd.matches(/(?i)UHD/) ? '3. UHD\\' : ' '};
  // Main Title e.g.
  // 1408 (2007) (Director's Cut) 1080p HD Blu-ray non-HDR x264 DTS5.1ch_SiNNERS
  // 300 (2007) 720p HD BRRip non-HDR x265 DTS 5.1ch_ESiR
  // Deadpool (2016) 2160p UHD WEB-DL non-HDR AVC DTS-HD MA 7.1ch_DDR
  // Deadpool 2 (2018) (Super Duper Cut) 2160p UHD Blu-ray REMUX HDR10bit ATEME TrueHD Atmos 13Obj 7.1ch_EPSiLON
  def main_title = call{n}+
  space + '(' + call{y} + ')'+
  space + call{fn.matches(/(?i).+\b25th.+?anniv.+/) ? '(25th Anniv. Edition)' : ' '}+
  space + call{fn.matches(/(?i).+\b\(limited\b.*?\).+/) ? '(Limited Edition)' : ' '}+
  space + call{fn.matches(/(?i).+\b\(uncut\b.*?\).+/) ? '(Uncut)' : ' '}+
  space + call{fn.matches(/(?i).+\bcollector.+?s.+?edition\b.+/) ? '(Collector\'s Edition)' : ' '}+
  space + call{fn.matches(/(?i).+\bdirect.+?cut\b.+/) ? '(Director\'s Cut)' : ' '}+
  space + call{fn.matches(/(?i).+\bextended.+?\b.+/) ? '(Extended)' : ' '}+
  space + call{fn.matches(/(?i).+\bextended.+?edit\b.+/) ? '(Extended Edition)' : ' '}+
  space + call{fn.matches(/(?i).+\bimax\b.+/) ? '(IMAX Edition)' : ' '}+
  space + call{fn.matches(/(?i).+\blimited\b.+/) ? '(Limited)' : ' '}+
  space + call{fn.matches(/(?i).+\bremastered\b.+/) ? '(Remastered)' : ' '}+
  space + call{fn.matches(/(?i).+\bsuper.+duper.+cut\b.+/) ? '(Super Duper Cut)' : ' '}+
  space + call{fn.matches(/(?i).+\btheatrical\b.+/) ? '(Theatrical)' : ' '}+
  space + call{fn.matches(/(?i).+\bunrated\b.+/) ? '(Unrated)' : ' '}+
  space + call{any{fn.match(/\([^\()+?[^\d]+?\)\s*/)} {' '}{' '}}+
  space + call{self.vf ? self.vf : self.hpi}+
  space + call{hd}+
  space + call{source.matches(/(?i)blu.*ray/) ? 'Blu-ray' : {source} ?: 'WEB-DL'}+
  space + call{fn.matches(/(?i).+\bremux\b.+/) ? 'REMUX' : ' '}+
  // Only calls {hdr} if it's not SD else non-HDR
  space + call{if (hd =~ 'HD') {any{hdr + "-" + bitdepth + 'bit'}{'non-HDR'}}}+
  space + call{vc}+
  space +
  // Call audio
  // Thread here where I got the base code from: https://www.filebot.net/forums/viewtopic.php?f=5&t=5285
  call {
    def mCFP =
    [
    'AAC LC SBR PS' : 'AAC',
    'AAC LC SBR' : 'AAC',
    'AAC LC' : 'AAC',
    'AC 3 Dep' : 'E-AC3',
    'AC 3' : 'AC3',
    'DTS 96 24' : 'DTS 96-24',
    'DTS ES XBR' : 'DTS-HD HRA',
    'DTS ES XLL' : 'DTS-HD MA',
    'DTS ES XXCH XBR' : 'DTS-HD HRA',
    'DTS ES XXCH XLL' : 'DTS-HD MA',
    'DTS ES XXCH' : 'DTS-ES',
    'DTS ES' : 'DTS-ES',
    'DTS XBR' : 'DTS-HD HRA',
    'DTS XLL X' : 'DTS X',
    'DTS XLL' : 'DTS-HD MA',
    'DTS' : 'DTS',
    'E AC 3 JOC' : 'EAC3 Atmos',
    'E AC 3' : 'EAC3',
    'MLP FBA 16 ch' : 'TrueHD Atmos',
    'MLP FBA' : 'TrueHD',
    'MP3' : 'MP3',
    'MPEG Audio' : 'MP2',
    'PCM' : 'PCM'
    ];
    def audioClean = { it.replaceAll(/[\p{Pd}\p{Space}]/, ' ').replaceAll(/\p{Space}{2,}/, ' ').slash(' ') };
    def channelClean = { it.replaceAll(/Debug.+|Object\sBased\s?\/?|(\d+)?\sobjects\s\/\s|0.(?=\d.\d)|20/).replaceAll(/6/,'5.1').replaceAll(/8/,'7.1') };
    def audioCollection = audio.collect
    { au ->
      def channels = any{ channelClean(au['ChannelPositionsString2'])}{ channelClean(au['ChannelsOriginal'])}{ channelClean(au['Channels']) };
      def dynChannel = {au['NumberOfDynamicObjects'] + 'Obj'};
      def ch = channels.tokenize('\\/').take(3)*.toDouble().inject(0, { a, b -> a + b }).findAll { it > 0 }.max().toString() + 'ch';
      def codec = audioClean(any{ au['CodecID/Hint'] }{ au['Format'] });
      def format_profile = { ( au['Format_AdditionalFeatures'] != null) ? audioClean(au['Format_AdditionalFeatures']) : '' };
      def combined = allOf{codec}{format_profile}.join(' ');
      def stream = allOf { mCFP.get(combined, 'UNKNOWN_FORMAT--'+combined+'--') } { dynChannel } { ch };
    };
    return audioCollection[0].join( ' ' )
    } +
    '_'+
    // Group
    call{ any{ fn.match(/(?<=[_-])[^\s_-]+?$/)} {group} {'_NA'} };
    // Language
    def lang = call{ any{'.'+subt} + {fn.matches(/(?i).+sdh.+/) ? '_SDH' : ''} {any{fn.match(/(?i)\(foreignpartsonly\)/)} '' } };
    // Extension
    // def ext = call{'.'+ext};
    // call all the bindings to create the result
    // call(dir_root) +
    (call(main_title).replace(':', ';').replace('*', '') + call(lang)).replaceAll(/null/,'')
  }
:!: This is the error

Code: Select all

Expression yields empty value: startup failed:
Z:\Movies & TV\New Downloads\_FileBot\Format_Movie_Test.groovy: 1: Ambiguous expression could be either a parameterless closure expression or an isolated open code block;
   solution: Add an explicit closure parameter list, e.g. {it -> ...}, or force it to be treated as an open block by giving it a label, e.g. L:{...} @ line 1, column 1.

User avatar
rednoah
The Source
Posts: 16430
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Point to external file in GUI ?

Post by rednoah » 24 May 2019, 15:40

Keep in mind that we're evaluating Groovy code, not FileBot Format Expression code.

:arrow: You need to get rid of the outer {...} because Groovy code only starts within the outer {...}.

YES:

Code: Select all

plex
NO:

Code: Select all

{plex}
By evaluating the Groovy code {plex} and not plex, you're effectively doing this, which of course doesn't work:

Code: Select all

{{plex}}
:idea: Please read the FAQ and How to Request Help.

stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: Point to external file in GUI ?

Post by stephen147 » 24 May 2019, 17:43

It is possible on a basic level

This works:

Code: Select all

{call(evaluate('Z:/Movies & TV/New Downloads/_FileBot/Format_Movie_Test.groovy' as File))}
With groovy file:

Code: Select all

  (
  {n}
  )
Just need to get it working with my more complex format.

:?: Would it be even possible before I torture myself? :lol:

:!: BUT, there's a lot of call() fn inside that code. Not sure how this will fair!

SCRAP that last thing.

I want the external file to be interchangeable between the GUI and the CLI.

User avatar
rednoah
The Source
Posts: 16430
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Point to external file in GUI ?

Post by rednoah » 24 May 2019, 18:06

I sense that you still don't truly understand the difference between FileBot Format Expression Code and Groovy Code.


1.
This is a FileBot Format Expression:

Code: Select all

A/{"Groovy Code " +1}/{"Groovy Code " +2}
It consists of 4 parts:
* Literal: A/
* Code: "Groovy Code " +1
* Literal: /
* Code: "Groovy Code " +2


2.
Here's example for Groovy Code:

Code: Select all

"Groovy Code " +1
Simple code like accessing a variable is no more or less Groovy Code:

Code: Select all

n
Notably, {...} is used in the Groovy Language for code blocks and closures.


3.
Consider a FileBot Format Expression such as this:

Code: Select all

{allOf{x}{y}{z}}
The outer {...} is FileBot Format Expression logic, and whatever is inside is Groovy logic, i.e. completely different even though it looks similar:

Code: Select all

allOf{x}{y}{z}
Looking at the Groovy code, it's just a more elegant way of writing this:

Code: Select all

Closure functionX = { x }
Closure functionY = { y }
Closure functionZ = { z }
allOf(functionX, functionY, functionZ)


EDIT:

:!: It does seem that global functions like allOf(Closure...) and call(Closure) are not available in the context sub-scripts. IDK. Not ideal. Probably not easy to fix scripts that rely on those.

Adding this to the top of your script should do the trick:

Code: Select all

import static net.filebot.format.ExpressionFormatFunctions.*

EDIT 2:

Fixed with r6395.
:idea: Please read the FAQ and How to Request Help.

devster
Posts: 332
Joined: 06 Jun 2017, 22:56

Re: Point to external file in GUI ?

Post by devster » 24 May 2019, 18:33

On MacOS the fix (import) seems to work, r6224.
I only work in black and sometimes very, very dark grey. (Batman)

devster
Posts: 332
Joined: 06 Jun 2017, 22:56

Re: Point to external file in GUI ?

Post by devster » 24 May 2019, 18:36

@stephen147
try the below:

Code: Select all

import static net.filebot.format.ExpressionFormatFunctions.*

	//////////////////////////////////////////////
	// MOVIE BINDING
	//////////////////////////////////////////////
	// Posted here: https://www.filebot.net/forums/viewtopic.php?f=4&t=10766&p=43842#p43842
	//////////////////////////////////////////////
	String space = ' '
	// Root Directory
	def dir_root = allOf
		{ 'Z:\\Movies & TV\\' }
		{ if (hd.matches(/(?i)SD/)) '1. SD\\' }
		{ if (hd.matches(/(?i)HD/)) '2. HD\\' }
		{ if (hd.matches(/(?i)UHD/)) '3. UHD\\' }
		.join(' ')
	// Main Title e.g.
	// 1408 (2007) (Director's Cut) 1080p HD Blu-ray non-HDR x264 DTS5.1ch_SiNNERS
	// 300 (2007) 720p HD BRRip non-HDR x265 DTS 5.1ch_ESiR
	// Deadpool (2016) 2160p UHD WEB-DL non-HDR AVC DTS-HD MA 7.1ch_DDR
	// Deadpool 2 (2018) (Super Duper Cut) 2160p UHD Blu-ray REMUX HDR10bit ATEME TrueHD Atmos 13Obj 7.1ch_EPSiLON
	def main_title = allOf
		{n}
		{ '(' + y + ')' }
		{ fn.matches(/(?i).+\b25th.+?anniv.+/) '(25th Anniv. Edition)' }
		{ fn.matches(/(?i).+\b\(limited\b.*?\).+/) '(Limited Edition)' }
		{ fn.matches(/(?i).+\b\(uncut\b.*?\).+/) '(Uncut)' }
		{ fn.matches(/(?i).+\bcollector.+?s.+?edition\b.+/) '(Collector\'s Edition)' }
		{ fn.matches(/(?i).+\bdirect.+?cut\b.+/) '(Director\'s Cut)' }
		{ fn.matches(/(?i).+\bextended.+?\b.+/) '(Extended)' }
		{ fn.matches(/(?i).+\bextended.+?edit\b.+/) '(Extended Edition)' }
		{ fn.matches(/(?i).+\bimax\b.+/) '(IMAX Edition)' }
		{ fn.matches(/(?i).+\blimited\b.+/) '(Limited)' }
		{ fn.matches(/(?i).+\bremastered\b.+/) '(Remastered)' }
		{ fn.matches(/(?i).+\bsuper.+duper.+cut\b.+/) '(Super Duper Cut)' }
		{ fn.matches(/(?i).+\btheatrical\b.+/) '(Theatrical)' }
		{ fn.matches(/(?i).+\bunrated\b.+/) '(Unrated)' }
		{ any{fn.match(/\([^\()+?[^\d]+?\)\s*/)}{'  '}}
		{ self.vf ? self.vf : self.hpi }
		{ hd }
		{ source.matches(/(?i)blu.*ray/) ? 'Blu-ray' : {source} ?: 'WEB-DL'}
		{ fn.matches(/(?i).+\bremux\b.+/) 'REMUX' }
		// Only calls {hdr} if it's not SD else non-HDR
		{ if (hd =~ 'HD') any{ hdr + "-" + bitdepth + 'bit'}{'non-HDR'}}
		{ vc }
		// Call audio
		// Thread here where I got the base code from: https://www.filebot.net/forums/viewtopic.php?f=5&t=5285
		{
			def mCFP =
			[
				'AAC LC SBR PS' : 'AAC',
				'AAC LC SBR' : 'AAC',
				'AAC LC' : 'AAC',
				'AC 3 Dep' : 'E-AC3',
				'AC 3' : 'AC3',
				'DTS 96 24' : 'DTS 96-24',
				'DTS ES XBR' : 'DTS-HD HRA',
				'DTS ES XLL' : 'DTS-HD MA',
				'DTS ES XXCH XBR' : 'DTS-HD HRA',
				'DTS ES XXCH XLL' : 'DTS-HD MA',
				'DTS ES XXCH' : 'DTS-ES',
				'DTS ES' : 'DTS-ES',
				'DTS XBR' : 'DTS-HD HRA',
				'DTS XLL X' : 'DTS X',
				'DTS XLL' : 'DTS-HD MA',
				'DTS' : 'DTS',
				'E AC 3 JOC' : 'EAC3 Atmos',
				'E AC 3' : 'EAC3',
				'MLP FBA 16 ch' : 'TrueHD Atmos',
				'MLP FBA' : 'TrueHD',
				'MP3' : 'MP3',
				'MPEG Audio' : 'MP2',
				'PCM' : 'PCM'
			]
			def audioClean = { it.replaceAll(/[\p{Pd}\p{Space}]/, ' ').replaceAll(/\p{Space}{2,}/, ' ').slash(' ') }
			def channelClean = { it.replaceAll(/Debug.+|Object\sBased\s?\/?|(\d+)?\sobjects\s\/\s|0.(?=\d.\d)|20/).replaceAll(/6/,'5.1').replaceAll(/8/,'7.1') }
			def audioCollection = audio.collect{ au ->
				def channels = any{ channelClean(au['ChannelPositionsString2'])}{ channelClean(au['ChannelsOriginal'])}{ channelClean(au['Channels']) }
				def dynChannel = {au['NumberOfDynamicObjects'] + 'Obj'}
				def ch = channels.tokenize('\\/').take(3)*.toDouble().inject(0, { a, b -> a + b }).findAll { it > 0 }.max().toString() + 'ch'
				def codec = audioClean(any{ au['CodecID/Hint'] }{ au['Format'] })
				def format_profile = { ( au['Format_AdditionalFeatures'] != null) ? audioClean(au['Format_AdditionalFeatures']) : '' }
				def combined = allOf{codec}{format_profile}.join(' ')
				def stream = allOf{ mCFP.get(combined, 'UNKNOWN_FORMAT--'+combined+'--') }{ dynChannel }{ ch }
			}
			audioCollection[0].join( ' ' )
		}
		{ '_' }
		// Group
		{ any{ fn.match(/(?<=[_-])[^\s_-]+?$/)} {group} {'_NA'} }
		.join(space)
	// Language
	def lang = any
		{'.' + subt + fn.matches(/(?i).+sdh.+/) ? '_SDH' : ''}
		{any{fn.match(/(?i)\(foreignpartsonly\)/)} '' }
	allOf{main_title.replace(':', ';').replace('*', '')}{lang}.join('').replaceAll(/null/,'')
I only work in black and sometimes very, very dark grey. (Batman)

stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: Point to external file in GUI ?

Post by stephen147 » 24 May 2019, 18:56

devster wrote:
24 May 2019, 18:36
@stephen147
Thanks for this. That's great but I was looking for a way to use my existing code and just call a function to parse the text of it into the GUI.

Seeing as it both works in the CLI and GUI I thought it would be easy enough to make work via my first post here.

devster
Posts: 332
Joined: 06 Jun 2017, 22:56

Re: Point to external file in GUI ?

Post by devster » 24 May 2019, 19:03

the script I posted is just a conversion of yours without some call{}. In my mac it works both in GUI and CLI using

Code: Select all

{evaluate("file.groovy" as File)}
I only work in black and sometimes very, very dark grey. (Batman)

stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: Point to external file in GUI ?

Post by stephen147 » 24 May 2019, 19:12

Sorry, I don't think you understand.

My format code viewtopic.php?p=44253#p44242 can be pasted directly into the GUI and it also works using the CLI.

What I was after was a solution to point to that file in the GUI.

Maybe @rednoah miss understood also.

User avatar
rednoah
The Source
Posts: 16430
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Point to external file in GUI ?

Post by rednoah » 24 May 2019, 19:34

1.
The GUI indeed does indeed not support just pointing to an external file. This has not changed.


2.
We have discovered a new way to load Groovy code within Groovy expressions, which closely related to what you're asking for, but not exactly that.

GUI:

Code: Select all

{evaluate('file.groovy' as File)}
CLI:

Code: Select all

--format "{evaluate('file.groovy' as File)}"
So we have a format, which itself loads and evaluates code from a file. So you can't just give the GUI a file path to use as format, but you can paste a format which further delegates to some file. So you can achieve your goal of having a single script shared by both CLI and GUI.
:idea: Please read the FAQ and How to Request Help.

stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: Point to external file in GUI ?

Post by stephen147 » 24 May 2019, 20:18

1. Right so... as long as we're clear now.

Perhaps some sort of new addition for my use-case ?

No worries if not.

User avatar
rednoah
The Source
Posts: 16430
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Point to external file in GUI ?

Post by rednoah » 24 May 2019, 20:46

Not planned for now. There's already too many ways to do almost same thing via different angles.
:idea: Please read the FAQ and How to Request Help.

stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: Point to external file in GUI ?

Post by stephen147 » 24 May 2019, 21:11

Okay. If you do find the time to allow some basic switches like --format in the GUI then that would be great (if possible).

User avatar
rednoah
The Source
Posts: 16430
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Point to external file in GUI ?

Post by rednoah » 25 May 2019, 04:25

1.
stephen147 wrote:
24 May 2019, 21:11
Okay. If you do find the time to allow some basic switches like --format in the GUI then that would be great (if possible).
I don't understand. The Edit Format is the equivalent of the --format option.


2.
If you just want a script that modifies the FileBot GUI settings before running the GUI, then you can write a script for that:

Code: Select all

_def.each{ k, v -> 
  java.util.prefs.Preferences.userRoot().node('net/filebot/ui/rename').put(k, v) 
}
Usage:

Code: Select all

filebot -script /path/to/PutPreferences.groovy --def [email protected]/path/to/SeriesFormat.groovy [email protected]/path/to/MovieFormat.groovy
Test:

Code: Select all

filebot -script fn:preferences

3.
What so unsatisfactory about this solution though?
viewtopic.php?f=8&t=10837&p=44261#p44256

Just copy these simple formats that just delegate to your file in both CLI and GUI, and henceforth you never ever need to look at anything but your file. Since you're already using a single-expression-just-groovy-code style format, it'll work perfectly for you.
:idea: Please read the FAQ and How to Request Help.

stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: Point to external file in GUI ?

Post by stephen147 » 25 May 2019, 15:46

2. It's not updating the GUI. I've not had it running while running this below:

Code: Select all

filebot -script /path/to/PutPreferences.groovy --def [email protected]/path/to/SeriesFormat.groovy [email protected]/path/to/MovieFormat.groovy
OUTPUT:

Code: Select all

Z:\Movies & TV\New Downloads\_FileBot>filebot -script fn:preferences
Print User Preference Node: /
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE preferences SYSTEM "http://java.sun.com/dtd/preferences.dtd">
<preferences EXTERNAL_XML_VERSION="1.0">
  <root type="user">
    <map/>
    <node name="net">
      <map/>
      <node name="filebot">
        <map>
          <entry key="getting.started" value="1"/>
          <entry key="dialog.open.folder" value="Z:\Movies &amp; TV\3. UHD"/>
        </map>
        <node name="ui">
          <map>
            <entry key="window.width" value="2115"/>
            <entry key="window.height" value="755"/>
            <entry key="window.x" value="155"/>
            <entry key="window.y" value="2"/>
            <entry key="panel.selected" value="0"/>
          </map>
          <node name="rename">
            <map>
              <entry key="rename.format.movie" value="{&#13;&#10;  //////////////////////////////////////////////&#13;&#10;  // MOVIE BINDING&#13;&#10;  //////////////////////////////////////////////&#13;&#10;  // Posted here: https://www.filebot.net/forums/viewtopic.php?f=4&amp;t=10766&amp;p=43842#p43842&#13;&#10;  //////////////////////////////////////////////&#13;&#10;  def space = call{' '};&#13;&#10;  // Root Directory&#13;&#10;  def dir_root = 'Z:\\Movies &amp; TV\\'+&#13;&#10;  call{hd.matches(/(?i)SD/) ? '1. SD\\' : ' '}+&#13;&#10;  call{hd.matches(/(?i)HD/) ? '2. HD\\' : ' '}+&#13;&#10;  call{hd.matches(/(?i)UHD/) ? '3. UHD\\' : ' '};&#13;&#10;  // Main Title e.g.&#13;&#10;  // 1408 (2007) (Director's Cut) 1080p HD Blu-ray non-HDR x264 DTS5.1ch_SiNNERS&#13;&#10;  // 300 (2007) 720p HD BRRip non-HDR x265 DTS 5.1ch_ESiR&#13;&#10;  // Deadpool (2016) 2160p UHD WEB-DL non-HDR AVC DTS-HD MA 7.1ch_DDR&#13;&#10;  // Deadpool 2 (2018) (Super Duper Cut) 2160p UHD Blu-ray REMUX HDR10bit ATEME TrueHD Atmos 13Obj 7.1ch_EPSiLON&#13;&#10;  def main_title = call{n}+&#13;&#10;  space + '(' + call{y} + ')'+&#13;&#10;  space + call{fn.matches(/(?i).+\b25th.+?anniv.+/) ? '(25th Anniv. Edition)' : ' '}+&#13;&#10;  space + call{fn.matches(/(?i).+\b\(limited\b.*?\).+/) ? '(Limited Edition)' : ' '}+&#13;&#10;  space + call{fn.matches(/(?i).+\b\(uncut\b.*?\).+/) ? '(Uncut)' : ' '}+&#13;&#10;  space + call{fn.matches(/(?i).+\bcollector.+?s.+?edition\b.+/) ? '(Collector\'s Edition)' : ' '}+&#13;&#10;  space + call{fn.matches(/(?i).+\bdirect.+?cut\b.+/) ? '(Director\'s Cut)' : ' '}+&#13;&#10;  space + call{fn.matches(/(?i).+\bextended.+?\b.+/) ? '(Extended)' : ' '}+&#13;&#10;  space + call{fn.matches(/(?i).+\bextended.+?edit\b.+/) ? '(Extended Edition)' : ' '}+&#13;&#10;  space + call{fn.matches(/(?i).+\bimax\b.+/) ? '(IMAX Edition)' : ' '}+&#13;&#10;  space + call{fn.matches(/(?i).+\blimited\b.+/) ? '(Limited)' : ' '}+&#13;&#10;  space + call{fn.matches(/(?i).+\bremastered\b.+/) ? '(Remastered)' : ' '}+&#13;&#10;  space + call{fn.matches(/(?i).+\bsuper.+duper.+cut\b.+/) ? '(Super Duper Cut)' : ' '}+&#13;&#10;  space + call{fn.matches(/(?i).+\btheatrical\b.+/) ? '(Theatrical)' : ' '}+&#13;&#10;  space + call{fn.matches(/(?i).+\bunrated\b.+/) ? '(Unrated)' : ' '}+&#13;&#10;  space + call{any{fn.match(/\([^\()+?[^\d]+?\)\s*/)} {' '}{' '}}+&#13;&#10;  space + call{self.vf ? self.vf : self.hpi}+&#13;&#10;  space + call{hd}+&#13;&#10;  space + call{source.matches(/(?i)blu.*ray/) ? 'Blu-ray' : {source} ?: 'WEB-DL'}+&#13;&#10;  space + call{fn.matches(/(?i).+\bremux\b.+/) ? 'REMUX' : ' '}+&#13;&#10;  // Only calls {hdr} if it's not SD else non-HDR&#13;&#10;  space + call{if (hd =~ 'HD') {any{hdr + &quot;-&quot; + bitdepth + 'bit'}{'non-HDR'}}}+&#13;&#10;  space + call{vc}+&#13;&#10;  space +&#13;&#10;  // Call audio&#13;&#10;  // Thread here where I got the base code from: https://www.filebot.net/forums/viewtopic.php?f=5&amp;t=5285&#13;&#10;  call {&#13;&#10;    def mCFP =&#13;&#10;    [&#13;&#10;    'AAC LC SBR PS' : 'AAC',&#13;&#10;    'AAC LC SBR' : 'AAC',&#13;&#10;    'AAC LC' : 'AAC',&#13;&#10;    'AC 3 Dep' : 'E-AC3',&#13;&#10;    'AC 3' : 'AC3',&#13;&#10;    'DTS 96 24' : 'DTS 96-24',&#13;&#10;    'DTS ES XBR' : 'DTS-HD HRA',&#13;&#10;    'DTS ES XLL' : 'DTS-HD MA',&#13;&#10;    'DTS ES XXCH XBR' : 'DTS-HD HRA',&#13;&#10;    'DTS ES XXCH XLL' : 'DTS-HD MA',&#13;&#10;    'DTS ES XXCH' : 'DTS-ES',&#13;&#10;    'DTS ES' : 'DTS-ES',&#13;&#10;    'DTS XBR' : 'DTS-HD HRA',&#13;&#10;    'DTS XLL X' : 'DTS X',&#13;&#10;    'DTS XLL' : 'DTS-HD MA',&#13;&#10;    'DTS' : 'DTS',&#13;&#10;    'E AC 3 JOC' : 'EAC3 Atmos',&#13;&#10;    'E AC 3' : 'EAC3',&#13;&#10;    'MLP FBA 16 ch' : 'TrueHD Atmos',&#13;&#10;    'MLP FBA' : 'TrueHD',&#13;&#10;    'MP3' : 'MP3',&#13;&#10;    'MPEG Audio' : 'MP2',&#13;&#10;    'PCM' : 'PCM'&#13;&#10;    ];&#13;&#10;    def audioClean = { it.replaceAll(/[\p{Pd}\p{Space}]/, ' ').replaceAll(/\p{Space}{2,}/, ' ').slash(' ') };&#13;&#10;    def channelClean = { it.replaceAll(/Debug.+|Object\sBased\s?\/?|(\d+)?\sobjects\s\/\s|0.(?=\d.\d)|20/).replaceAll(/6/,'5.1').replaceAll(/8/,'7.1') };&#13;&#10;    def audioCollection = audio.collect&#13;&#10;    { au -&gt;&#13;&#10;      def channels = any{ channelClean(au['ChannelPositionsString2'])}{ channelClean(au['ChannelsOriginal'])}{ channelClean(au['Channels']) };&#13;&#10;      def dynChannel = {au['NumberOfDynamicObjects'] + 'Obj'};&#13;&#10;      def ch = channels.tokenize('\\/').take(3)*.toDouble().inject(0, { a, b -&gt; a + b }).findAll { it &gt; 0 }.max().toString() + 'ch';&#13;&#10;      def codec = audioClean(any{ au['CodecID/Hint'] }{ au['Format'] });&#13;&#10;      def format_profile = { ( au['Format_AdditionalFeatures'] != null) ? audioClean(au['Format_AdditionalFeatures']) : '' };&#13;&#10;      def combined = allOf{codec}{format_profile}.join(' ');&#13;&#10;      def stream = allOf { mCFP.get(combined, 'UNKNOWN_FORMAT--'+combined+'--') } { dynChannel } { ch };&#13;&#10;    };&#13;&#10;    return audioCollection[0].join( ' ' )&#13;&#10;    } +&#13;&#10;    '_'+&#13;&#10;    // Group&#13;&#10;    call{ any{ fn.match(/(?&lt;=[_-])[^\s_-]+?$/)} {group} {'_NA'} };&#13;&#10;    // Language&#13;&#10;    def lang = call{ any{'.'+subt} + {fn.matches(/(?i).+sdh.+/) ? '_SDH' : ''} {any{fn.match(/(?i)\(foreignpartsonly\)/)} '' } };&#13;&#10;    // Extension&#13;&#10;    // def ext = call{'.'+ext};&#13;&#10;    // call all the bindings to create the result&#13;&#10;    // call(dir_root) +&#13;&#10;    (call(main_title).replace(':', ';').replace('*', '') + call(lang)).replaceAll(/null/,'')&#13;&#10;  }"/>
              <entry key="rename.last.format.state" value="Movie"/>
              <entry key="dialog.select.width" value="979"/>
              <entry key="dialog.select.height" value="380"/>
              <entry key="dialog.select.repeat" value="false"/>
              <entry key="rename.format.episode" value="//////////////////////////////////////////////&#13;&#10;// TV BINDING&#13;&#10;//////////////////////////////////////////////&#13;&#10;Z:/Movies &amp; TV/TV/{n.replace(':','-').replaceAll(/[\/:*?&quot;&lt;&gt;|]/,' - ')}/{n.replace(':','-').replaceAll(/[\/:*?&quot;&lt;&gt;|]/,' - ')}&#13;&#10;({any{self.d}{'0000-00-00'}})&#13;&#10;[{info.network}]&#13;&#10;{episode.special ? 'S00E'+special.pad(2) : s00e00}&#13;&#10;{t.after(/^[.]+/).replace(':','-').replaceAll(/[\/:*?&quot;&lt;&gt;|]/,' - ')}&#13;&#10;{self.vf ? self.vf + &quot;&quot; : self.hpi}&#13;&#10;{fn.matches(/(?i).+\bAMZN\b.+/) ? &quot;AMZN&quot; : &quot;&quot;}&#13;&#10;{&quot;${self.source ?: 'NA'}&quot;}&#13;&#10;{ac}&#13;&#10;{audio[0].channels.replaceAll(/2/, &quot;2ch&quot;).replaceAll(/6/, &quot;5.1ch&quot;)}    {vc}_{any{&quot;$group&quot;}{fn.match(/(?&lt;=[_-])[^\s_-]+?$/)}{'NA'}.replaceAll(/[-_\[\]]\s*|\.\w{3}$/, &quot;&quot;)}{any{'.'+lang}{lang}}{any{fn.match(/(?i)sdh.+?/)('')}{fn.match(/(?i).*sdh.*/)('_SDH')}}{any{fn.match(/(?i)\(foreignpartsonly\)/)}{''}}{&quot;.&quot;+ext}"/>
            </map>
            <node name="format.recent.movie">
              <map>
                <entry key="0" value="{evaluate('Z:/Movies &amp; TV/New Downloads/_FileBot/Format_Movie_Test.groovy' as File)}"/>
                <entry key="1" value="{&#10;  //////////////////////////////////////////////&#10;  // MOVIE BINDING&#10;  //////////////////////////////////////////////&#10;  // Posted here: https://www.filebot.net/forums/viewtopic.php?f=4&amp;t=10766&amp;p=43842#p43842&#10;  //////////////////////////////////////////////&#10;  def space = call{' '};&#10;  // Root Directory&#10;  def dir_root = 'Z:\\Movies &amp; TV\\'+&#10;  call{hd.matches(/(?i)SD/) ? '1. SD\\' : ' '}+&#10;  call{hd.matches(/(?i)HD/) ? '2. HD\\' : ' '}+&#10;  call{hd.matches(/(?i)UHD/) ? '3. UHD\\' : ' '};&#10;  // Main Title e.g.&#10;  // 1408 (2007) (Director's Cut) 1080p HD Blu-ray non-HDR x264 DTS5.1ch_SiNNERS&#10;  // 300 (2007) 720p HD BRRip non-HDR x265 DTS 5.1ch_ESiR&#10;  // Deadpool (2016) 2160p UHD WEB-DL non-HDR AVC DTS-HD MA 7.1ch_DDR&#10;  // Deadpool 2 (2018) (Super Duper Cut) 2160p UHD Blu-ray REMUX HDR10bit ATEME TrueHD Atmos 13Obj 7.1ch_EPSiLON&#10;  def main_title = call{n}+&#10;  space + '(' + call{y} + ')'+&#10;  space + call{fn.matches(/(?i).+\b25th.+?anniv.+/) ? '(25th Anniv. Edition)' : ' '}+&#10;  space + call{fn.matches(/(?i).+\b\(limited\b.*?\).+/) ? '(Limited Edition)' : ' '}+&#10;  space + call{fn.matches(/(?i).+\b\(uncut\b.*?\).+/) ? '(Uncut)' : ' '}+&#10;  space + call{fn.matches(/(?i).+\bcollector.+?s.+?edition\b.+/) ? '(Collector\'s Edition)' : ' '}+&#10;  space + call{fn.matches(/(?i).+\bdirect.+?cut\b.+/) ? '(Director\'s Cut)' : ' '}+&#10;  space + call{fn.matches(/(?i).+\bextended.+?\b.+/) ? '(Extended)' : ' '}+&#10;  space + call{fn.matches(/(?i).+\bextended.+?edit\b.+/) ? '(Extended Edition)' : ' '}+&#10;  space + call{fn.matches(/(?i).+\bimax\b.+/) ? '(IMAX Edition)' : ' '}+&#10;  space + call{fn.matches(/(?i).+\blimited\b.+/) ? '(Limited)' : ' '}+&#10;  space + call{fn.matches(/(?i).+\bremastered\b.+/) ? '(Remastered)' : ' '}+&#10;  space + call{fn.matches(/(?i).+\bsuper.+duper.+cut\b.+/) ? '(Super Duper Cut)' : ' '}+&#10;  space + call{fn.matches(/(?i).+\btheatrical\b.+/) ? '(Theatrical)' : ' '}+&#10;  space + call{fn.matches(/(?i).+\bunrated\b.+/) ? '(Unrated)' : ' '}+&#10;  space + call{any{fn.match(/\([^\()+?[^\d]+?\)\s*/)} {' '}{' '}}+&#10;  space + call{self.vf ? self.vf : self.hpi}+&#10;  space + call{hd}+&#10;  space + call{source.matches(/(?i)blu.*ray/) ? 'Blu-ray' : {source} ?: 'WEB-DL'}+&#10;  space + call{fn.matches(/(?i).+\bremux\b.+/) ? 'REMUX' : ' '}+&#10;  // Only calls {hdr} if it's not SD else non-HDR&#10;  space + call{if (hd =~ 'HD') {any{hdr + &quot;-&quot; + bitdepth + 'bit'}{'non-HDR'}}}+&#10;  space + call{vc}+&#10;  space +&#10;  // Call audio&#10;  // Thread here where I got the base code from: https://www.filebot.net/forums/viewtopic.php?f=5&amp;t=5285&#10;  call {&#10;    def mCFP =&#10;    [&#10;    'AAC LC SBR PS' : 'AAC',&#10;    'AAC LC SBR' : 'AAC',&#10;    'AAC LC' : 'AAC',&#10;    'AC 3 Dep' : 'E-AC3',&#10;    'AC 3' : 'AC3',&#10;    'DTS 96 24' : 'DTS 96-24',&#10;    'DTS ES XBR' : 'DTS-HD HRA',&#10;    'DTS ES XLL' : 'DTS-HD MA',&#10;    'DTS ES XXCH XBR' : 'DTS-HD HRA',&#10;    'DTS ES XXCH XLL' : 'DTS-HD MA',&#10;    'DTS ES XXCH' : 'DTS-ES',&#10;    'DTS ES' : 'DTS-ES',&#10;    'DTS XBR' : 'DTS-HD HRA',&#10;    'DTS XLL X' : 'DTS X',&#10;    'DTS XLL' : 'DTS-HD MA',&#10;    'DTS' : 'DTS',&#10;    'E AC 3 JOC' : 'EAC3 Atmos',&#10;    'E AC 3' : 'EAC3',&#10;    'MLP FBA 16 ch' : 'TrueHD Atmos',&#10;    'MLP FBA' : 'TrueHD',&#10;    'MP3' : 'MP3',&#10;    'MPEG Audio' : 'MP2',&#10;    'PCM' : 'PCM'&#10;    ];&#10;    def audioClean = { it.replaceAll(/[\p{Pd}\p{Space}]/, ' ').replaceAll(/\p{Space}{2,}/, ' ').slash(' ') };&#10;    def channelClean = { it.replaceAll(/Debug.+|Object\sBased\s?\/?|(\d+)?\sobjects\s\/\s|0.(?=\d.\d)|20/).replaceAll(/6/,'5.1').replaceAll(/8/,'7.1') };&#10;    def audioCollection = audio.collect&#10;    { au -&gt;&#10;      def channels = any{ channelClean(au['ChannelPositionsString2'])}{ channelClean(au['ChannelsOriginal'])}{ channelClean(au['Channels']) };&#10;      def dynChannel = {au['NumberOfDynamicObjects'] + 'Obj'};&#10;      def ch = channels.tokenize('\\/').take(3)*.toDouble().inject(0, { a, b -&gt; a + b }).findAll { it &gt; 0 }.max().toString() + 'ch';&#10;      def codec = audioClean(any{ au['CodecID/Hint'] }{ au['Format'] });&#10;      def format_profile = { ( au['Format_AdditionalFeatures'] != null) ? audioClean(au['Format_AdditionalFeatures']) : '' };&#10;      def combined = allOf{codec}{format_profile}.join(' ');&#10;      def stream = allOf { mCFP.get(combined, 'UNKNOWN_FORMAT--'+combined+'--') } { dynChannel } { ch };&#10;    };&#10;    return audioCollection[0].join( ' ' )&#10;    } +&#10;    '_'+&#10;    // Group&#10;    call{ any{ fn.match(/(?&lt;=[_-])[^\s_-]+?$/)} {group} {'_NA'} };&#10;    // Language&#10;    def lang = call{ any{'.'+subt} + {fn.matches(/(?i).+sdh.+/) ? '_SDH' : ''} {any{fn.match(/(?i)\(foreignpartsonly\)/)} '' } };&#10;    // Extension&#10;    // def ext = call{'.'+ext};&#10;    // call all the bindings to create the result&#10;    // call(dir_root) +&#10;    (call(main_title).replace(':', ';').replace('*', '') + call(lang)).replaceAll(/null/,'')&#10;  }"/>
                <entry key="2" value="{evaluate('Z:/Movies &amp; TV/New Downloads/_FileBot/Format_Movie.groovy' as File)}"/>
                <entry key="3" value="{evaluate('Z:/Movies &amp; TV/New Downloads/_FileBot Bindings/Format_Movie.groovy' as File)}"/>
                <entry key="4" value="{&#10;&#9;//////////////////////////////////////////////&#10;&#9;// MOVIE BINDING&#10;&#9;//////////////////////////////////////////////&#10;&#9;// Posted here: https://www.filebot.net/forums/viewtopic.php?f=4&amp;t=10766&amp;p=43842#p43842&#10;&#9;//////////////////////////////////////////////&#10;&#9;def space = call{' '};&#10;&#9;// Root Directory&#10;&#9;def dir_root = 'Z:\\Movies &amp; TV\\'+&#10;&#9;call{hd.matches(/(?i)SD/) ? '1. SD\\' : ' '}+&#10;&#9;call{hd.matches(/(?i)HD/) ? '2. HD\\' : ' '}+&#10;&#9;call{hd.matches(/(?i)UHD/) ? '3. UHD\\' : ' '};&#10;&#9;// Main Title e.g.&#10;&#9;// 1408 (2007) (Director's Cut) 1080p HD Blu-ray non-HDR x264 DTS5.1ch_SiNNERS&#10;&#9;// 300 (2007) 720p HD BRRip non-HDR x265 DTS 5.1ch_ESiR&#10;&#9;// Deadpool (2016) 2160p UHD WEB-DL non-HDR AVC DTS-HD MA 7.1ch_DDR&#10;&#9;// Deadpool 2 (2018) (Super Duper Cut) 2160p UHD Blu-ray REMUX HDR10bit ATEME TrueHD Atmos 13Obj 7.1ch_EPSiLON&#10;&#9;def main_title = call{n}+&#10;&#9;space + '(' + call{y} + ')'+&#10;&#9;space + call{fn.matches(/(?i).+\b25th.+?anniv.+/) ? '(25th Anniv. Edition)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\b\(limited\b.*?\).+/) ? '(Limited Edition)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\b\(uncut\b.*?\).+/) ? '(Uncut)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bcollector.+?s.+?edition\b.+/) ? '(Collector\'s Edition)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bdirect.+?cut\b.+/) ? '(Director\'s Cut)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bextended.+?\b.+/) ? '(Extended)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bextended.+?edit\b.+/) ? '(Extended Edition)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bimax\b.+/) ? '(IMAX Edition)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\blimited\b.+/) ? '(Limited)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bremastered\b.+/) ? '(Remastered)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bsuper.+duper.+cut\b.+/) ? '(Super Duper Cut)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\btheatrical\b.+/) ? '(Theatrical)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bunrated\b.+/) ? '(Unrated)' : ' '}+&#10;&#9;space + call{any{fn.match(/\([^\()+?[^\d]+?\)\s*/)} {' '}{' '}}+&#10;&#9;space + call{self.vf ? self.vf : self.hpi}+&#10;&#9;space + call{hd}+&#10;&#9;space + call{source.matches(/(?i)blu.*ray/) ? 'Blu-ray' : {source} ?: 'WEB-DL'}+&#10;&#9;space + call{fn.matches(/(?i).+\bremux\b.+/) ? 'REMUX' : ' '}+&#10;&#9;// Only calls {hdr} if it's not SD else non-HDR&#10;&#9;space + call{if (hd =~ 'HD') {any{hdr + &quot;-&quot; + bitdepth + 'bit'}{'non-HDR'}}}+&#10;&#9;space + call{vc}+&#10;&#9;space +&#10;&#9;// Call audio&#10;&#9;// Thread here where I got the base code: https://www.filebot.net/forums/viewtopic.php?f=5&amp;t=5285&#10;&#9;call {&#10;&#9;&#9;def mCFP =&#10;&#9;&#9;[&#10;&#9;&#9;'AAC LC SBR PS' : 'AAC',&#10;&#9;&#9;'AAC LC SBR' : 'AAC',&#10;&#9;&#9;'AAC LC' : 'AAC',&#10;&#9;&#9;'AC 3 Dep' : 'E-AC3',&#10;&#9;&#9;'AC 3' : 'AC3',&#10;&#9;&#9;'DTS 96 24' : 'DTS 96-24',&#10;&#9;&#9;'DTS ES XBR' : 'DTS-HD HRA',&#10;&#9;&#9;'DTS ES XLL' : 'DTS-HD MA',&#10;&#9;&#9;'DTS ES XXCH XBR' : 'DTS-HD HRA',&#10;&#9;&#9;'DTS ES XXCH XLL' : 'DTS-HD MA',&#10;&#9;&#9;'DTS ES XXCH' : 'DTS-ES',&#10;&#9;&#9;'DTS ES' : 'DTS-ES',&#10;&#9;&#9;'DTS XBR' : 'DTS-HD HRA',&#10;&#9;&#9;'DTS XLL X' : 'DTS X',&#10;&#9;&#9;'DTS XLL' : 'DTS-HD MA',&#10;&#9;&#9;'DTS' : 'DTS',&#10;&#9;&#9;'E AC 3 JOC' : 'EAC3 Atmos',&#10;&#9;&#9;'E AC 3' : 'EAC3',&#10;&#9;&#9;'MLP FBA 16 ch' : 'TrueHD Atmos',&#10;&#9;&#9;'MLP FBA' : 'TrueHD',&#10;&#9;&#9;'MP3' : 'MP3',&#10;&#9;&#9;'MPEG Audio' : 'MP2',&#10;&#9;&#9;'PCM' : 'PCM'&#10;&#9;&#9;];&#10;&#9;&#9;def audioClean = { it.replaceAll(/[\p{Pd}\p{Space}]/, ' ').replaceAll(/\p{Space}{2,}/, ' ').slash(' ') };&#10;&#9;&#9;def channelClean = { it.replaceAll(/Debug.+|Object\sBased\s?\/?|(\d+)?\sobjects\s\/\s|0.(?=\d.\d)|20/).replaceAll(/6/,'5.1').replaceAll(/8/,'7.1') };&#10;&#9;&#9;def audioCollection = audio.collect&#10;&#9;&#9;{ au -&gt;&#10;&#9;&#9;&#9;def channels = any{ channelClean(au['ChannelPositionsString2'])}{ channelClean(au['ChannelsOriginal'])}{ channelClean(au['Channels']) };&#10;&#9;&#9;&#9;def dynChannel = {au['NumberOfDynamicObjects'] + 'Obj'};&#10;&#9;&#9;&#9;def ch = channels.tokenize('\\/').take(3)*.toDouble().inject(0, { a, b -&gt; a + b }).findAll { it &gt; 0 }.max().toString() + 'ch';&#10;&#9;&#9;&#9;def codec = audioClean(any{ au['CodecID/Hint'] }{ au['Format'] });&#10;&#9;&#9;&#9;def format_profile = { ( au['Format_AdditionalFeatures'] != null) ? audioClean(au['Format_AdditionalFeatures']) : '' };&#10;&#9;&#9;&#9;def combined = allOf{codec}{format_profile}.join(' ');&#10;&#9;&#9;&#9;def stream = allOf { mCFP.get(combined, 'UNKNOWN_FORMAT--'+combined+'--') } { dynChannel } { ch };&#10;&#9;&#9;};&#10;&#9;&#9;return audioCollection[0].join( ' ' )&#10;&#9;&#9;} +&#10;&#9;&#9;'_'+&#10;&#9;&#9;// Group&#10;&#9;&#9;call{ any{ fn.match(/(?&lt;=[_-])[^\s_-]+?$/)} {group} {'_NA'} };&#10;&#9;&#9;// Language&#10;&#9;&#9;def lang = call{ any{'.'+subt} + {fn.matches(/(?i).+sdh.+/) ? '_SDH' : ''} {any{fn.match(/(?i)\(foreignpartsonly\)/)} '' } };&#10;&#9;&#9;// Extension&#10;&#9;&#9;// def ext = call{'.'+ext};&#10;&#9;&#9;// call all the bindings to create the result&#10;&#9;&#9;// call(dir_root) +&#10;&#9;&#9;(call(main_title).replace(':', ';').replace('*', '') + call(lang)).replaceAll(/null/,'')&#10;&#9;}"/>
                <entry key="5" value="{&#10;&#9;//////////////////////////////////////////////&#10;&#9;// MOVIE BINDING&#10;&#9;//////////////////////////////////////////////&#10;&#9;// Posted here: https://www.filebot.net/forums/viewtopic.php?f=4&amp;t=10766&amp;p=43842#p43842&#10;&#9;//////////////////////////////////////////////&#10;&#9;def space = call{' '};&#10;&#9;// Root Directory&#10;&#9;def dir_root = 'Z:\\Movies &amp; TV\\'+&#10;&#9;call{hd.matches(/(?i)SD/) ? '1. SD\\' : ' '}+&#10;&#9;call{hd.matches(/(?i)HD/) ? '2. HD\\' : ' '}+&#10;&#9;call{hd.matches(/(?i)UHD/) ? '3. UHD\\' : ' '};&#10;&#9;// Main Title e.g.&#10;&#9;// 1408 (2007) (Director's Cut) 1080p HD Blu-ray non-HDR x264 DTS5.1ch_SiNNERS&#10;&#9;// 300 (2007) 720p HD BRRip non-HDR x265 DTS 5.1ch_ESiR&#10;&#9;// Deadpool (2016) 2160p UHD WEB-DL non-HDR AVC DTS-HD MA 7.1ch_DDR&#10;&#9;// Deadpool 2 (2018) (Super Duper Cut) 2160p UHD Blu-ray REMUX HDR10bit ATEME TrueHD Atmos 13Obj 7.1ch_EPSiLON&#10;&#9;def main_title = call{n}+&#10;&#9;space + '(' + call{y} + ')'+&#10;&#9;space + call{fn.matches(/(?i).+\b25th.+?anniv.+/) ? '(25th Anniv. Edition)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\b\(limited\b.*?\).+/) ? '(Limited Edition)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\b\(uncut\b.*?\).+/) ? '(Uncut)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bcollector.+?s.+?edition\b.+/) ? '(Collector\'s Edition)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bdirect.+?cut\b.+/) ? '(Director\'s Cut)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bextended.+?\b.+/) ? '(Extended)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bextended.+?edit\b.+/) ? '(Extended Edition)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bimax\b.+/) ? '(IMAX Edition)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\blimited\b.+/) ? '(Limited)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bremastered\b.+/) ? '(Remastered)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bsuper.+duper.+cut\b.+/) ? '(Super Duper Cut)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\btheatrical\b.+/) ? '(Theatrical)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bunrated\b.+/) ? '(Unrated)' : ' '}+&#10;&#9;space + call{any{fn.match(/\([^\()+?[^\d]+?\)\s*/)} {' '}{' '}}+&#10;&#9;space + call{self.vf ? self.vf : self.hpi}+&#10;&#9;space + call{hd}+&#10;&#9;space + call{source.matches(/(?i)blu.*ray/) ? 'Blu-ray' : {source} ?: 'WEB-DL'}+&#10;&#9;space + call{fn.matches(/(?i).+\bremux\b.+/) ? 'REMUX' : ' '}+&#10;&#9;// Only calls {hdr} if it's not SD else non-HDR&#10;&#9;space + call{if (hd =~ 'HD') {any{hdr + &quot;-&quot; + bitdepth + 'bit'}{'non-HDR'}}}+&#10;&#9;space + call{vc}+&#10;&#9;space +&#10;&#9;// Call audio&#10;&#9;// Thread here where I got the base code: https://www.filebot.net/forums/viewtopic.php?f=5&amp;t=5285&#10;&#9;call {&#10;&#9;&#9;def mCFP =&#10;&#9;&#9;[&#10;&#9;&#9;'AAC LC SBR PS' : 'AAC',&#10;&#9;&#9;'AAC LC SBR' : 'AAC',&#10;&#9;&#9;'AAC LC' : 'AAC',&#10;&#9;&#9;'AC 3 Dep' : 'E-AC3',&#10;&#9;&#9;'AC 3' : 'AC3',&#10;&#9;&#9;'DTS 96 24' : 'DTS 96-24',&#10;&#9;&#9;'DTS ES XBR' : 'DTS-HD HRA',&#10;&#9;&#9;'DTS ES XLL' : 'DTS-HD MA',&#10;&#9;&#9;'DTS ES XXCH XBR' : 'DTS-HD HRA',&#10;&#9;&#9;'DTS ES XXCH XLL' : 'DTS-HD MA',&#10;&#9;&#9;'DTS ES XXCH' : 'DTS-ES',&#10;&#9;&#9;'DTS ES' : 'DTS-ES',&#10;&#9;&#9;'DTS XBR' : 'DTS-HD HRA',&#10;&#9;&#9;'DTS XLL X' : 'DTS X',&#10;&#9;&#9;'DTS XLL' : 'DTS-HD MA',&#10;&#9;&#9;'DTS' : 'DTS',&#10;&#9;&#9;'E AC 3 JOC' : 'EAC3 Atmos',&#10;&#9;&#9;'E AC 3' : 'EAC3',&#10;&#9;&#9;'MLP FBA 16 ch' : 'TrueHD Atmos',&#10;&#9;&#9;'MLP FBA' : 'TrueHD',&#10;&#9;&#9;'MP3' : 'MP3',&#10;&#9;&#9;'MPEG Audio' : 'MP2',&#10;&#9;&#9;'PCM' : 'PCM'&#10;&#9;&#9;];&#10;&#9;&#9;def audioClean = { it.replaceAll(/[\p{Pd}\p{Space}]/, ' ').replaceAll(/\p{Space}{2,}/, ' ').slash(' ') };&#10;&#9;&#9;def channelClean = { it.replaceAll(/Debug.+|Object\sBased\s?\/?|(\d+)?\sobjects\s\/\s|0.(?=\d.\d)|20/).replaceAll(/6/,'5.1').replaceAll(/8/,'7.1') };&#10;&#9;&#9;def audioCollection = audio.collect&#10;&#9;&#9;{ au -&gt;&#10;&#9;&#9;&#9;def channels = any{ channelClean(au['ChannelPositionsString2'])}{ channelClean(au['ChannelsOriginal'])}{ channelClean(au['Channels']) };&#10;&#9;&#9;&#9;def dynChannel = {au['NumberOfDynamicObjects'] + 'Obj'};&#10;&#9;&#9;&#9;def ch = channels.tokenize('\\/').take(3)*.toDouble().inject(0, { a, b -&gt; a + b }).findAll { it &gt; 0 }.max().toString() + 'ch';&#10;&#9;&#9;&#9;def codec = audioClean(any{ au['CodecID/Hint'] }{ au['Format'] });&#10;&#9;&#9;&#9;def format_profile = { ( au['Format_AdditionalFeatures'] != null) ? audioClean(au['Format_AdditionalFeatures']) : '' };&#10;&#9;&#9;&#9;def combined = allOf{codec}{format_profile}.join(' ');&#10;&#9;&#9;&#9;def stream = allOf { mCFP.get(combined, 'UNKNOWN_FORMAT--'+combined+'--') } { dynChannel } { ch };&#10;&#9;&#9;};&#10;&#9;&#9;return audioCollection[0].join( ' ' )&#10;&#9;&#9;} +&#10;&#9;&#9;'_'+&#10;&#9;&#9;// Group&#10;&#9;&#9;call{ any{ fn.match(/(?&lt;=[_-])[^\s_-]+?$/)} {group} {'_NA'} };&#10;&#9;&#9;// Language&#10;&#9;&#9;def lang = call{ any{'.'+subt} + {fn.matches(/(?i).+sdh.+/) ? '_SDH' : ''} {any{fn.match(/(?i)\(foreignpartsonly\)/)} '' } };&#10;&#9;&#9;// Extension&#10;&#9;&#9;// def ext = call{'.'+ext};&#10;&#9;&#9;// Call all the bindings to create the result&#10;&#9;&#9;call(dir_root) + (call(main_title).replace(':', ';').replace('*', '') + call(lang)).replaceAll(/null/,'')&#10;&#9;}"/>
                <entry key="6" value="{&#10;&#9;//////////////////////////////////////////////&#10;&#9;// MOVIE BINDING&#10;&#9;//////////////////////////////////////////////&#10;&#9;// Posted here: https://www.filebot.net/forums/viewtopic.php?f=4&amp;t=10766&amp;p=43842#p43842&#10;&#9;//////////////////////////////////////////////&#10;&#9;def space = call{' '};&#10;&#9;// Root Directory&#10;&#9;def dir_root = 'Z:/Movies &amp; TV/'+&#10;&#9;call{hd.matches(/(?i)SD/) ? '1. SD/' : ' '}+&#10;&#9;call{hd.matches(/(?i)HD/) ? '2. HD/' : ' '}+&#10;&#9;call{hd.matches(/(?i)UHD/) ? '3. UHD/' : ' '};&#10;&#9;// Main Title e.g.&#10;&#9;// 1408 (2007) (Director's Cut) 1080p HD Blu-ray non-HDR x264 DTS5.1ch_SiNNERS&#10;&#9;// 300 (2007) 720p HD BRRip non-HDR x265 DTS 5.1ch_ESiR&#10;&#9;// Deadpool (2016) 2160p UHD WEB-DL non-HDR AVC DTS-HD MA 7.1ch_DDR&#10;&#9;// Deadpool 2 (2018) (Super Duper Cut) 2160p UHD Blu-ray REMUX HDR10bit ATEME TrueHD Atmos 13Obj 7.1ch_EPSiLON&#10;&#9;def main_title = call{n}+&#10;&#9;space + '(' + call{y} + ')'+&#10;&#9;space + call{fn.matches(/(?i).+\b25th.+?anniv.+/) ? '(25th Anniv. Edition)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\b\(limited\b.*?\).+/) ? '(Limited Edition)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\b\(uncut\b.*?\).+/) ? '(Uncut)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bcollector.+?s.+?edition\b.+/) ? '(Collector\'s Edition)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bdirect.+?cut\b.+/) ? '(Director\'s Cut)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bextended.+?\b.+/) ? '(Extended)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bextended.+?edit\b.+/) ? '(Extended Edition)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bimax\b.+/) ? '(IMAX Edition)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\blimited\b.+/) ? '(Limited)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bremastered\b.+/) ? '(Remastered)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bsuper.+duper.+cut\b.+/) ? '(Super Duper Cut)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\btheatrical\b.+/) ? '(Theatrical)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bunrated\b.+/) ? '(Unrated)' : ' '}+&#10;&#9;space + call{any{fn.match(/\([^\()+?[^\d]+?\)\s*/)} {' '}{' '}}+&#10;&#9;space + call{self.vf ? self.vf : self.hpi}+&#10;&#9;space + call{hd}+&#10;&#9;space + call{source.matches(/(?i)blu.*ray/) ? 'Blu-ray' : {source} ?: 'WEB-DL'}+&#10;&#9;space + call{fn.matches(/(?i).+\bremux\b.+/) ? 'REMUX' : ' '}+&#10;&#9;// Only calls {hdr} if it's not SD else non-HDR&#10;&#9;space + call{if (hd =~ 'HD') {any{hdr + &quot;-&quot; + bitdepth + 'bit'}{'non-HDR'}}}+&#10;&#9;space + call{vc}+&#10;&#9;space +&#10;&#9;// Call audio&#10;&#9;// Thread here where I got the base code: https://www.filebot.net/forums/viewtopic.php?f=5&amp;t=5285&#10;&#9;call {&#10;&#9;&#9;def mCFP =&#10;&#9;&#9;[&#10;&#9;&#9;'AAC LC SBR PS' : 'AAC',&#10;&#9;&#9;'AAC LC SBR' : 'AAC',&#10;&#9;&#9;'AAC LC' : 'AAC',&#10;&#9;&#9;'AC 3 Dep' : 'E-AC3',&#10;&#9;&#9;'AC 3' : 'AC3',&#10;&#9;&#9;'DTS 96 24' : 'DTS 96-24',&#10;&#9;&#9;'DTS ES XBR' : 'DTS-HD HRA',&#10;&#9;&#9;'DTS ES XLL' : 'DTS-HD MA',&#10;&#9;&#9;'DTS ES XXCH XBR' : 'DTS-HD HRA',&#10;&#9;&#9;'DTS ES XXCH XLL' : 'DTS-HD MA',&#10;&#9;&#9;'DTS ES XXCH' : 'DTS-ES',&#10;&#9;&#9;'DTS ES' : 'DTS-ES',&#10;&#9;&#9;'DTS XBR' : 'DTS-HD HRA',&#10;&#9;&#9;'DTS XLL X' : 'DTS X',&#10;&#9;&#9;'DTS XLL' : 'DTS-HD MA',&#10;&#9;&#9;'DTS' : 'DTS',&#10;&#9;&#9;'E AC 3 JOC' : 'EAC3 Atmos',&#10;&#9;&#9;'E AC 3' : 'EAC3',&#10;&#9;&#9;'MLP FBA 16 ch' : 'TrueHD Atmos',&#10;&#9;&#9;'MLP FBA' : 'TrueHD',&#10;&#9;&#9;'MP3' : 'MP3',&#10;&#9;&#9;'MPEG Audio' : 'MP2',&#10;&#9;&#9;'PCM' : 'PCM'&#10;&#9;&#9;];&#10;&#9;&#9;def audioClean = { it.replaceAll(/[\p{Pd}\p{Space}]/, ' ').replaceAll(/\p{Space}{2,}/, ' ').slash(' ') };&#10;&#9;&#9;def channelClean = { it.replaceAll(/Debug.+|Object\sBased\s?\/?|(\d+)?\sobjects\s\/\s|0.(?=\d.\d)|20/).replaceAll(/6/,'5.1').replaceAll(/8/,'7.1') };&#10;&#9;&#9;def audioCollection = audio.collect&#10;&#9;&#9;{ au -&gt;&#10;&#9;&#9;&#9;def channels = any{ channelClean(au['ChannelPositionsString2'])}{ channelClean(au['ChannelsOriginal'])}{ channelClean(au['Channels']) };&#10;&#9;&#9;&#9;def dynChannel = {au['NumberOfDynamicObjects'] + 'Obj'};&#10;&#9;&#9;&#9;def ch = channels.tokenize('\\/').take(3)*.toDouble().inject(0, { a, b -&gt; a + b }).findAll { it &gt; 0 }.max().toString() + 'ch';&#10;&#9;&#9;&#9;def codec = audioClean(any{ au['CodecID/Hint'] }{ au['Format'] });&#10;&#9;&#9;&#9;def format_profile = { ( au['Format_AdditionalFeatures'] != null) ? audioClean(au['Format_AdditionalFeatures']) : '' };&#10;&#9;&#9;&#9;def combined = allOf{codec}{format_profile}.join(' ');&#10;&#9;&#9;&#9;def stream = allOf { mCFP.get(combined, 'UNKNOWN_FORMAT--'+combined+'--') } { dynChannel } { ch };&#10;&#9;&#9;};&#10;&#9;&#9;return audioCollection[0].join( ' ' )&#10;&#9;&#9;} +&#10;&#9;&#9;'_'+&#10;&#9;&#9;// Group&#10;&#9;&#9;call{ any{ fn.match(/(?&lt;=[_-])[^\s_-]+?$/)} {group} {'_NA'} };&#10;&#9;&#9;// Language&#10;&#9;&#9;def lang = call{ any{'.'+subt} + {fn.matches(/(?i).+sdh.+/) ? '_SDH' : ''} {any{fn.match(/(?i)\(foreignpartsonly\)/)} '' } };&#10;&#9;&#9;// Extension&#10;&#9;&#9;// def ext = call{'.'+ext};&#10;&#9;&#9;// Call all the bindings to create the result&#10;&#9;&#9;call(dir_root) + (call(main_title).replace(':', ';').replace('*', '') + call(lang)).replaceAll(/null/,'')&#10;&#9;}"/>
                <entry key="7" value="{&#10;&#9;//////////////////////////////////////////////&#10;&#9;// MOVIE BINDING&#10;&#9;//////////////////////////////////////////////&#10;&#9;// Posted here: https://www.filebot.net/forums/viewtopic.php?f=4&amp;t=10766&amp;p=43842#p43842&#10;&#9;//////////////////////////////////////////////&#10;&#9;def space = call{' '};&#10;&#9;// Root Directory&#10;&#9;def dir_root = 'Z:/Movies &amp; TV/'+&#10;&#9;call{hd.matches(/(?i)SD/) ? '1. SD/' : ' '}+&#10;&#9;call{hd.matches(/(?i)HD/) ? '2. HD/' : ' '}+&#10;&#9;call{hd.matches(/(?i)UHD/) ? '3. UHD/' : ' '};&#10;&#9;// Main Title e.g.&#10;&#9;// 1408 (2007) (Director's Cut) 1080p HD Blu-ray non-HDR x264 DTS5.1ch_SiNNERS&#10;&#9;// 300 (2007) 720p HD BRRip non-HDR x265 DTS 5.1ch_ESiR&#10;&#9;// Deadpool (2016) 2160p UHD WEB-DL non-HDR AVC DTS-HD MA 7.1ch_DDR&#10;&#9;// Deadpool 2 (2018) (Super Duper Cut) 2160p UHD Blu-ray REMUX HDR10bit ATEME TrueHD Atmos 13Obj 7.1ch_EPSiLON&#10;&#9;def main_title = call{n}+&#10;&#9;space + '(' + call{y} + ')'+&#10;&#9;space + call{fn.matches(/(?i).+\b25th.+?anniv.+/) ? '(25th Anniv. Edition)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\b\(limited\b.*?\).+/) ? '(Limited Edition)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\b\(uncut\b.*?\).+/) ? '(Uncut)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bcollector.+?s.+?edition\b.+/) ? '(Collector\'s Edition)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bdirect.+?cut\b.+/) ? '(Director\'s Cut)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bextended.+?\b.+/) ? '(Extended)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bextended.+?edit\b.+/) ? '(Extended Edition)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bimax\b.+/) ? '(IMAX Edition)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\blimited\b.+/) ? '(Limited)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bremastered\b.+/) ? '(Remastered)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bsuper.+duper.+cut\b.+/) ? '(Super Duper Cut)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\btheatrical\b.+/) ? '(Theatrical)' : ' '}+&#10;&#9;space + call{fn.matches(/(?i).+\bunrated\b.+/) ? '(Unrated)' : ' '}+&#10;&#9;space + call{any{fn.match(/\([^\()+?[^\d]+?\)\s*/)} {' '}{' '}}+&#10;&#9;space + call{self.vf ? self.vf : self.hpi}+&#10;&#9;space + call{hd}+&#10;&#9;space + call{source.matches(/(?i)blu.*ray/) ? 'Blu-ray' : {source} ?: 'WEB-DL'}+&#10;&#9;space + call{fn.matches(/(?i).+\bremux\b.+/) ? 'REMUX' : ' '}+&#10;&#9;// Only calls {hdr} if it's not SD else non-HDR&#10;&#9;space + call{if (hd =~ 'HD') {any{hdr + &quot;-&quot; + bitdepth + 'bit'}{'non-HDR'}}}+&#10;&#9;space + call{vc}+&#10;&#9;space +&#10;&#9;// Call audio&#10;&#9;// Thread here where I got the base code: https://www.filebot.net/forums/viewtopic.php?f=5&amp;t=5285&#10;&#9;call {&#10;&#9;&#9;def mCFP =&#10;&#9;&#9;[&#10;&#9;&#9;'AAC LC SBR PS' : 'AAC',&#10;&#9;&#9;'AAC LC SBR' : 'AAC',&#10;&#9;&#9;'AAC LC' : 'AAC',&#10;&#9;&#9;'AC 3 Dep' : 'E-AC3',&#10;&#9;&#9;'AC 3' : 'AC3',&#10;&#9;&#9;'DTS 96 24' : 'DTS 96-24',&#10;&#9;&#9;'DTS ES XBR' : 'DTS-HD HRA',&#10;&#9;&#9;'DTS ES XLL' : 'DTS-HD MA',&#10;&#9;&#9;'DTS ES XXCH XBR' : 'DTS-HD HRA',&#10;&#9;&#9;'DTS ES XXCH XLL' : 'DTS-HD MA',&#10;&#9;&#9;'DTS ES XXCH' : 'DTS-ES',&#10;&#9;&#9;'DTS ES' : 'DTS-ES',&#10;&#9;&#9;'DTS XBR' : 'DTS-HD HRA',&#10;&#9;&#9;'DTS XLL X' : 'DTS X',&#10;&#9;&#9;'DTS XLL' : 'DTS-HD MA',&#10;&#9;&#9;'DTS' : 'DTS',&#10;&#9;&#9;'E AC 3 JOC' : 'EAC3 Atmos',&#10;&#9;&#9;'E AC 3' : 'EAC3',&#10;&#9;&#9;'MLP FBA 16 ch' : 'TrueHD Atmos',&#10;&#9;&#9;'MLP FBA' : 'TrueHD',&#10;&#9;&#9;'MP3' : 'MP3',&#10;&#9;&#9;'MPEG Audio' : 'MP2',&#10;&#9;&#9;'PCM' : 'PCM'&#10;&#9;&#9;];&#10;&#9;&#9;def audioClean = { it.replaceAll(/[\p{Pd}\p{Space}]/, ' ').replaceAll(/\p{Space}{2,}/, ' ').slash(' ') };&#10;&#9;&#9;def channelClean = { it.replaceAll(/Debug.+|Object\sBased\s?\/?|(\d+)?\sobjects\s\/\s|0.(?=\d.\d)|20/).replaceAll(/6/,'5.1').replaceAll(/8/,'7.1') };&#10;&#9;&#9;def audioCollection = audio.collect&#10;&#9;&#9;{ au -&gt;&#10;&#9;&#9;&#9;def channels = any{ channelClean(au['ChannelPositionsString2'])}{ channelClean(au['ChannelsOriginal'])}{ channelClean(au['Channels']) };&#10;&#9;&#9;&#9;def dynChannel = {au['NumberOfDynamicObjects'] + 'Obj'};&#10;&#9;&#9;&#9;def ch = channels.tokenize('\\/').take(3)*.toDouble().inject(0, { a, b -&gt; a + b }).findAll { it &gt; 0 }.max().toString() + 'ch';&#10;&#9;&#9;&#9;def codec = audioClean(any{ au['CodecID/Hint'] }{ au['Format'] });&#10;&#9;&#9;&#9;def format_profile = { ( au['Format_AdditionalFeatures'] != null) ? audioClean(au['Format_AdditionalFeatures']) : '' };&#10;&#9;&#9;&#9;def combined = allOf{codec}{format_profile}.join(' ');&#10;&#9;&#9;&#9;def stream = allOf { mCFP.get(combined, 'UNKNOWN_FORMAT--'+combined+'--') } { dynChannel } { ch };&#10;&#9;&#9;};&#10;&#9;&#9;return audioCollection[0].join( ' ' )&#10;&#9;&#9;} +&#10;&#9;&#9;'_'+&#10;&#9;&#9;// Group&#10;&#9;&#9;call{ any{ fn.match(/(?&lt;=[_-])[^\s_-]+?$/)} {group} {'_NA'} };&#10;&#9;&#9;// Language&#10;&#9;&#9;def lang = call{ any{'.'+subt} + {fn.matches(/(?i).+sdh.+/) ? '_SDH' : ''} {any{fn.match(/(?i)\(foreignpartsonly\)/)} '' } };&#10;&#9;&#9;// Extension&#10;&#9;&#9;// def ext = call{'.'+ext};&#10;&#9;&#9;// Call all the bindings to create the result&#10;&#9;&#9;(call(main_title).replace(':', ';').replace('*', '') + call(lang)).replaceAll(/null/,'')&#10;&#9;}"/>
              </map>
            </node>
            <node name="presets">
              <map>
                <entry key="My Preset" value="{&quot;@type&quot;:&quot;net.filebot.ui.rename.Preset&quot;,&quot;name&quot;:&quot;My Preset&quot;,&quot;path&quot;:&quot;Z:\\Movies &amp; TV\\3. UHD&quot;,&quot;includes&quot;:&quot;minutes &gt; 5 &amp;&amp; fn != /(?i)extras/&quot;,&quot;format&quot;:&quot;{home}/Movies/{n} {y}&quot;,&quot;database&quot;:&quot;TheMovieDB::TV&quot;,&quot;sortOrder&quot;:&quot;DVD&quot;,&quot;matchMode&quot;:&quot;Opportunistic&quot;,&quot;language&quot;:&quot;en&quot;,&quot;action&quot;:&quot;HARDLINK&quot;}"/>
              </map>
            </node>
          </node>
        </node>
      </node>
    </node>
  </root>
</preferences>

Done ?(?????)?

Z:\Movies & TV\New Downloads\_FileBot>

User avatar
rednoah
The Source
Posts: 16430
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Point to external file in GUI ?

Post by rednoah » 25 May 2019, 18:49

stephen147 wrote:
25 May 2019, 15:46
It's not updating the GUI.
Did you test by matching files and letting it run the format, or did you test by clicking on Edit Format? The former works. The latter does not. Since we're just setting internal settings without going through the usual steps.
:idea: Please read the FAQ and How to Request Help.

stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: Point to external file in GUI ?

Post by stephen147 » 25 May 2019, 19:03

I see. I went to edit format first. Without running a match.

Thanks for this. I've made a batch file to update my portable build and install one. Will post for others once I get to my PC.

stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: Point to external file in GUI ?

Post by stephen147 » 26 May 2019, 13:19

Just checked, that worked. Batch file below I've written to update my 2 versions at the same time. (Installed & portable)

Code: Select all

@echo off
color 5F
mode con:cols=50 lines=20
goto START

::::::::::::::::::::::::::::::::::::::::::::::::

:: Read this thread first before using: https://www.filebot.net/forums/viewtopic.php?f=8&t=10837

:: VER 01 - 26-05-2019 - First release.

:: WHAT IT DOES:
:: Sets the default formats for Series and Movies without needing to paste anything to the GUI using your external file/s.
:: The 'edit format' box in the GUI will not get updated using this method, but will still work fine when you click match in the GUI,
:: as this is an internal method of updating the preferences.

:: This will work for filebot installed and portable versions.

:: Save this to Preferences.groovy without the ::'s at the start.
:: _def.each{ k, v ->
::   java.util.prefs.Preferences.userRoot().node('net/filebot/ui/rename').put(k, v)
:: }

:: The FILEBOT_PREFERENCES variable below will be that path. Set it to your location.
:: CHANGE ALL OTHER PATHS TO SUIT!
:: Save this as a .bat file to your system.
:: Double click it to update filebots internal format method. (It takes around 15 seconds to complete)

::::::::::::::::::::::::::::::::::::::::::::::::

:START
set "FOLDER_ROOT=Z:/Movies & TV/New Downloads/_FileBot"
set "GROOVY_ANIME=Format_Anime.groovy"
set "GROOVY_MOVIE=Format_Movie.groovy"
set "GROOVY_TV=Format_TV.groovy"
set "FILEBOT_PORTABLE=%FOLDER_ROOT%/filebot.exe"
set "FILEBOT_PREFERENCES=%FOLDER_ROOT%/Preferences.groovy"

::::::::::::::::::::::::::::::::::::::::::::::::

title FileBot GUI Format Update Wizward by stephen147 [%~nx0]
echo [%~nx0]
echo --------------------------------------------
echo:
echo          Hello '%username%'
echo:
echo --------------------------------------------
echo:
goto FILEBOT_PORTABLE

::::::::::::::::::::::::::::::::::::::::::::::::

:FILEBOT_PORTABLE
"%FILEBOT_PORTABLE%" -script "%FILEBOT_PREFERENCES%" --def [email protected]"%FOLDER_ROOT%/%GROOVY_TV%" [email protected]"%FOLDER_ROOT%/%GROOVY_MOVIE%"
goto FILEBOT_INSTALL

:FILEBOT_INSTALL
filebot -script "%FILEBOT_PREFERENCES%" --def [email protected]"%FOLDER_ROOT%/%GROOVY_TV%" [email protected]"%FOLDER_ROOT%/%GROOVY_MOVIE%"
goto PROCESS_COMPLETE

::::::::::::::::::::::::::::::::::::::::::::::::

:PROCESS_COMPLETE
echo:
echo:--------------------------------------------
color 0E
echo:
echo:   Process complete !
echo:
echo:--------------------------------------------
echo 
set /a WAITTIME_INPUT = 5
ping 192.0.2.0 -n 1 -w %WAITTIME_INPUT%000 >nul
rem @pause
EXIT

User avatar
rednoah
The Source
Posts: 16430
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Point to external file in GUI ?

Post by rednoah » 28 May 2019, 05:39

So I've looked into possible side effects, and no format ever posted here in the forums starts with @ or ends with groovy, so I think it's pretty safe to add (although a bit of undocumented black magic). :lol:

You can now just paste something like this into the Format Editor, and it'll work:

Code: Select all

@/path/to/file.groovy
Changes to the file will not be reflected in real-time though. You'll have to either restart FileBot or open the Format Editor and confirm to apply any changes if you're actively changing the file.
:idea: Please read the FAQ and How to Request Help.

Post Reply