Source Media {vs} and {source}

All about user-defined episode / movie format expressions
Post Reply
User avatar
rednoah
The Source
Posts: 19010
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Source Media {vs} and {source}

Post by rednoah »

The source media (e.g. BluRay, WEB-DL, etc) can only be detected based on the file name.

  • {vs} ... the standardized source media value regardless of which exact pattern was a match (e.g. any match for BluRay / BDRip / BD50 / etc yields BluRay)
  • {source} ... the exact pattern match based on the file name (e.g. match for BD50 yields BD50)


FileBot uses the following patterns:
https://github.com/filebot/data/blob/master/media-sources.txt


:idea: FileBot will check not only {fn} (file name) but also {original} (original file name recorded via xattr) as well as {mediaTitle} (embedded media title) for source pattern matches. The order of precedence is mediaTitle, then original, then fn as last resort.


:idea: Changes in classification and additional patterns can be added upon request. Please post change requests (including example file paths) here.
:idea: Please read the FAQ and How to Request Help.
devster
Posts: 388
Joined: 06 Jun 2017, 22:56

Re: Source Media {vs} and {source}

Post by devster »

Is source now an exact match for case as well?
It seems that the following happens:

Code: Select all

fn: aaaaa.s01e01.hdtv.mkv => nice name - S01E01 - hdtv.mkv
fn: aaaaa.s01e01.HDTV.mkv => nice name - S01E01 - HDTV.mkv
As a corollary, how could I get the same behaviour as before (capital HDTV on non-capital match) or alternatively how could I choose {vs} over {source} only for specific values?
I only work in black and sometimes very, very dark grey. (Batman)
User avatar
rednoah
The Source
Posts: 19010
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Source Media {vs} and {source}

Post by rednoah »

You can do {vs.upper()} and {source.upper()} if you want an uppercase value.
:idea: Please read the FAQ and How to Request Help.
devster
Posts: 388
Joined: 06 Jun 2017, 22:56

Re: Source Media {vs} and {source}

Post by devster »

Not quite, I want BluRay and HDTV from {vs}, but I do my own matching for anything WEB.*
Hence the difference.
I'm currently doing:

Code: Select all

String src
if (['BluRay', 'HDTV'].contains(vs) {
  src = vs
} else {
  src = source
} 
just wondering if there's a better way.
I only work in black and sometimes very, very dark grey. (Batman)
User avatar
rednoah
The Source
Posts: 19010
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Source Media {vs} and {source}

Post by rednoah »

Well, I guess I'd write it like this:

Code: Select all

def src = vs =~ /BluRay|HDTV/ ? vs : source
:idea: Please read the FAQ and How to Request Help.
DevXen
Power User
Posts: 132
Joined: 12 Oct 2014, 21:15

Re: Source Media {vs} and {source}

Post by DevXen »

So.. VOD Isn't a valid source anymore?
kim
Power User
Posts: 1027
Joined: 15 May 2014, 16:17

Re: Source Media {vs} and {source}

Post by kim »

Code: Select all

VODR|VODRip

Code: Select all

WEB-DL	(?:(?:ABC|ATVP|AMZN|BBC|CBS|CC|CR|CW|DCU|DSNP|DSNY|FBWatch|FREE|FOX|HMAX|HULU|iP|LIFE|MTV|NBC|NICK|NF|RED|TF1|STZ)[.-])?(?:WEB.?DL|WEB.?DLRip|WEB.?Cap|WEB.?Rip|HC|HD.?Rip|VODR|VODRip|PPV|PPVRip|iTunesHD|ithd|AmazonHD|NetflixHD|NetflixUHD|(?<=\d{3,4}[p].)WEB|WEB(?=.[hx]\d{3}))
so same as before, but now converted to WEB-DL
mterrill
Posts: 22
Joined: 21 May 2018, 21:08

Re: Source Media {vs} and {source}

Post by mterrill »

kim wrote: 14 Jun 2020, 21:40

Code: Select all

WEB-DL	(?:(?:ABC|ATVP|AMZN|BBC|CBS|CC|CR|CW|DCU|DSNP|DSNY|FBWatch|FREE|FOX|HMAX|HULU|iP|LIFE|MTV|NBC|NICK|NF|RED|TF1|STZ)[.-])?(?:WEB.?DL|WEB.?DLRip|WEB.?Cap|WEB.?Rip|HC|HD.?Rip|VODR|VODRip|PPV|PPVRip|iTunesHD|ithd|AmazonHD|NetflixHD|NetflixUHD|(?<=\d{3,4}[p].)WEB|WEB(?=.[hx]\d{3}))
I get "SyntaxError: Unexpected input: ','; Expecting <EOF>" when trying to use this, can I get some help on this one?
kim
Power User
Posts: 1027
Joined: 15 May 2014, 16:17

Re: Source Media {vs} and {source}

Post by kim »

it's not format code

standardized =

Code: Select all

{vs}
correct way ;) =

