Page 1 of 1

Detailed source binding

Posted: 05 Oct 2016, 20:08
by TehBotol
Seeing as there is now many source of webrip (amazon,netflix,hulu,etc) is it possible for filebot to recognize the filename as the webrip source binding?

so we can use the rename feature to include the source of the webrip?

maybe create new binding like source_full

here is some filename example
1080p.SPIK.WEBRip.AAC2.0.x264-NTb (SPIKE TV)
1080p.AMZN.WEBRip.DD5.1.x264-NTb (Amazon)
720p.HULU.WEBRip.AAC2.0.H264-NTb (Hulu)
1080p.DISC.WEBRip.AAC2.0.x264-NTb (Discovery)
1080p.NF.WEBRip.DD5.1.x264-NTb (Netflix)
1080p.CC.WEBRip.AAC2.0.x264-monkee
1080p.PBS.WEBRip.AAC2.0.H264-monkee
1080p.CRKL.WEBRip.AAC2.0.x264-monkee
1080p.HBO.WEBRip.DD5.1.H264-monkee
720p.EPIX.WEBRip.AAC2.0.H264-monkee
720p.AMBC.WEBRip.AAC2.0.x264-monkee
1080p.VICE.WEBRip.AAC2.0.H264-RTN
1080p.SYFY.WEBRip.AAC2.0.h264-BLUEPLANET
1080p.HN.WEBRip.DD5.1.H264-CasStudio
1080p.TLC.WEBRip.AAC2.0.x264-BTW
1080p.BRAV.WEBRip.AAC2.0.x264-BTW
1080p.NICK.WEBRip.AAC2.0.H264-TVSmash
720p.DSNY.WEBRip.AAC2.0.x264-TVSmash
720p.iP.WEBRip.H264-JiTB
720p.CBC.WEBRip.AAC2.0.H264-RTN

thanks

Re: Detailed source binding

Posted: 06 Oct 2016, 03:22
by rednoah
No, looking at the filenames that doesn't seem feasible.

You can always do it yourself:

Code: Select all

{fn.match(/amazon|netflix|hulu/)}

Re: Detailed source binding

Posted: 06 Oct 2016, 17:23
by TehBotol
thanks didn't know you could do that
also is it possible to rename say like if it found AMZN/NF in filename it will rename it to Amazon or Netflix

thanks again you are awesome

Re: Detailed source binding

Posted: 06 Oct 2016, 18:00
by rednoah
Sure, but if you have many of these mappings I'd define them in an external text file.

Here's a simple condition:

Code: Select all

{fn =~ /AMZN/ ? 'Amazon' : fn =~ /NF/ ? 'Netflix' : null}
@see viewtopic.php?f=5&t=4191
@see viewtopic.php?f=5&t=182

Re: Detailed source binding

Posted: 09 Oct 2016, 12:00
by TehBotol
wow that's awesome rednoah thanks for explaining it,

although it have one small problem as the fn.match is not case sensitive it will detect NF from file name like

tv series s01e01 confession.1080p

is there any way to make fn.match search case sensitive?
thanks again

Re: Detailed source binding

Posted: 09 Oct 2016, 12:41
by rednoah
String.match(regex) is case-insensitive by default. Groovy String =~ regex is not.

You can either use a case-insensitive regex:

Code: Select all

fn =~ /(?i)regex/
Alternatively, you can also use the FileBot built-in String.findMatch(regex) which is case-insensitive by default:

Code: Select all

fn.findMatch(/regex/)