Page 1 of 1
Using {model} for dealing with collections holistically
Posted: 09 May 2020, 18:41
by AbedlaPaille
Amazing stuff, delighted about this. Getting euphoria rushes working on my format scheme, filebot comfirmed more thrilling than most AAA games
Question:
Code: Select all
{model.episode.containsAll(episodelist) ? '[complete]' : '[incomplete]'}
Possible to adapt this to collections? No success so far but i'm sure it's because i'm a noob
And is {model} potentially capable of preventing a collection hierarchy from being created? eg if there's only 1 item belonging to the collection in the processed batch
Haven't managed to adapt {model} to the subtitle use case i was telling you about in this thread
viewtopic.php?f=8&t=6291&p=50497#p50497 though so if you have any hint for a baby programmer like myself
Thanks in advance !
Re: [DOCS] Holistic formats with the {model} binding
Posted: 10 May 2020, 03:56
by rednoah
1.
{movie.collection} is a relatively new addition that will allow you to retrieve the entire list of collection entries, so based on that it should be doable.
2.
As for subtitles, you'd have to use {model} to group files by all your criteria, same movie, same extension, same language, etc and then that should give a list of duplicates (i.e. one key, multiple values) from which you can then derive index and count.
Re: Using {model} for dealing with collections holistically
Posted: 10 May 2020, 18:23
by kim
so...
Code: Select all
{ model.movie.containsAll(movie.collection) ? '[complete]' : '[incomplete]' }
Code: Select all
{ model.movie.unique().size() == 1 ? 'only 1 movie on list' : '2 or more' }
Re: Using {model} for dealing with collections holistically
Posted: 12 May 2020, 04:29
by AbedlaPaille
Thanks guys. Kim the first one works great but does the second one work on your end?
Re: Using {model} for dealing with collections holistically
Posted: 12 May 2020, 06:53
by rednoah
AbedlaPaille wrote: ↑12 May 2020, 04:29
Thanks guys. Kim the first one works great but does the second one work on your end?
Since
{model} is involved, it's perfectly possible for this to work in one context but not another. So a screenshot of
Rename is very much required, otherwise you will end up talking apples and bananas.
Re: Using {model} for dealing with collections holistically
Posted: 17 May 2020, 22:46
by AbedlaPaille
I now realize Kim's 2nd expression works, just differently than i assumed. It differenciates based on how many movies are in the processed batch rather than how many movies of the same collection are in the same batch.
e.g. collection with only one movie processed = treat as single movie, collection with more than one = treat as collection
I think i need to use his first example except instead of containsAll write something akin to contains < 2? No success so far
Re: Using {model} for dealing with collections holistically
Posted: 25 May 2020, 04:08
by AbedlaPaille
collection with only one movie processed = treat as single movie, collection with more than one = treat as collection
Any help to make this happen?
Re: Using {model} for dealing with collections holistically
Posted: 25 May 2020, 04:32
by kim
small change
Code: Select all
{movie.collection.size() == 1 ? 'only 1 movie on list' : '2 or more' }
Re: Using {model} for dealing with collections holistically
Posted: 25 May 2020, 04:33
by rednoah
*
{movie.collection} will give you the entire collection for a given movie
*
{model.movie} will give you all the movies that you see in
New Names
At a glance, I think what you want should be doable based on the above mentioned building blocks. You'll probably need to intersect those two sets to see what remains.
e.g.
Code: Select all
{
// missing collection entries
def missing = movie.collection - model.movie
missing.size == movie.collection.size - 1
? 'Single Entry'
: missing.empty
? 'Complete Collection'
: 'Multi Entry'
}
Re: Using {model} for dealing with collections holistically
Posted: 25 May 2020, 04:37
by kim
the simple
Code: Select all
{movie.collection.size() == model.movie.unique().size() ? '[complete]' : '[incomplete]'}
Re: Using {model} for dealing with collections holistically
Posted: 25 May 2020, 05:03
by AbedlaPaille
Holy molly this works ! Genius !! Thanks a lot guys this is fantastic
Re: Using {model} for dealing with collections holistically
Posted: 25 May 2020, 05:04
by kim
I think you are looking for something like this?
Code: Select all
{ any{model.movie.containsAll(movie.collection) && movie.collection.size() == model.movie.unique().size() ? collection + ' [complete]/' : collection + ' [incomplete]/' }{''}}{ny}
Re: Using {model} for dealing with collections holistically
Posted: 05 Jun 2020, 12:36
by AbedlaPaille
Hi!
Code: Select all
{
// missing collection entries
def missing = movie.collection - model.movie
missing.size == movie.collection.size - 1
? 'Single Entry'
: missing.empty
? 'Complete Collection'
: 'Multi Entry'
}
I'm trying to setup a --filter to do something similar. I want to catch all collections that aren't single entries, like i'm doing in my schemes with a light version of your snippet :
Code: Select all
{ def missing = movie.collection - model.movie; missing.size == movie.collection.size - 1 ? '' : collection.replaceAll(/[:|]/, " - ") }
How do i adapt this into a --filter ?
Re: Using {model} for dealing with collections holistically
Posted: 05 Jun 2020, 13:19
by rednoah
What would the purpose of a
--filter based on collections be? Exclude movie options that don't belong to any collection before matching?
{model} doesn't work without
rename context. The
{model} is the result of matching all the files up with movies, while
--filter is used to select movies for matching.
{model} cannot exist yet at
--filter time, because it comes into existence as a result of filtering and matching.
Re: Using {model} for dealing with collections holistically
Posted: 05 Jun 2020, 13:42
by AbedlaPaille
What would the purpose of a --filter based on collections be? Exclude movie options that don't belong to any collection before matching?
Yes i'm trying to make a hardlink folder just for my multi entry collections. In my head it goes something like that :
Code: Select all
filebot -rename -r "F:/Plex/" --db xattr --action hardlink --output "F:/Collections/" --filter "D:/CollectionsFilter.groovy" --format "D:/CollectionsFormat.groovy"
Any ideas on how i could get something similar working?
Re: Using {model} for dealing with collections holistically
Posted: 05 Jun 2020, 14:39
by rednoah
If you want to select all movies that belong to any collection, then this will do:
Re: Using {model} for dealing with collections holistically
Posted: 09 Jun 2020, 10:20
by AbedlaPaille
I ended up using --filter collection and a 'All' folder within for the single entry ones. Keeps things easy to browse.