Jump to content

New Statistics plugin


reggi

Recommended Posts

hackthis02
Posted (edited)

I'll ask  @DarWunand @crossfire13148since they seem to have the most interest in it. How should I display this info?

A few facts first. 

Here is the code if you're interested.

foreach (var show in showList)
{
    var totalEpisodes = tvdbData.IdList.FirstOrDefault(x => x.ShowId == show.GetProviderId(MetadataProviders.Tvdb))?.Count ?? 0;
    var collectedEpisodes = GetOwnedEpisodesCount(show);
    var seenEpisodes = GetPlayedEpisodeCount(show);
    var totalSpecials = GetOwnedSpecials(show);
    var seenSpecials = GetPlayedSpecials(show);

    if (collectedEpisodes > totalEpisodes)
        totalEpisodes = collectedEpisodes;

    decimal watched = 0;
    decimal collected = 0;
    if (totalEpisodes > 0)
    {
        collected = collectedEpisodes / (decimal)totalEpisodes * 100;
    }

    if (collectedEpisodes > 0)
    {
        watched = seenEpisodes / (decimal)collectedEpisodes * 100;
    }

    showProgress.Add(new ShowProgress
    {
        Name = show.Name,
        SortName = show.SortName,
        Score = show.CommunityRating,
        Status = show.Status,
        StartYear = show.PremiereDate?.ToString("yyyy"),
        Watched = Math.Round(watched, 1),
        Episodes = collectedEpisodes - totalSpecials,
        SeenEpisodes = seenEpisodes,
        Specials = totalSpecials,
        SeenSpecials = seenSpecials,
        Collected = Math.Round(collected, 1),
        Total = totalEpisodes - totalSpecials,
        Id = show.Id.ToString()
    });
}

Specials are included when getting the total number of episodes and collected for a series.
If you don't have specials it doesn't count negatively to your total number. Also specials are removed from the count after the percentage is calculated. 

So I have it currently set if your collected number of episodes is larger then the total number of episodes, the collected is now the new number.
ie.
 if (collectedEpisodes > totalEpisodes)
     totalEpisodes = collectedEpisodes;

This is in the event you have episodes that aren't included in the TVDB count.

When I display the collected column it's collected episodes -specials / total episodes(if greater then collected) -specials (percentage of collected) +number of specials
example:
total: 215
collected: 215
specials: 1
214 / 214 (100%) +1 sp

Watched is a little different. it's watched(plus specials) / collected episodes(if greater then collected) -specials (percentage of watched) +number of specials

Example 1:
total: 69
collected: 61
specials: 8
watched: 54 + 1sp
55 / 61 (79.7%) +8sp

Example:
total: 69
collected: 58
specials: 8
watched: 58 +8sp
66 / 58 (100%) +8sp

Edited by hackthis02
  • Like 1
Link to comment
Share on other sites

DarWun
Posted (edited)

@hackthis02Thanks for asking about my thoughts on this! I'm "away-from-keyboard" for the next week or so on vacation. So I haven't reviewed your response in detail yet. But I will do so when I get back in front of my keyboard. I'll provide my thoughts then.

Edited by DarWun
Link to comment
Share on other sites

crossfire13148
Posted (edited)
23 hours ago, hackthis02 said:



When I display the collected column it's collected episodes -specials / total episodes(if greater then collected) -specials (percentage of collected) +number of specials
example:
total: 215
collected: 215
specials: 1
214 / 214 (100%) +1 sp

 

so this is what i am thinking:

using this example that seems perfect.
where the prob seems to be, from my end, and correct me if i am wrong:

***EDIT***
rereading code....so this section was changed,ill get back to you here!
***EDIT***

as long as Episodes is the collected count and Collected is the percentage

 

but what i believe it used to do, was more "correct" in NOT counting specials in collected: as to me "collected" would only consist of the ACTUAL show collected.

in the past it was the specials that kept breaking the "complete" count! 


so basically i am thinking, and hope others chime in
"Collected" = actual episodes collected
"specials" = specials
"total" = Collected +specials
collected display = Collected then the # +SP

example:

total: 21
collected: 20
specials: 1
20 / 20 (100%) +1 sp

You have a total of 21 which is 20 episodes and 1 special

