Page 32 of 41

Re: [EVAL] Split code into external *.groovy script files

Posted: 21 Jun 2019, 03:16
by rednoah
test.groovy

Code: Select all

n

:idea: We're including Groovy code here, as opposed to FileBot Format Expression code, which interprets {...} delimited expressions as Groovy code. If we include Groovy code from within Groovy code, like in the example above, then Groovy code is expected.



YES:

Code: Select all

{evaluate 'n'}
:arrow: Same as {n}

NO:

Code: Select all

{evaluate '{n}'}
:arrow: Same as {{n}}

Re: [EVAL] Split code into external *.groovy script files

Posted: 21 Jun 2019, 05:32
by nothinghere
Oh, I see, I always was under the impression that the format expressions were just plain groovy. Shame on me.

Yeah, getting results now. Thanks!

Re: [EVAL] Split code into external *.groovy script files

Posted: 21 Jun 2019, 07:38
by rednoah
No worries. It’s a common misconception, since Groovy Code itself may also contain {} for close blocks or closures. So the semantics depend on the context.

Re: [EVAL] Split code into external *.groovy script files

Posted: 21 Jun 2019, 11:15
by nothinghere
After playing around a bit this is awesome.

However:
Trying to break out certain helpers as separate scripts it seems that there is an issue with loading external scripts unless everything is placed and run from the filebot portable folder (which I'd like to avoid since I have all my scripts backuped to a gdrive synced folder).

If I have a
tags.groovy file that grabs my preferred tag format, I can't seem to get it to load.

I've tried:
include 'getEditions.groovy' // this works fine if I place my groovy files in the lib, but if I run it from where I actually have my files it tries to load it from $CWD

After googling the recommended way is to do:

Code: Select all

def scriptDir =  getClass().protectionDomain.codeSource.location.path
include '$scriptDir/getEditions.groovy'
However, that blows up with

Code: Select all

AccessControlException: access denied ("java.lang.RuntimePermission" "getProtectionDomain")
I've tried granting access to all apps for that permission, but it doesn't seem to work.
Even doing:

Code: Select all

grant {
    permission java.security.AllPermission;
};
Doesn't work.


Is there some additional arguments I can give filebot to figure out which path to load files from, or is it all handled by the JVM?

Re: [EVAL] Split code into external *.groovy script files

Posted: 22 Jun 2019, 02:23
by rednoah
1.
Your code just doesn't do what you think it does:

Code: Select all

def x = 1
println '$x = 1' // $x = 1
println "$x = 1" // 1 = 1
:arrow: http://groovy-lang.org/syntax.html#_str ... erpolation


2.
I'd use environment variables if I wanted to pass in some common folder paths for use in custom scripts:

Code: Select all

export FILEBOT_FORMAT_D="$HOME/.gdrive/FileBot Formats"

Code: Select all

_environment.FILEBOT_FORMAT_D
or via --def name=value if you need it in the format engine:

Code: Select all

filebot ... --def FormatFolder="$FILEBOT_FORMAT_D"

Code: Select all

{defines.FormatFolder}

Re: [EVAL] Split code into external *.groovy script files

Posted: 22 Jun 2019, 04:56
by rednoah
FileBot r6524 will now resolve include("files.groovy") relatively to the current script file by default.

Re: [EVAL] Split code into external *.groovy script files

Posted: 22 Jun 2019, 05:56
by nothinghere
rednoah wrote: 22 Jun 2019, 04:56 FileBot r6524 will now resolve include("files.groovy") relatively to the current script file by default.
Great!


Thanks for pointing out that string interpolation thing, completely missed the single quotes difference (still threw the security exception but that's irrelevant now I guess).

The --def was exactly what I was thinking of as a workaround.

Thanks for the help!

Re: Metadata and Extended Attributes

Posted: 06 Jul 2019, 06:38
by b2un0
Hi,

is there any option to add filebot xattr to already sorted files?

eg, i have multiple series where on some seasons the xattr from filebot are missing, so ne the " filebot missing script" does not work correct and think the season is missing.

Re: Metadata and Extended Attributes

Posted: 06 Jul 2019, 06:46
by rednoah
You'll have to process files through FileBot again to ensure that xattr are set this time.

You can find files without xattr metadata like so:

Code: Select all

filebot -mediainfo . --filter '!f.metadata' --format {f}

Re: Metadata and Extended Attributes

Posted: 06 Jul 2019, 06:49
by b2un0
thanks for your fast reply!

thats the first thing i did, but filebot says "Skipped, already exists". :(

Re: Metadata and Extended Attributes

Posted: 06 Jul 2019, 06:55
by rednoah
1.
You can move all untagged files elsewhere first:

Code: Select all

filebot -mediainfo . --filter '!f.metadata' -exec mv -v {f} /path/to/untagged/files/{f.name}

2.
However, the general smart approach is to never touch files in your Media folder, and only ever move files there via FileBot. That way you can ensure that everything is always in perfect order.

i.e. just process all your files into a new folder, and then remove the old one if you're happy with the new one

Code: Select all

--format /path/to/new/folder/{plex}

Re: [BTC] Purchase FileBot with Crypto Currency

Posted: 14 Jul 2019, 17:59
by Batman
I am interested in purchasing a license via crypto currency...

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Posted: 03 Aug 2019, 00:10
by eggsplorer
I followed your steps in post #1 and it works very well I just can't change any of the downloaded files because I have no permission.

How can I get filebot to create files/folders with correct permissions?

On my Media Drive all my files have:
Owner: 1000
Group: 100
Permissions: 775

Files renamed and moved from Filebot have:
Owner: 0
Group: 0
Permissions: 775

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Posted: 03 Aug 2019, 07:26
by rednoah
FileBot does not set or change permissions in any way. It does whatever the OS does by default.

The amc script does have the --def exec option though, which allows you to run your own post-processing commands on newly processed files:

Code: Select all

--def "exec=chmod -R 775 {quote folder} && chown -R admin:administrators {quote folder}"

Re: How about sharing our format expressions?

Posted: 26 Aug 2019, 23:03
by 9000aalborg
Hi guys

Major noob here :-/

I am trying to use nothinghere's script.
And I am too new to the forums to write nothinghere a personal message
But I would use the script, BUT without the period between the words in the name ( for example "in.the.name.of the.rose). I would rather have "In the name of the rose"

Can anyone help me to change that in the movie and tv-episode scripts ?

Thanks.
\Lars (major noob from Denmark)

nothinghere wrote: 13 Jul 2014, 18:57 The ones I am using. Major thanks to Ithiel and Rednoah for some of the parts.

Movies:

Code: Select all

{norm={it.upperInitial().lowerTrail().replaceTrailingBrackets().replaceAll(/\u0022/, '\'').replaceAll(/[:|]/, '.').replaceAll(/\?/, '!').replaceAll(/[*\s\.,]+/, '.').replaceAll(/\b[IiVvXx]+\b/, { it.upper() }).replaceAll(/[0-9](th|nd|rd)/, { it.lower() })};isLatin = {java.text.Normalizer.normalize(it, java.text.Normalizer.Form.NFD).replaceAll(/\p{InCombiningDiacriticalMarks}+/, '') ==~ /^\p{InBasicLatin}+$/}; isLatin(info.OriginalName) ? norm(info.OriginalName) : norm(primaryTitle) }.({y}){if(isLatin(info.OriginalName) && info.OriginalName != primaryTitle && !(info.SpokenLanguages[0] ==~ /(sv|da|no)/)) '.'+ norm(primaryTitle) }{'.'+vf}{'.'+source}{fn.contains('3D') || fn.contains('3-D') ? '.3D':''}{'.'+fn.replace(/(?i)\.DC\./, '.directors.cut.').replaceAll(/director\'?s|theatrical|ultimate/,'$0.Cut').matchAll(/UNCENSORED|UNRATED|REMASTERED|EXTENDED|UNCUT|DIRECTOR\'?S.CUT|THEATRICAL.CUT|ULTIMATE.CUT|FINAL.CUT|SPECIAL.EDITION/)*.upperInitial()*.lowerTrail().sort().join('.')}{'.'+fn.matchAll(/PROPER|REPACK/)*.upper().sort().join('.')}{'.'+vc.replace('Microsoft', 'VC-1')}{'.'+ac.replace('MPEG Audio', 'MP3')}{audio.FormatProfile =~ /MA Core/ ? '-HD.MA' : ''}{audio.FormatProfile =~ /ES/ ? '-ES' : ''}{audio.FormatProfile =~ /Pro/ ? '-Pro' : ''}{'.'+af.replace('8 6ch', '7.1').replace('7 6ch', '6.1').replace('6ch', '5.1').replace('3ch', '2.1').replace('2ch','2.0').replace('1ch','1.0')}{def g = c{group}; def m = c{fn.match(/(?:(?<=[-])[a-z0-9]+$)|(?:^[a-z0-9]+(?=[-]))/)}; if(g==null && m!=null) return '-'+m.replace(/^tpz$/, 'TOPAZ'); if(g!=null && m!=null && m.lower()!=g.lower()) return '-'+m.replace(/^tpz$/, 'TOPAZ'); if(g!=null) return '-'+g;}
I am using the original title if it the alphabet used is latin based. If the original title is not the same as the english title, and the first spoken language is not Swedish, Norwegian or Danish I will add the English title as part of the filename. This way I can keep the original titles which I prefer, but still have a chance to find them/connect them to the English titles most commonly used when talking to people. The Nordic stuff is because I live there so I know which movies they are.
If you want to use the format but don't want the special hack for Nordic stuff remove the text: "&& !(info.SpokenLanguages[0] ==~ /(sv|da|no)/)"
The audio/movie codecs are hacked a bit to be named by their real/common names instead of the ones defined by mediainfo. I.e. DTS-HD MA, MP3, VC-1 instead of DTS MA Core, MPEG Audio and Microsoft respectively.

Examples:
Kôkaku.Kidôtai.2.0.(2008).Ghost.In.The.Shell.2.0.720p.REPACK.x264.DTS.5.1-timeshift.mkv // Latin characters but added english name
Jagten.(2012).1080p.BluRay.x264.DTS-HD.MA-GRYM.mkv // Original name only, primary language is Danish
My.Sassy.Girl.(2001).720p.BluRay.x264.AC3.5.1-EbP.mkv // Actual name is 엽기적인 그녀, or transliterated to Yeopgijeogin Geunyeo
I would have loved to figure out how to keep the transliterated names, but using {transliterate(info.OriginalTitle)}did not work perfectly, which meant a bunch of titles missed when doing searched.
For my sassy girl the transliteration was something like Yeobgi-jeogin Geunyeo or the like, which is really close, but far away to miss some lookups.

NOTE: I do not care for multipart files so I do not support them. I rip my movies as single files without any splits.



Series is a bit simpler as I only care about the name we get from TheTVDB (I have long since abandoned any hope that they'll change their mind and structure series as they were intended instead of simply how they where broadcasted):

Code: Select all

{n}/{episode.special ? 'Specials' : 'Season '+s}/{norm={it.upperInitial().lowerTrail().replaceTrailingBrackets().replaceAll(/\u0022/, '\'').replaceAll(/[:|]/, '.').replaceAll(/\?/, '!').replaceAll(/[*\s\.]+/, '.').replaceAll(/\b[IiVvXx]+\b/, { it.upper() }).replaceAll(/[0-9](th|nd|rd)/, { it.lower() })};norm(n) }.{episode.special ? 'S00E'+special.pad(2) : s00e00}.{norm(t)}{'.'+vf}{'.'+source}{'.'+fn.matchAll(/PROPER|REPACK/)*.upper().sort().join('.')}{'.'+vc.replace('Microsoft', 'VC-1')}{'.'+ac.replace('MPEG Audio', 'MP3')}{audio.FormatProfile =~ /MA Core/ ? '-HD.MA' : ''}{audio.FormatProfile =~ /ES/ ? '-ES' : ''}{audio.FormatProfile =~ /Pro/ ? '-Pro' : ''}{'.'+af.replace('8 6ch', '7.1').replace('7 6ch', '6.1').replace('6ch', '5.1').replace('3ch', '2.1').replace('2ch','2.0').replace('1ch','1.0')}{def g = c{group}; def m = c{fn.match(/(?:(?<=[-])[a-z0-9]+$)|(?:^[a-z0-9]+(?=[-]))/)}; if(g==null && m!=null) return '-'+m.replace(/^tpz$/, 'TOPAZ'); if(g!=null && m!=null && m.lower()!=g.lower()) return '-'+m.replace(/^tpz$/, 'TOPAZ'); if(g!=null) return '-'+g;}
NOTE: I do not pad the season numbering (i.e. I use Season 1, Season 2 instead of Season 01, Season 02).
Specials end up in a /Specials folder instead. Same thing for video/audio as movies have.

Examples:
Coupling\Season 1\Coupling.S01E01.Flushed.360p.DVDRip.x264.AAC.mkv
Doctor Horrible's Sing-Along Blog\Season 1\Doctor.Horrible's.Sing-Along.Blog.S01E01.Act.I.1080p.BluRay.x264.DTS-DIMENSION.mkv


If anyone wants to copy my thing entirely the script I use to sort everything is:

Code: Select all

filebot -script fn:amc "x:/downloads" --log-file d:\amc-run.log --output "//nas/" --action move --conflict skip -non-strict --def clean=y --def "movieFormat=Movies/{norm={it.upperInitial().lowerTrail().replaceTrailingBrackets().replaceAll(/\u0022/, '\'').replaceAll(/[:|]/, '.').replaceAll(/\?/, '!').replaceAll(/[*\s\.,]+/, '.').replaceAll(/\b[IiVvXx]+\b/, { it.upper() }).replaceAll(/[0-9](th|nd|rd)/, { it.lower() })};isLatin = {java.text.Normalizer.normalize(it, java.text.Normalizer.Form.NFD).replaceAll(/\p{InCombiningDiacriticalMarks}+/, '') ==~ /^\p{InBasicLatin}+$/}; isLatin(info.OriginalName) ? norm(info.OriginalName) : norm(primaryTitle) }.({y}){if(isLatin(info.OriginalName) && info.OriginalName != primaryTitle && !(info.SpokenLanguages[0] ==~ /(sv|da|no)/)) '.'+ norm(primaryTitle) }{'.'+vf}{'.'+source}{fn.contains('3D') || fn.contains('3-D') ? '.3D':''}{'.'+fn.replace(/(?i)\.DC\./, '.directors.cut.').replaceAll(/director\'?s|theatrical|ultimate/,'$0.Cut').matchAll(/UNCENSORED|UNRATED|REMASTERED|EXTENDED|UNCUT|DIRECTOR\'?S.CUT|THEATRICAL.CUT|ULTIMATE.CUT|FINAL.CUT|SPECIAL.EDITION/)*.upperInitial()*.lowerTrail().sort().join('.')}{'.'+fn.matchAll(/PROPER|REPACK/)*.upper().sort().join('.')}{'.'+vc.replace('Microsoft', 'VC-1')}{'.'+ac.replace('MPEG Audio', 'MP3')}{audio.FormatProfile =~ /MA Core/ ? '-HD.MA' : ''}{audio.FormatProfile =~ /ES/ ? '-ES' : ''}{audio.FormatProfile =~ /Pro/ ? '-Pro' : ''}{'.'+af.replace('8 6ch', '7.1').replace('7 6ch', '6.1').replace('6ch', '5.1').replace('3ch', '2.1').replace('2ch','2.0').replace('1ch','1.0')}{def g = c{group}; def m = c{fn.match(/(?:(?<=[-])[a-z0-9]+$)|(?:^[a-z0-9]+(?=[-]))/)}; if(g==null && m!=null) return '-'+m.replace(/^tpz$/, 'TOPAZ'); if(g!=null && m!=null && m.lower()!=g.lower()) return '-'+m.replace(/^tpz$/, 'TOPAZ'); if(g!=null) return '-'+g;}" --def "seriesFormat=TV Shows/{n}/{episode.special ? 'Specials' : 'Season '+s}/{norm={it.upperInitial().lowerTrail().replaceTrailingBrackets().replaceAll(/\u0022/, '\'').replaceAll(/[:|]/, '.').replaceAll(/\?/, '!').replaceAll(/[*\s\.]+/, '.').replaceAll(/\b[IiVvXx]+\b/, { it.upper() }).replaceAll(/[0-9](th|nd|rd)/, { it.lower() })};norm(n) }.{episode.special ? 'S00E'+special.pad(2) : s00e00}.{norm(t)}{'.'+vf}{'.'+source}{'.'+fn.matchAll(/PROPER|REPACK/)*.upper().sort().join('.')}{'.'+vc.replace('Microsoft', 'VC-1')}{'.'+ac.replace('MPEG Audio', 'MP3')}{audio.FormatProfile =~ /MA Core/ ? '-HD.MA' : ''}{audio.FormatProfile =~ /ES/ ? '-ES' : ''}{audio.FormatProfile =~ /Pro/ ? '-Pro' : ''}{'.'+af.replace('8 6ch', '7.1').replace('7 6ch', '6.1').replace('6ch', '5.1').replace('3ch', '2.1').replace('2ch','2.0').replace('1ch','1.0')}{def g = c{group}; def m = c{fn.match(/(?:(?<=[-])[a-z0-9]+$)|(?:^[a-z0-9]+(?=[-]))/)}; if(g==null && m!=null) return '-'+m.replace(/^tpz$/, 'TOPAZ'); if(g!=null && m!=null && m.lower()!=g.lower()) return '-'+m.replace(/^tpz$/, 'TOPAZ'); if(g!=null) return '-'+g;}"
NOTE: Remember to update the paths to your series/movies and downloads.
Paste everything into a file called amc.cmd or something and double click it to run it.

Re: [DOCS] Use --mapper expressions for AniDB / TheTVDB cross-entity matching

Posted: 31 Aug 2019, 11:06
by ZeroByDivide
Any idea when 4.8.6 is coming to the windows store?

Re: [DOCS] Use --mapper expressions for AniDB / TheTVDB cross-entity matching

Posted: 31 Aug 2019, 17:56
by rednoah
The Microsoft Store package will be submitted to the Store on release day. Microsoft will then take a few days to test and publish.

4.8.6 has not been released yet. It's ready when it's ready. Probably sometime in September. You can help speed things up by trying the latest beta and providing feedback.

Re: Choose Java Swing Look-and-Feel (e.g. Dark Mode)

Posted: 02 Sep 2019, 16:58
by ByteShare
rednoah wrote: 25 Feb 2019, 19:23
  1. Open Start Menu and search for Set Environment Variables
  2. Click on New
    Name:

    Code: Select all

    FILEBOT_OPTS
    Value:

    Code: Select all

    -Dnet.filebot.theme=Darcula
  3. Click OK and then relaunch FileBot.

:!: Note that you'll need the latest revision (i.e. r6135 or higher) for any of this to work. The FileBot (platform) launcher is using the Darcula theme by default now as well.
This works great. Any chance of this being an option within the application? Maybe under Preferences?

Re: How about sharing our format expressions?

Posted: 08 Sep 2019, 17:25
by Liquidbings
Things I can't seem to get quite right is I want it to

1. replace x265 or hevc with (X265)
2. replace x264 with (X264)

with what I have there it works sometimes and other times I have x265 and (X265) also on the same line

Re: How about sharing our format expressions?

Posted: 08 Sep 2019, 18:31
by kim
you only add tag if in filename

Code: Select all

	space + call{fn.matches(/(?i).+\bhevc.+?\b.+/) ? '(x265)' : ' '}+
	space + call{fn.matches(/(?i).+\bx265\b.+/) ? '(x265)' : ' '}+
	space + call{fn.matches(/(?i).+\b264\b.+/) ? '(x264)' : ' '}+

try something like this:

Code: Select all

{'(' + any{vc.match(/x26[45]/)}{vc} + ')'}

Re: [DOCS] --apply post-processing features

Posted: 15 Sep 2019, 00:06
by kim
Will this replace scripts ?
any future plans to ?

where is this in the Docs ?
https://www.filebot.net/docs/api/

what does this use to fetch stuff ?

Re: [DOCS] --apply post-processing features

Posted: 15 Sep 2019, 06:07
by rednoah
kim wrote: 15 Sep 2019, 00:06 Will this replace scripts ?
any future plans to ?
Not at all. It's just a variety of frequently requested features that more or less fall under the same umbrella. The future plan is to add selected post-processing features to the GUI and allow users to apply some of them as part of the rename process.

kim wrote: 15 Sep 2019, 00:06 where is this in the Docs ?
https://www.filebot.net/docs/api/
A public API is not planned. It doesn't do anything that isn't already implemented in the htpc.groovy script or otherwise commonly handled via -exec calls.

:idea: The --apply import metadata date url and --apply qnap syno options might be of some benefit to amc script users, though existing users probably already have custom solutions.

kim wrote: 15 Sep 2019, 00:06 what does this use to fetch stuff ?
It's doing more or less the same as the artwork.* scripts, using TheMovieDB / TheTVDB / FanartTV as the source of image files.

Re: [PLEX] FileBot Xattr Metadata Scanners & Plug-ins

Posted: 04 Oct 2019, 19:53
by spetrillo
Do the PLug-ins and Scanners folders go into the Plug-in directory on the PMS?

Re: [PLEX] FileBot Xattr Metadata Scanners & Plug-ins

Posted: 04 Oct 2019, 20:33
by rednoah
They go into this directory:
https://support.plex.tv/articles/202915 ... y-located/

Plex might pick them up from different locations though. Maybe your plug-in directory will work too.

Re: Exclude Blacklist & Series-Mappings

Posted: 11 Oct 2019, 13:00
by trininja
Tokyo Ghoul Root A or also named Tokyo Ghoul √A is flagged as Tokyo Ghoul Season S02 in the TV DB.

Wikipedia with Tokyo Ghoul episode/season index:
https://en.wikipedia.org/wiki/List_of_T ... %E2%88%9AA

AniDB:
https://anidb.net/anime/10875

TVDB entry:
https://www.thetvdb.com/series/tokyo-ghoul/seasons/2

Happened to me that I accidently overwrote my Tokyo Ghoul S01 with the Root A S01 since FileBot wasnÄt able to see the difference because TVDB doesn't split it correctly.

Same goes for Tokio Ghoul :re Season 1 and 2, which are sadly sorted as Tokyo Goul season 3 in TVDB:
https://www.thetvdb.com/series/tokyo-ghoul/seasons/3

AniDB:
https://anidb.net/anime/13499

Wiki:
https://en.wikipedia.org/wiki/List_of_T ... _Ghoul:_re