Matching All Episodes of the same source vs mixed issue.

All about user-defined episode / movie / file name format expressions
Post Reply
DevXen
Power User
Posts: 164
Joined: 12 Oct 2014, 21:15

Matching All Episodes of the same source vs mixed issue.

Post by DevXen »

So I'm trying to match all the sources of a single season. and if the match say what it is: DVDRip, BDRip, Etc. But if they are different between them, I want it to show Mixed. and if there is no source Listed, it should just say No Source.

So i'm using this:

Code: Select all

{def sources = model.findAll{ it.n == n && it.s == s }.source.minus(null).unique(); sources.size() >= 1 ? sources.size() == 1 ? "["+any{(csv('C:/FileBot Settings/Movies/MovieSource.csv').get(source))}{source}+"]" : '[Mixed]' : '[No Source]'}
It seems to work great except not when the case is different. so HDTV, and hdtv in the same folder returns [Mixed] instead of HDTV. and i'm not sure how to fix it, i'd assume it is the unique() in it. but taking that out didn't help. or if i could map that also to my CSV file so it can match hdtv to HDTV. then i'd guess that would work too. But i haven't been able to figure out how to get that to work either. boo.

the problem would also happen with any mixed case files, DVDRIP/DVDRip/BDRip/BDRIP/BdRip/etc


Any Suggestions?


The CSV File is so I can map my own source names and casing. also Pay no attention to the MovieSources.csv figure i'd use the same for movies and tv shows)


Thanks,
-Dev
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Matching All Episodes of the same source vs mixed issue.

Post by rednoah »

Have you tried replacing .unique() with .unique{ it.upper() } yet?
:idea: Please read the FAQ and How to Request Help.
DevXen
Power User
Posts: 164
Joined: 12 Oct 2014, 21:15

Re: Matching All Episodes of the same source vs mixed issue.

Post by DevXen »

That seems to be working. i'm not sure why i didn't think to turn it all uppercase. Thank you.


Also, I did start to notice something today. my {Source} is bringing back: NF.WEB-DL, HULU.WEB-DL, AMZN.WEB-DL, Etc.

Obviously thats where they came from in the file name. But thats causing issues with my script.

is there a way to disable that so it uses the normal {source} (not VS I think WEBRip, and WEB-DL Should be separate. haha.)

and or is there way to separate it so i can keep that streaming provider information. and the source. just separate them into 2 locations?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Matching All Episodes of the same source vs mixed issue.

Post by rednoah »

Using vs instead of source will give you more standardized values:
viewtopic.php?t=11265
:idea: Please read the FAQ and How to Request Help.
DevXen
Power User
Posts: 164
Joined: 12 Oct 2014, 21:15

Re: Matching All Episodes of the same source vs mixed issue.

Post by DevXen »

Yeah. I don't agree with many of the VS normalizations, Is why I'm not using that. Really I'm just trying to get rid of all my .replace()'s I have in my script for my sources and move them to an easier to manage csv file. But this adding the streaming as part of the {source} is new.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Matching All Episodes of the same source vs mixed issue.

Post by rednoah »

Although source rarely changes, it is fluid by design. You can always do your own "normalization" though.

e.g.

Code: Select all

{
	def mapping = csv('MovieSource.csv').withDefault{ 'Unmapped Source' }
	def sources = model.findAll{ it.id == id && it.s == s }.source.findResults{ mapping[it] }.unique()
	sources.size() >= 1 ? sources.size() == 1 ? sources[0] : '[Mixed]' : '[No Source]'
}
(NOTE: untested code)
:idea: Please read the FAQ and How to Request Help.
DevXen
Power User
Posts: 164
Joined: 12 Oct 2014, 21:15

Re: Matching All Episodes of the same source vs mixed issue.

Post by DevXen »

Trying that and a few variations it returns: [UnsupportedOperationException]

But I get the feeling it will look for all sources in my mapping. and if its not in there throw an error.
Though i did try to add NF.WEB-DL, and WEB-DL mappings. to test and that didn't help.

Also strange cause it shows up on the preview in the dialog box as it should be for the test file.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Matching All Episodes of the same source vs mixed issue.

Post by rednoah »

{model} can't be tested well without real matches.


Here's a working unit test for the lookup table though:

Code: Select all

{
	def table = ['DRIP': 'DVDRip']
	def mapping = table.withDefault{ 'Unmapped Source' }
	mapping['DRIP'] + ';' + mapping['TEST']
}

Code: Select all

DVDRip;Unmapped Source
:idea: Please read the FAQ and How to Request Help.
DevXen
Power User
Posts: 164
Joined: 12 Oct 2014, 21:15

Re: Matching All Episodes of the same source vs mixed issue.

Post by DevXen »

On I'll mess with that and see what I can do. Thank you.

I guess my main issue is. If I'm matching the source to see if they all match. If I have 2 WEB-DL from different download services they won't match. But I'm sure I'll figure something out.
Post Reply