Sort into Complete/Incomplete folders?

All your suggestions, requests and ideas for future development
Post Reply
DevXen
Power User
Posts: 164
Joined: 12 Oct 2014, 21:15

Sort into Complete/Incomplete folders?

Post by DevXen »

Yeah, I'm curious is this no longer working in the current version?

Sort into different folders depending on whether the season is complete or not:

{n}/Season {s} {model.values().containsAll(episodelist.findAll{it.season == s}) ? 'COMPLETE' : 'INCOMPLETE'}/{episode}

Sort into Season {s} COMPLETE|INCOMPLETE folders depending in whether the output model contains all Episode objects for the season of the give episode object.
I put only that as the episode format naming scheme to test it and it returns as:
ShowName/Season #/Showname - sxe - EpisodeTitle

I tried this with:
A current airing show (that only a few episodes have aired so far)
A Show that the season has ended (Added 3 Episodes)
A Show that the season has ended (Added Every episode of the season)
A Show that the series has completed. (added 3 random episodes)

each one showed the same format
I couldn't get it to show 'Complete' or 'Incomplete' to show in the New Names field window.

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

Re: Sort into Complete/Incomplete folders?

Post by rednoah »

This is how you'd write it in v4.5 or above:

Code: Select all

{n}/Season {s} {model.episode.containsAll(episodelist.findAll{it.season == s}) ? 'COMPLETE' : 'INCOMPLETE'}/{episode}
Note that {model} refers to what is loaded (and matched) into FileBot, so it's highly context sensitive. In this example we assume that you loaded all episodes of the season into FileBot. So this approach only works if you process a full season at a time.
:idea: Please read the FAQ and How to Request Help.
DevXen
Power User
Posts: 164
Joined: 12 Oct 2014, 21:15

Re: Sort into Complete/Incomplete folders?

Post by DevXen »

I know I replied thanking you, it must not of gone through. But thank you. having it based on the files loaded, is exactly what I needed, and that {model} has helped me get additional info too. so thank you for that tip as well.

I am curious though. is there a way to move into 3 separate folders, instead of 2? Complete/Incomplete is nice, and if that's all that's possible I'll work with it.

But i'd like to Sort into a folder if the season is complete.
Then i'd like it to sort into a different folder if the season is not complete (But the whole season has aired)
Then I'd like to sort into a different folder if the season is not complete (But not all episodes in the season have aired yet.)
So it'd be: Complete / Incomplete / Currently Airing
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Sort into Complete/Incomplete folders?

Post by rednoah »

Yeah, but then you'll get into a habit of re-processing everything over and over. That's not a good idea. And a waste of resources. And will get you banned if you happen to do it short intervals. ;)

Structure that changes over time is not a good idea. Files should never change location. If you need advanced lookup / search / filtering functionality for your media files you should use Plex or Kodi/XBMC or any of the other HTPC software that reads in your files and then displays them however you want.
:idea: Please read the FAQ and How to Request Help.
DevXen
Power User
Posts: 164
Joined: 12 Oct 2014, 21:15

Re: Sort into Complete/Incomplete folders?

Post by DevXen »

Ok.
Trying just this, and nothing else: {n}/Season {s} {model.episode.containsAll(episodelist.findAll{it.season == s}) ? 'COMPLETE' : 'INCOMPLETE'}/{episode}
It's not matching complete/Incomplete seasons correctly. it did on one show I tested the first 3 seasons on. But every other full season from several other shows I tried came back as Incomplete. I tried several things I could think of, but I wasn't able to correct it.

Here's a screen shot.
Image

I though the problem might of been specials listed on thetvdb. for the current season. but that wasn't the case.

Image

Ok, I have found From further testing. that on some of them (not all) it does work if i look on TVRage and not TheTVDB
So that's a little odd. but many show as incomplete (instead of complete) using either databases.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Sort into Complete/Incomplete folders?

Post by rednoah »

First you need to understand what this does:

Code: Select all

{model.episode.containsAll(episodelist.findAll{it.season == s})}
For that we need to know:

Code: Select all

{model.episode}

Code: Select all

{episodelist.findAll{it.season == s}}
Since now you can see what Set A and Set B are you should be able to check why Set A does contain all elements of Set B in some cases, but not others.

EDIT: I've tried with About a Boy 01-13 and it works for me (with TheTVDB).
:idea: Please read the FAQ and How to Request Help.
DevXen
Power User
Posts: 164
Joined: 12 Oct 2014, 21:15