which worked GREAT when you had lets say 2 folders, 1 with 10 in then and 1 with 10, and 1 folder with specials. Verifying you had all the episodes and specials very easily!
S0 = 1
S1 = 10
S2 = 10

but that was also broken by emby, as it shows specials IN the folders, so now you would see the green circles
S0 = 1
S1 = 11
S2 = 10

(counting the green circles on the folders now give you 22!) when you only have 21 (21 episodes and 1 special)

right now running a scan, then will test out some things. may take a day or 2

i hope this makes sense, as my brain is on 40 things right now as i am working and typing!

Edited by crossfire13148
read something wrong, looking more in depth
  • Like 1
Link to comment
Share on other sites

crossfire13148

ok so from what i said before, (i missed reading a variable so i removed that part!)

i feel "collectedEpisodes" should not include specials, as they are "special"!

so this:
if (totalEpisodes > 0) { collected = collectedEpisodes / (decimal)totalEpisodes * 100; }

should be this:
if (totalEpisodes > 0) { collected = (collectedEpisodes - totalSpecials) / (decimal)totalEpisodes * 100; }

then it would show this:


total: 21
collected: 20
specials: 1
20 / 20 (100%) +1 sp


now as far as watched, i dont use that part of the tables, so i do not have an opinion on if specials SHOULD be considered as watched episodes?
although you could prob do the same here with episodes/specials?

XX number / YY number (%%) + ZZ sp

as you already have the var for them

var seenEpisodes = GetPlayedEpisodeCount(show);
var seenSpecials = GetPlayedSpecials(show);

using like above

if
(collectedEpisodes > 0) { watched = (seenEpisodes-seenSpecials) / (decimal)collectedEpisodes * 100; }

  • Like 1
Link to comment
Share on other sites

DarWun
Posted (edited)

Back in front of the computer...sorry for the late response. @hackthis02Everything you (and @crossfire13148) have said pertaining to how collected episodes are displayed makes sense.

How watched episodes are displayed is weird to me though. I have to look at the code and the math a bit more. But let me offer some thoughts I have based on what I'm seeing in the plugin prior to me digging in to the math:

Screenshot2024-05-11123718.png.81272738a8833e3d341ad93c148ab4ac.png

For the series Dollhouse, I have collected all 26 episodes of the series, plus one special (the unaired pilot). After watching all 26 episodes and the pilot, what I expected to see in the watched column was "26 /26 (100%) +1 sp". But what is displayed seems to double count the special that was watched (i.e. 27 total episodes watched plus the watch of one special). Plus "27 /26 (100%)" makes no sense as "27 / 26" is 104%.

The play results for Doctor Who (2005) are even stranger. I have collected four specials, and two episodes out of the 151 total episodes in the series. I watched all four specials. But I have not watched the most recent aired episodes. What would make sense to me to see in the watched column would be "0 / 2 (0%) + 4 sp". "4 /2" being equal to 67% makes no sense. Once I've watched the two episodes, what I would expect to see in the watched column is "2 /2 (100%) +4 sp".

I'll post back with some additional thoughts once I've dug in to the math from your posts.

Edited by DarWun
Link to comment
Share on other sites

DarWun
Posted (edited)
19 hours ago, DarWun said:

Back in front of the computer...sorry for the late response. @hackthis02Everything you (and @crossfire13148) have said pertaining to how collected episodes are displayed makes sense.

.

I'll post back with some additional thoughts once I've dug in to the math from your posts.

Okay. I've reviewed the math behind the watched statistics, and it makes sense. I still find it a bit confusing as to how the statistics are displayed in the plugin though. Would it make more sense to just show the number of items played out of the total items collected (including specials), and then not show the "+x sp"? I know from the collected items column how many specials have been collected.

For example, with Dollhouse in my previous post just display "27 / 27 (100%)" in the watched column. I know based on the what is presented in the collected column that that includes the 26 main episodes plus one special. For Doctor Who in my previous post, the watched column would show "4 / 6 (66.7%)". That may not be ideal, as the user doesn't know what mix of main and special episodes have been watched.

Anyway, I'm good if you leave things as they are now that I understand the math behind it. I just found it weird seeing "27 / 26 (100%). I read that as 27 / 26 = 100%, and the engineer in me said "no it does not" 😉.

 

Edited by DarWun
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...