Page 1 of 1

How to distinguish Subtitles from Groupname?

Posted: 03 Aug 2020, 19:49
by Elamania
I want to name all the external Subtitles as the name of the Movie and only add the language and if it´s forced or not.

My problem i that often "forced" is taken as the groupname then or even the full eng-forced as it.
It is due to this additional group check:
{" ["+fn.match(/(?<=[-])\w+$/) +"]"}
which is matching forced and such. However, I cannot not use it since then a lot of groupnames would not be recognized.

I have now:

Code: Select all

		def genre=null;
		genre=	"Horror Movies";
		else if (genres.contains("Animation")){
		genre=	"Animation Movies";
		 else if (genres.contains("Komödie")){
			genre= "Comedy Movies";
		 else if (genres.contains("Drama")){
			genre= "Drama Movies";		 
		 else if (genres.contains("Science Fiction")){
			genre= "SciFi Movies";		 
		 else if (genres.contains("Action")){
			genre= "Action Movies";		 
		  else if (genres.contains("Abenteuer")){
			genre= "Adventure Movies";		 
		return genre;
 {file.path[0]}:/Movies/{fileFolder}/ {collection+'/'} 
{f.subtitle ? "Subs/" : null}   
 {' - ' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|Theatrical|Theatrical.Cut|Theatrical.edition|directors.cut|special.edition|imax|anniversary/)*.toUpperCase().sort().join(', ').replaceAll(/[._]/, " ")}  
 [{allOf{audio.language.contains("de") ? "Ger" : null}{audio.language.contains("en") ? "Eng" : null}{audio.language.contains("ja") ? "Jap" : null} join ""}]
 [{allOf{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':""}{source.replace(/BluRay/,"BD").replace(/BDRip/,"BD")}{vf}{hdr}{video.bitdepth=='10' ? '10Bit' : null}{ac.replace(/MPEG Audio/,"mpg")}{channels}{vc} join "_"}]
{any{" ["+ group +"]"}{" ["+fn.match(/(?<=[-])\w+$/) +"]"}}{any{subt}{if(f.subtitle)fn.match(/.\w+$/).replaceAll(/\P{Alpha}+/,'.').toLowerCase().removeAll(/.(p|pro|contribution)$/).removeAll(/[.]$/)}{fn =~ /forced$/ ? '.forced' : null}}
If I use it like that I will get:
filename-Englisch-Forced -> filename [FORCED].eng.forced
filename_4608-eng1080 -> filename [eng1080].eng
filename-1080p-eng -> filename [eng].eng
So, the Subtitles are at least correctly recognized but they are also often recognized as groupname due to the phrase above. Obviously that means that the groupname is wrong anyway.

What can I do to recognize the correct Subtitle names and most of the groups?

If I remove everything relating to the Subtitles from the Scheme then the recognition is higher, but still not very good. eg.:
filename.x264-FDHQ -> filename [FDHQ]
filename.x265-FD -> filename [FD]
filename [WodkaE] -> filename
filename [EXQUISITE] ->filename
filename-Wodkae ->filename[Wodkae]
If I remove the "fn.match.." from the group the recognition is way worse, but forced and such is not recognized as a Sub anymore.

Is there an easy way to recognize the Subtitles correctly and at least more Groupnames?

How do I define an own method?
The "fileFolder" part is not working and I have no idea why.
I just want to move less kid friendly movies into other folders.

Re: How to distinguish Subtitles from Groupname?

Posted: 03 Aug 2020, 22:45
by kim
{fileFolder='dude'} = 'dude'
{fileFolder} = new {} = null

it only works IF within same {}

Re: How to distinguish Subtitles from Groupname?

Posted: 03 Aug 2020, 23:26
by kim
maybe you can use?

Code: Select all

{ def order = ['Horror': 1, 'Animation': 2, 'Comedy': 3, 'Science Fiction': 4, 'Action': 5, 'Adventure': 6].withDefault{ 100 }
		def map = ['Science Fiction': 'SciFi']
		def genres = localize.eng.genres.toSorted{ order[it] }*.replace(map)
		genres.first()+ ' Movies'
Custom Collections Library

Re: How to distinguish Subtitles from Groupname?

Posted: 04 Aug 2020, 04:02
by rednoah
Looks like {group} doesn't work well for standalone subtitle files. File-based bindings are usually based on the primary video file, which in the case of subtitles is a nearby video file.

Here's what I get from the built-in bindings for a simple test case:

Code: Select all

$ filebot -mediainfo . --format "{group} | {subt} | {}"
WodkaE | .eng.forced | Avatar 2009
WodkaE |  | Avatar 2009 WodkaE.mp4
:idea: I can't quite help you fix your entire format all at once, but if you can post simple test cases for simple components that don't work as expected, then we can look at those one by one, so that you can then build your complex format best on those simple components that are known to work as expected.

You can't define your own top-level bindings. You can define local variables and local methods though, but those will only be valid within the same top-level {...} expression.

If you're familiar with Groovy, then you may prefer to express your format within a single top-level {...} expression so that all your code runs within the same Groovy context to give yourself more control, i.e. local variables, local methods, exception handling, etc:

Code: Select all

	def fileName = "$n [$y]"
	def folderName = any{genres[0]}{'No Genre'}
	return "Movies" / folderName / fileName
:idea: viewtopic.php?t=1895