Page 1 of 1

Episode count on seasons not working

Posted: 02 Jan 2024, 15:23
by vballrican
Hello, i have this naming format and the show name gives me the total episode but the season episode count is not working and returning 0. How can i fix this?

Format: Select all

/Processed/{n} ({episodelist.size()}EP) [{info.certifications.usa}, {genre}, {y}]/{'Season ' +s} - {episodelist.count{ it.episode && it.season == s }}EP/{n} - {s00e00} - {t.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, /'/).replacePart(', Part $1')} ({megabytes})({minutes} Min)({airdate.format("MM-dd-yyyy")})
i used the format here: viewtopic.php?t=1611

Show is: Another Period (32EP) [TV-14, Comedy, 2015]
But season(i tested with season 2) shows as: Season 2 - 0EP

Thanks.

Re: Episode count on seasons not working

Posted: 02 Jan 2024, 16:05
by rednoah
{episodelist} has changed slightly. The changes are primarily that {episodelist} now works exactly the same as {model}.


e.g. Number of episodes for the season at hand:

Format: Select all

{
	' (' + episodelist.count{ it.e && it.s == s }.pad(2) + ' EP)'
}

Re: Episode count on seasons not working

Posted: 02 Jan 2024, 16:16
by vballrican
Thanks.. i just found

Code: Select all

{episodelist.findAll{ s == it.s }.e.max()}
and it works!

Re: Episode count on seasons not working

Posted: 02 Jan 2024, 16:20
by rednoah
Note that you are simply using the maximum episode number, which is not always the same as counting episodes. If the series skips episode numbers and starts with S01E101 and ends with S01E120 then your code will yield 120. You may also want to account for (by not counting) special episodes, in cases where there are specials that belong to some season.

Re: Episode count on seasons not working

Posted: 02 Jan 2024, 16:24
by vballrican
Ohh.. what should i use then? I just want the series name to have the total episodes (without specials) for regular series and season counts, and maybe with specials for anime series with season counts.

I also saw somewhere that we can add whether a series is complete or incomplete...

do you have a link where i can find the code to add to my string? it's getting kinda long now.. Thanks.

Re: Episode count on seasons not working

Posted: 02 Jan 2024, 16:25
by vballrican
this is my current string:

Code: Select all

/Processed/{n} ({episodelist.size()}EP) [{info.certifications.usa}, {genre}, {y}]/{'Season ' +s} ({episodelist.findAll{ s == it.s }.e.max()})EP /{n} - {s00e00} - {t.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, /'/).replacePart(', Part $1')} ({megabytes})({minutes} Min)({airdate.format("MM-dd-yyyy")})

Re: Episode count on seasons not working

Posted: 02 Jan 2024, 17:33
by vballrican
Any ideas?

Re: Episode count on seasons not working

Posted: 02 Jan 2024, 17:55
by rednoah
The solution is this:
rednoah wrote: 02 Jan 2024, 16:05 e.g. Number of episodes for the season at hand:

Format: Select all

{
	' (' + episodelist.count{ it.e && it.s == s }.pad(2) + ' EP)'
}
:idea: This code will add something like (10 EP) to the file path. Add this code to your format at the position where you want the season episode number to appear.




EDIT:

Adding [complete] vs [incomplete] works like this:
rednoah wrote: 14 Dec 2023, 19:21

Format: Select all

{
	model.episodes.flatten().containsAll(episodelist.findAll{ it.e && it.s == s }.episode) ? ' [complete]' : ' [incomplete]'
}
:arrow: viewtopic.php?t=13881

Re: Episode count on seasons not working

Posted: 02 Jan 2024, 19:20
by vballrican
Thank you!

Re: Episode count on seasons not working

Posted: 02 Jan 2024, 19:30
by vballrican
Adding [complete] vs [incomplete] works like this:
rednoah wrote: 14 Dec 2023, 19:21

Format: Select all

{
	model.episodes.flatten().containsAll(episodelist.findAll{ it.e && it.s == s }.episode) ? ' [complete]' : ' [incomplete]'
}
:arrow: viewtopic.php?t=13881
[/quote]

Ok, added this to my string and it's putting complete in all shows.. even the incomplete ones.

this is my string:

Code: Select all

/Processed/{n} ({episodelist.size()}EP) [{info.certifications.usa}, {genre}, {y}]{model.episodes.flatten().containsAll(episodelist.findAll{ it.e && it.s == s }.episode) ? ' [complete]' : ' [incomplete]'
}/{'Season ' +s} ({episodelist.findAll{ s == it.s }.e.max()})EP /{n} - {s00e00} - {t.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, /'/).replacePart(', Part $1')} ({megabytes})({minutes} Min)({airdate.format("MM-dd-yyyy")})
Thanks.

Re: Episode count on seasons not working

Posted: 02 Jan 2024, 20:28
by vballrican
:( It's not changing the complete to incomplete if episodes/seasons are missing... what can i check? Thanks.

Re: Episode count on seasons not working

Posted: 02 Jan 2024, 20:38
by vballrican
oh.. wait, does this only work if there's a folder with season XX already? I did a different show and on one season it says incomplete because that season is missing episode 7... but the show as a whole is missing 2 seasons... :| any workaround? Thanks.

Re: Episode count on seasons not working

Posted: 02 Jan 2024, 20:47
by rednoah
{model} refers to the matches currently loaded into FileBot. The code above will indeed only consider files / episodes currently loaded into FileBot. Files that may or may not be somewhere in your file system are not considered.

Re: Episode count on seasons not working

Posted: 02 Jan 2024, 20:52
by vballrican
So there's no way of telling if a Show is incomplete or not? I loaded all the files from the show but it's says incomplete because 2 seasons are missing...

Re: Episode count on seasons not working

Posted: 02 Jan 2024, 20:54
by rednoah
If you have all the episodes that are in the episode list for that season, then a season is considered complete as defined by the code we have written:

Format: Select all

~/{n}
/Season {s}
{
	model.episodes.flatten().containsAll(episodelist.findAll{ it.e && it.s == s }.episode) ? ' [complete]' : ' [incomplete]'
}
/{plex.name}
Image

Image

Re: Episode count on seasons not working

Posted: 02 Jan 2024, 20:56
by rednoah
vballrican wrote: 02 Jan 2024, 20:52 So there's no way of telling if a Show is incomplete or not? I loaded all the files from the show but it's says incomplete because 2 seasons are missing...
:?: How do you know if a show is incomplete? What something do you check to find out if a show is complete or not? Does the code above not do what you mean to do?

Re: Episode count on seasons not working

Posted: 03 Jan 2024, 02:47
by vballrican
Well, that's what i wanted the code to tell me... the test show i was using, was incomplete... it was missing 2 seasons but it said it was complete. The code's complete/incomplete works but for seasons, not the show... :|

Re: Episode count on seasons not working

Posted: 03 Jan 2024, 14:14
by vballrican
Sorry, i apologize.. this works as intended.. it creates directories with complete and incomplete as needed... it's multiple directories per show, but works.

I was looking to get just one show directory with either complete or incomplete, then i would look inside the incomplete one to see which seasons were tagged incomplete and try and get those. But this will do for now. thanks for the help.

Re: Episode count on seasons not working

Posted: 03 Jan 2024, 16:28
by rednoah
Yep, should work as intended then. At least for all my test cases. If you find a test case that doesn't work, just post screenshots and sample file paths as text so that we can have a look.