Re: Sort into Complete/Incomplete folders?

Post by DevXen »

So. My computer just Froze and now it seems to be working. So I apologize, I guess it could of been an issue with my own computer.

I did try both: {model.episode}, and {episodelist.findAll{it.season == s}} Separately/On their own. To understand them. and they both displayed the same result.
But as I said, even the original one is working now, when it wasn't before, as shown in the screen shots... weird. But thank you once again, for your help. I appreciate it.
DevXen
Power User
Posts: 164
Joined: 12 Oct 2014, 21:15

Re: Sort into Complete/Incomplete folders?

Post by DevXen »

Yeah, it's working with About a boy for me now too. as i Explained, the only difference, was my PC froze, when i got it back up it was working on that one.

One it's still not working on though, is Brooklyn Nine-Nine, and that's cause the: {episodelist.findAll{it.season == s}} is showing a special episode in the season uhm:
Brooklyn Nine-Nine - 1Special 1 - Six Minute Preview.

How would i make it so it doesn't pull the Specials up in the match?
I have tried a few things. but nothing has worked yet. But that very well could of been the problem with others i've tried as well.


Also I found another issue as well.
http://thetvdb.com/?tab=season&seriesid ... 5778&lid=7
in this show. there were only 19 episodes, but there is a spot for a 20th one that never aired, or was listed.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Sort into Complete/Incomplete folders?

Post by rednoah »

I see how that'd mess with the logic.

I'd check for:
* check episode number (null for specials)
* check episode title (null or empty)

Code: Select all

{episodelist.findAll{it.season == s && it.episode && it.title}}
0, null, empty string, empty collection, ... will all be interpreted as false by Groovy Truth.
:idea: Please read the FAQ and How to Request Help.
DevXen
Power User
Posts: 164
Joined: 12 Oct 2014, 21:15

Re: Sort into Complete/Incomplete folders?

Post by DevXen »

I've been working with this: {episodelist.findAll{it.season == s && it.episode && it.title}}
Now it's pulling the episodes from the 2nd season in. so it doesn't match.

Brooklyn Nine-Nine, ends at episode 22. - in the pic you can see it goes beyond that, and it's matching the episodes of the 2nd season and displaying them as part of the first season.
(it does this for all 6 current episodes in season 2, i just wasn't able to stretch the window longer to show it in the Screen shot.)


Image


Edit: After further testing, it always was doing that with this show. - Displays all 22 episodes of the first season, then shows the the episodes in the second season, but marked as the first season. then shows the special. - cause I was focusing on the special, I didn't notice it previously) .. That's interesting. cause TheTVDB page, lists the last 6 episodes, as season 2, as they should be. not as it's adding them to the end of this list as season 1.

http://thetvdb.com/?tab=season&seriesid ... 9889&lid=7


Image
Image


And just to be safe. I even just checked all the other language links for the show to see if another country may have did the episodes/season in a different order, and they were all the same as well.

But the good news is the specials aren't showing up anymore. and neither are the 'not named or listed episodes' haha.
AbedlaPaille
Posts: 107
Joined: 12 Apr 2020, 04:02

Re: Sort into Complete/Incomplete folders?

Post by AbedlaPaille »

Code: Select all

{model.episode.containsAll(episodelist.findAll{it.season == s && it.episode && it.title}}
Testing that around it fails to understand S01E01-02 logic, it'll think the season is incomplete if you have those files. I guess there's a workaround given fn:miss is capable of seeing through it?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Sort into Complete/Incomplete folders?

Post by rednoah »

The {episodes} will give you access to the list of episodes, a list with 1 element for single episodes, and multiple episodes for multi-episode objects, so you might be able to rewrite the code like to consider all multi-episode components as well:

Code: Select all

{ model.episodes.flatten().containsAll(episodelist.findAll{ it.season == s && it.episode && it.title }) }
:idea: Please read the FAQ and How to Request Help.
AbedlaPaille
Posts: 107
Joined: 12 Apr 2020, 04:02

Re: Sort into Complete/Incomplete folders?

Post by AbedlaPaille »

That's a win, thank you !

I'm copying here the modification to only take into consideration episodes that have already been aired yet, if anyone's interested (credit rednoah)

Code: Select all

{ model.episodes.flatten().containsAll(episodelist.findAll{it.series == series && it.episode && it.title && it.airdate <= today }) }
Post Reply