Code: Select all

{source}
but you can use this:

Code: Select all

{fn.replaceAll(/(?i)(?:(?:ABC|ATVP|AMZN|BBC|CBS|CC|CR|CW|DCU|DSNP|DSNY|FBWatch|FREE|FOX|HMAX|HULU|iP|LIFE|MTV|NBC|NICK|NF|RED|TF1|STZ)[.-])?(?:WEB.?DL|WEB.?DLRip|WEB.?Cap|WEB.?Rip|HC|HD.?Rip|VODR|VODRip|PPV|PPVRip|iTunesHD|ithd|AmazonHD|NetflixHD|NetflixUHD|(?<=\d{3,4}[p].)WEB|WEB(?=.[hx]\d{3}))/,'WEB-DL')}
mterrill
Posts: 22
Joined: 21 May 2018, 21:08

Re: Source Media {vs} and {source}

Post by mterrill »

kim wrote: 15 Jun 2020, 01:11 it's not format code
Thanks, I think i need to work out what is doing what in there..... i.e. the basics of what (?<=\d{3,4}[p].) does etc....

I guess what I was looking for was a spaced out output and keeping it sort of simple, i.e. only naming a webrip, webdl and if not labelled then I know it is blu ray...

Thanks for explaining the error though :)
kim
Power User
Posts: 1027
Joined: 15 May 2014, 16:17

Re: Source Media {vs} and {source}

Post by kim »

it's Regular Expressions
https://regexr.com/

Code: Select all

\d{3,4}[p]
= e.g. 720p or 1080p
devster
Posts: 388
Joined: 06 Jun 2017, 22:56

Re: Source Media {vs} and {source}

Post by devster »

Is there a way to customise the map {vs} uses?
I find it a bit too restrictive.
I only work in black and sometimes very, very dark grey. (Batman)
User avatar
rednoah
The Source
Posts: 19010
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Source Media {vs} and {source}

Post by rednoah »

You can always create your own map and your own code and conditions. A couple of lines of Groovy code at most, so it's more straight-forward to just write your own code.

Things can be added to the map though, if you find something missing.
:idea: Please read the FAQ and How to Request Help.
devster
Posts: 388
Joined: 06 Jun 2017, 22:56

Re: Source Media {vs} and {source}

Post by devster »

Any examples for these lines of code?
My customisation is related to web sources, which you currently bundle in WEB-DL, I have some lines to match them separately.
Another small issue is that {source} seems to respect original case now dvdrip will result in dvdrip instead of DVDRip as before, not sure if it's because of my code.
I only work in black and sometimes very, very dark grey. (Batman)
User avatar
rednoah
The Source
Posts: 19010
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Source Media {vs} and {source}

Post by rednoah »

e.g.

Code: Select all

def input = 'Avatar DVDRip'
def patterns = [
	'DVD' : 'DVD|DVDRip'
]
patterns.findResult{ s, p -> input.findMatch(p) ? s : null }
:idea: {source} is supposed to return the pattern match, but one or two older versions did indeed incorrectly force uppercase.
:idea: Please read the FAQ and How to Request Help.
andy22
Posts: 10
Joined: 17 Aug 2020, 16:59

Re: Source Media {vs} and {source}

Post by andy22 »

Anidb uses 'www' as web-dl tag and also has 'HD-DVD' see: https://wiki.anidb.net/Content:Files#Qu ... itle_files
User avatar
rednoah
The Source
Posts: 19010
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Source Media {vs} and {source}

Post by rednoah »

I've added www but if it causes false positives or other indirect issues I might remove it again.
:idea: Please read the FAQ and How to Request Help.
Post Reply