Page 1 of 1

Add source binding only for specific files

Posted: 01 Oct 2016, 13:07
by Partino
HI!

First of all, thanks for this awesome program.
Used it years (not to it's full extent) on my old windows machine.
Now switched to a Mac and as with everything new you get, you want it to be perfect.
So I try to use more of it's functionality now. Problem is, I don't know how to get things done the way,
I imagine things should go

I want FileBot to add the source binding only to files that are met by certain criteria.
e.g.
The Exorcist S01E01 REPACK 720p HDTV x264-KILLERS

to

Exorcist, The - S01E01 - Chapter One - And Let My Cry Come Unto Thee (HDTV)

but

The Exorcist S01E01 1080p WEB-DL DD5.1 H.264-KiNGS

not to

Exorcist, The - S01E01 - Chapter One - And Let My Cry Come Unto Thee (WEB-DL)

but to

Exorcist, The - S01E01 - Chapter One - And Let My Cry Come Unto Thee
With one and the same Naming scheme?

Is this wonderful program capable of doing this? :D

Re: Add source binding only for specific files

Posted: 01 Oct 2016, 13:19
by rednoah
There is many ways to do this. This is one of them:

Code: Select all

{source.replace('WEB-DL', '')}

Re: Add source binding only for specific files

Posted: 01 Oct 2016, 20:42
by Partino
Thank you very much for that quick reply. It works perfectly except for the brackets "()" when the source WEB-DL is detected. I only want those brackets when the source is anything BUT WEB-DL (or Blu-Ray or Web-Rip etc)

How do I avoid that?

Code: Select all

{n =~ /^The / ? n[4..-1]+', The' : n =~ /^A / ? n[2..-1]+', A' : n} - {s00e00} - {t.replace(':', ' -')replacePart(' (Part $1)')} ({source.replace('WEB-DL', '')})
gives me

Code: Select all

Exorcist, The - S01E01 - Chapter One - And Let My Cry Come Unto Thee ()
Those brackets at the end are kinda hideous :lol:

Re: Add source binding only for specific files

Posted: 02 Oct 2016, 01:57
by rednoah
In that case I'd probably use an if-then-else block.

Code: Select all

source == /xyz/ ? null : "($source)"

Re: Add source binding only for specific files

Posted: 03 Oct 2016, 07:41
by Partino
That works perfectly! Thank you! Do I put other sources into xyz separated by a symbol (if so, which one and how) or do I need to make another block for each specific source?

Re: Add source binding only for specific files

Posted: 03 Oct 2016, 14:26
by rednoah
You can use regular expressions:

Code: Select all

source ==~ /WEB.DL|ABC|XYZ/ ? null : "($source)"
But if you want to include rather than exclude you can do something like this:

Code: Select all

{'('+source.match(/BluRay|ABC|XYZ/)+')'}

Re: Add source binding only for specific files

Posted: 12 Oct 2016, 08:35
by Partino
THANK YOU!!

Code: Select all

{'('+source.match(/BluRay|ABC|XYZ/)+')'}
works like a charm. Thank you, thank you, thank you.

Can I trouble you one more time? :oops:

I seem to not get replacePart( '[$1]') to work ...

That is my current format:

Code: Select all

{n.replace(':',' - ').replaceAll(/[\/:*"<>|]/,'-')sortName('$2, $1')} - {s00e00} - {t.replace(':', ' -').replacePart( '[$1]')} {'('+vf.match(/720p|480p|360p/)+')'} {'('+source.match(/WEBRip|HDTV|WEB-DL|DVD/)+')'}
and it gives me this:

Image

How? Why? WHERE DID I GO WRONG!!!? Help me please. :'(

Re: Add source binding only for specific files

Posted: 12 Oct 2016, 08:56
by rednoah
The latest version scrubs {t} too thoroughly so replacePart doesn't work.

Try the latest revision or pre-release:
viewtopic.php?f=7&t=1609

Re: Add source binding only for specific files

Posted: 12 Oct 2016, 09:46
by Partino
So basically I should wait for an update. Nothing wrong with that.


Can I bother you with my final questions? :oops:

:arrow: Why do I need to do this:

Code: Select all

replace(':',' - ').replaceAll(/[\/:*"<>|]/,'-')
What's the difference between replace and replaceAll and
what does the dot between those two bindings do and why do I need it?

Your signature really tells it like it is. You give EXCELLENT support. :mrgreen: :mrgreen: :mrgreen:

Re: Add source binding only for specific files

Posted: 12 Oct 2016, 15:40
by rednoah
1.
Means you can download an update from here: https://sourceforge.net/projects/filebo ... ebot/HEAD/

2.
You don't really need this. FileBot will strip illegal characters automatically. Any basic Java tutorial will explain the rest. ;)