Episode count on seasons not working

Support for Windows users
Post Reply
vballrican
Donor
Posts: 80
Joined: 21 Dec 2014, 01:29

Episode count on seasons not working

Post 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.
User avatar
rednoah
The Source
Posts: 23001
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Episode count on seasons not working

Post 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)'
}
:idea: Please read the FAQ and How to Request Help.
vballrican
Donor
Posts: 80
Joined: 21 Dec 2014, 01:29

Re: Episode count on seasons not working

Post by vballrican »

Thanks.. i just found

Code: Select all

{episodelist.findAll{ s == it.s }.e.max()}
and it works!
User avatar
rednoah
The Source
Posts: 23001
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Episode count on seasons not working

Post 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.
:idea: Please read the FAQ and How to Request Help.
vballrican
Donor
Posts: 80
Joined: 21 Dec 2014, 01:29

Re: Episode count on seasons not working

Post 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.
vballrican
Donor
Posts: 80
Joined: 21 Dec 2014, 01:29

Re: Episode count on seasons not working

Post 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")})
vballrican
Donor
Posts: 80
Joined: 21 Dec 2014, 01:29

Re: Episode count on seasons not working

Post by vballrican »

Any ideas?
User avatar
rednoah
The Source
Posts: 23001
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Episode count on seasons not working

Post 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
:idea: Please read the FAQ and How to Request Help.
vballrican
Donor
Posts: 80
Joined: 21 Dec 2014, 01:29

Re: Episode count on seasons not working

Post by vballrican »

Thank you!
vballrican
Donor
Posts: 80
Joined: 21 Dec 2014, 01:29

Re: Episode count on seasons not working

Post 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.
vballrican
Donor
Posts: 80
Joined: 21 Dec 2014, 01:29

Re: Episode count on seasons not working

Post by vballrican »

:( It's not changing the complete to incomplete if episodes/seasons are missing... what can i check? Thanks.
vballrican
Donor
Posts: 80
Joined: 21 Dec 2014, 01:29

Re: Episode count on seasons not working

Post 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.
User avatar
rednoah
The Source
Posts: 23001
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Episode count on seasons not working

Post 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.
:idea: Please read the FAQ and How to Request Help.
vballrican
Donor
Posts: 80
Joined: 21 Dec 2014, 01:29

Re: Episode count on seasons not working

Post 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...
User avatar
rednoah
The Source
Posts: 23001
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Episode count on seasons not working

Post 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
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 23001
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Episode count on seasons not working

Post 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?
:idea: Please read the FAQ and How to Request Help.
vballrican
Donor
Posts: 80
Joined: 21 Dec 2014, 01:29

Re: Episode count on seasons not working

Post 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... :|
vballrican
Donor
Posts: 80
Joined: 21 Dec 2014, 01:29

Re: Episode count on seasons not working

Post 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.
User avatar
rednoah
The Source
Posts: 23001
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Episode count on seasons not working

Post 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.
:idea: Please read the FAQ and How to Request Help.
Post Reply