Jump to content

New Statistics plugin


reggi

Recommended Posts

Happy2Play
10 minutes ago, hackthis02 said:

If you check your logs, it should till you which medias are throwing those.

Found the Unknown as it was a corrupt file, and the 4K is an odd resolution so sort of to be expected.

2023-02-14 15:28:50.269 Debug Statistics: CalculateMovieQualities The Outpost 4K

image.png.80d13a72a762c6ec4564db6679a9242b.png

 

  • Like 1
Link to comment
Share on other sites

DarWun
23 minutes ago, hackthis02 said:

If you check your logs, it should till you which medias are throwing those.

Thanks for explaining how to track that down. Only pedantic thing I'll add...minor spelling mistake with "Resolution". Which you've probably already fixed...and now I feel like an idiot for pointing it out ;-).

  • Haha 1
Link to comment
Share on other sites

Happy2Play
1 minute ago, DarWun said:

Thanks for explaining how to track that down. Only pedantic thing I'll add...minor spelling mistake with "Resolution". Which you've probably already fixed...and now I feel like an idiot for pointing it out ;-).

Didn't even notice it until you mentioned it.

Link to comment
Share on other sites

DarWun
42 minutes ago, hackthis02 said:

I just pushed an update. Tell me if that fixes the issue.

@hackthis02Wow, that was quick! Updated to 3.0.6.1, and the scan completes without issue.

Thanks!

Link to comment
Share on other sites

Me and a friend have a VPN between us, making it possible for us to share our respective media collections.  This does result in several tv-shows and movies being duplicates in our libraries.  Emby handles this fine, understanding that it is the same movie or tv-show, and gives you a choice of which version you would like to play of the movie, and with tv-shows, it just merges it to one show.

Statistics however counts each instance of every movie and episode as unique, resulting in vastly wrong statistics.  Both my movie count and tv-episode count is way higher than it should be, as the plugin counts every instance of every show and movie separately. 

In light of Emby's excellent handling of multiple versions of both shows and movies, there should be a way for statistics to use a similar method of counting the totals?  When viewing the tv-show library, the tv-show count shows correctly right at the top of the screen in emby, as does the movie count in the movie library..

As of now, the statistics plugin base its statistics on the wrong data, as two different versions of the same movie will be counted as two movies etc..

 

Link to comment
Share on other sites

hackthis02
1 hour ago, dexus said:

Me and a friend have a VPN between us, making it possible for us to share our respective media collections.  This does result in several tv-shows and movies being duplicates in our libraries.  Emby handles this fine, understanding that it is the same movie or tv-show, and gives you a choice of which version you would like to play of the movie, and with tv-shows, it just merges it to one show.

Statistics however counts each instance of every movie and episode as unique, resulting in vastly wrong statistics.  Both my movie count and tv-episode count is way higher than it should be, as the plugin counts every instance of every show and movie separately. 

In light of Emby's excellent handling of multiple versions of both shows and movies, there should be a way for statistics to use a similar method of counting the totals?  When viewing the tv-show library, the tv-show count shows correctly right at the top of the screen in emby, as does the movie count in the movie library..

As of now, the statistics plugin base its statistics on the wrong data, as two different versions of the same movie will be counted as two movies etc..

 

Yours is a very fringe case. The two main reasons I can't account for this is
A. Emby keeps a whole database of which media files the user has, and in the case of a copy it combines them. It may only display one listing for all the different entries but when a plugin asks for all media, Emby gives it both copies. I'm guessing in entries that you and your friend have, there is a drop down allowing you to select either version. This would require a lot of overhead to maintain. and is well outside the scope of this plugin and my ability to code and maintain it.
B. If someone has two copies of an entry but for example one was h264 and the other was HEVC or one copy was 1080p and the other was 4k. The user would want to see that information. So, combining two entries of the same media would then leave out useable information.

Link to comment
Share on other sites

nightknight

my statistic plugin hasnt worked in some time so i quit using it. today i decided to mess around with it again but it fails. what do i need to do to make statistics work.  it fails with any media. it even fails with no media libraries.  its been doing this for months now. even after the update no change. deleted the whole library and it still fails. what am i missing?

 

i just re-installed emby enitirely, reinstalled statistics and ran it on an empty library and it fails the same. then i add 1 item to the library and it still fails. 

 

Data path: C:\Users\Laptop\AppData\Roaming\Emby-Server\programdata
Application path: C:\Users\Laptop\AppData\Roaming\Emby-Server\system
System.ArgumentOutOfRangeException: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
at System.Collections.Generic.List`1.get_Item(Int32 index)
at Statistics.Helpers.Calculator.CalculateMostWatchedShows(UpdateModel tvdbData)
at Statistics.ScheduledTasks.CalculateStatsTask.MediaBrowser.Model.Tasks.IScheduledTask.Execute(CancellationToken cancellationToken, IProgress`1 progress)
at Emby.Server.Implementations.ScheduledTasks.ScheduledTaskWorker.ExecuteInternal(TaskOptions options)
Source: System.Private.CoreLib
TargetSite: Void ThrowArgumentOutOfRange_IndexException()
Edited by nightknight
Link to comment
Share on other sites

Happy2Play
6 minutes ago, nightknight said:

my statistic plugin hasnt worked in some time so i quit using it. today i decided to mess around with it again but it fails. what do i need to do to make statistics work.  it fails with any media. it even fails with no media libraries. 

 

Data path: C:\Users\Laptop\AppData\Roaming\Emby-Server\programdata
Application path: C:\Users\Laptop\AppData\Roaming\Emby-Server\system
System.ArgumentOutOfRangeException: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
at System.Collections.Generic.List`1.get_Item(Int32 index)
at Statistics.Helpers.Calculator.CalculateMostWatchedShows(UpdateModel tvdbData)
at Statistics.ScheduledTasks.CalculateStatsTask.MediaBrowser.Model.Tasks.IScheduledTask.Execute(CancellationToken cancellationToken, IProgress`1 progress)
at Emby.Server.Implementations.ScheduledTasks.ScheduledTaskWorker.ExecuteInternal(TaskOptions options)
Source: System.Private.CoreLib
TargetSite: Void ThrowArgumentOutOfRange_IndexException()

Merged to plugin topic for dev to see.

@hackthis02

Link to comment
Share on other sites

Happy2Play

@hackthis02should an empty database throw these errors?  Sort of makes sense as there is nothing to query and no images to display.

2023-02-16 22:54:37.591 Error TaskManager: Error
	*** Error Report ***
	Version: 4.8.0.21
	Command line: C:\Users\Media\Desktop\Clean test\system\EmbyServer.dll
	Operating system: Microsoft Windows 10.0.25300
	Framework: .NET 6.0.10
	OS/Process: x64/x64
	Runtime: C:/Users/Media/Desktop/Clean test/system/System.Private.CoreLib.dll
	Processor count: 8
	Data path: C:\Users\Media\Desktop\Clean test\programdata
	Application path: C:\Users\Media\Desktop\Clean test\system
	System.ArgumentOutOfRangeException: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
	   at System.Collections.Generic.List`1.get_Item(Int32 index)
	   at Statistics.Helpers.Calculator.CalculateMostWatchedShows(UpdateModel tvdbData)
	   at Statistics.ScheduledTasks.CalculateStatsTask.MediaBrowser.Model.Tasks.IScheduledTask.Execute(CancellationToken cancellationToken, IProgress`1 progress)
	   at Emby.Server.Implementations.ScheduledTasks.ScheduledTaskWorker.ExecuteInternal(TaskOptions options)
	Source: System.Private.CoreLib
	TargetSite: Void ThrowArgumentOutOfRange_IndexException()
	
2023-02-16 22:54:44.298 Error Server: Error processing request
	*** Error Report ***
	Version: 4.8.0.21
	Command line: C:\Users\Media\Desktop\Clean test\system\EmbyServer.dll
	Operating system: Microsoft Windows 10.0.25300
	Framework: .NET 6.0.10
	OS/Process: x64/x64
	Runtime: C:/Users/Media/Desktop/Clean test/system/System.Private.CoreLib.dll
	Processor count: 8
	Data path: C:\Users\Media\Desktop\Clean test\programdata
	Application path: C:\Users\Media\Desktop\Clean test\system
	System.ArgumentNullException: System.ArgumentNullException: Value cannot be null. (Parameter 'itemId')
	   at Emby.Server.Implementations.Data.SqliteItemRepository.GetImageInfo(Int64 itemId, ImageType imageType, Int32 index)
	   at Emby.Server.Implementations.Library.LibraryManager.GetImageInfo(Int64 itemId, ImageType imageType, Int32 index)
	   at Emby.Api.Images.ImageService.GetImage(ImageRequest request, Int64 itemId, BaseItem item, Boolean isHeadRequest)
	   at Emby.Server.Implementations.Services.ServiceController.GetTaskResult(Task task)
	   at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost httpHost, IServerApplicationHost appHost, IRequest httpReq, IResponse httpRes, RestPath restPath, String responseContentType, CancellationToken cancellationToken)
	   at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, ReadOnlyMemory`1 urlString, ReadOnlyMemory`1 localPath, CancellationToken cancellationToken)
	Source: Emby.Server.Implementations
	TargetSite: MediaBrowser.Controller.Entities.ItemImageInfo GetImageInfo(Int64, MediaBrowser.Model.Entities.ImageType, Int32)

 

Link to comment
Share on other sites

hackthis02

@Happy2Play To answer your question, for your second error it doesn't look like that error is being called from my code. As for the out of Range exception, I'm running thru the possible problems in my head, is it possible to run an emby server with no users?

Link to comment
Share on other sites

Happy2Play
21 minutes ago, hackthis02 said:

@Happy2Play To answer your question, for your second error it doesn't look like that error is being called from my code. As for the out of Range exception, I'm running thru the possible problems in my head, is it possible to run an emby server with no users?

It is not possible to run with no user as one is logged in.

image.png.1b3774cb99abcbbcbb5e2afdc7519976.png

Refreshing the stats page throws the second error along with console errors.  Is it these images requests?

 

image.thumb.png.b578dbff752839c78959a9ec3752a2f6.png

VM152:24 
        
       Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'Size')
    at Object.createStat (<anonymous>:24:31)
    at <anonymous>:128:70
Primary:1 
       
        
       Failed to load resource: the server responded with a status of 404 (Not Found)
Primary:1 
 
       Failed to load resource: the server responded with a status of 400 (Bad Request)

 

  • Thanks 1
Link to comment
Share on other sites

On 2/15/2023 at 6:25 PM, hackthis02 said:

Yours is a very fringe case. The two main reasons I can't account for this is
A. Emby keeps a whole database of which media files the user has, and in the case of a copy it combines them. It may only display one listing for all the different entries but when a plugin asks for all media, Emby gives it both copies. I'm guessing in entries that you and your friend have, there is a drop down allowing you to select either version. This would require a lot of overhead to maintain. and is well outside the scope of this plugin and my ability to code and maintain it.
B. If someone has two copies of an entry but for example one was h264 and the other was HEVC or one copy was 1080p and the other was 4k. The user would want to see that information. So, combining two entries of the same media would then leave out useable information.

I realize that my situation is somewhat of a niche case 😄 However, as far as being a statistics plugin useful as something other than a vague overlook of what is available and watched, every user will have some discrepancies, that being a movie in both regular and 3d format, two resolutions, two languages etc.. meaning the statistics will no be acurate for anyone.
This is however fine, as long as we are aware of it, and use the statistics plugin as a fun overview and a loose estimate of what is on the server.. 


Emby clearly knows the difference as it shows each movie by itself with iterations as drop down choices as you mentioned.  This should mean that the data is available, and could potentionally be set as an option to view the data with or without duplicates of both series and movies.  I know that would probably be alot of re-writing of code, and it might not be feasable in your situation.  Just saying it could be a possibility.  The "Embystat" server which is a standalone statistics server for emby in beta development does not treat double copies of series or movies as individual entrances, and although it is not flawless by any means, it shows it is possible to pull the data.

Anyway, keep up the good work, it is still a great plugin, and I do really appreciate the work and effort you are doing.  The user based statistics that shows what my familiy and friends are watching is a good indicator for me to what kind of content they like, and helps alot.

  • Thanks 1
Link to comment
Share on other sites

If you've watched a movie it doesn't matter if you saw it on TV with Commercials, viewed it through Emby or some other online system or in the Theater. You've either watched it or not regardless of the experience. :)

It's the same thing to me counting movies.  Top Gun 1986 is one movie regardless of the fact I have 4 different versions of it on my system especially when they are grouped.  If I look at the count of movies by clicking on Movies from the home screen (without grouping turned on) I'll get a count of movies I have.  Any stats program should theoretically match that number.

If the stat being shown is number of media files, not movies in that library then I'd expect a different larger number because it's a stat on something different.

Link to comment
Share on other sites

hackthis02

Movie Codecs and quality will count all copies on the server. I'll look into it more, but I think playlist is counted on a per watch basis. So, it wouldn't matter if you had 4 copies of Top Gun on your server, it lists as you only watching it once. 

Link to comment
Share on other sites

hackthis02

@nightknightA few questions about your issue. 

When you only add one item in your library, is it the same item each time or have you tried different ones?
When you only have one item in your library, have you marked it as watched and re-run statistics?
When you only have one item in your library, is always a movie or a show?

 

Link to comment
Share on other sites

Happy2Play

Box size don't revert from View user-based statistics box sizes. Only does it backing out of that stats button (arrow back or go back button)

Example as it affects all boxes on page.

image.png.1ff6ad35dc41afe62144dec47f98da4b.png

Link to comment
Share on other sites

hackthis02
2 minutes ago, Happy2Play said:

Box size don't revert from View user-based statistics box sizes. Only does it backing out of that stats button (arrow back or go back button)

Example as it affects all boxes on page.

image.png.1ff6ad35dc41afe62144dec47f98da4b.png

I've seen that issue in other plugins too, so I thought it was a bug with Emby. I just checked it with Emby 4.7.11.0 and I can't get it to break that way anymore. Tried it on both Chrome and Edge with my Linux and windows servers.

Link to comment
Share on other sites

nightknight
15 hours ago, hackthis02 said:

@nightknightA few questions about your issue. 

When you only add one item in your library, is it the same item each time or have you tried different ones?
When you only have one item in your library, have you marked it as watched and re-run statistics?
When you only have one item in your library, is always a movie or a show?

 

i just tried with a different movie/tv show and marked it as watched but i get the same error. 

 

Whats strange is this wasnt an issue prior to adding a media folder of tv shows statistics or emby didnt like. Now all of sudden statistics fails regardless of the media library. i even went as far to reinstall emby but there seems to be an error somwhere.i dont understand how Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')  if a new database is created then how is there an indexing problem and why did it work becfore i imported the problematic library.

Edited by nightknight
Link to comment
Share on other sites

Happy2Play
7 hours ago, nightknight said:

i just tried with a different movie/tv show and marked it as watched but i get the same error. 

 

Whats strange is this wasnt an issue prior to adding a media folder of tv shows statistics or emby didnt like. Now all of sudden statistics fails regardless of the media library. i even went as far to reinstall emby but there seems to be an error somwhere.i dont understand how Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')  if a new database is created then how is there an indexing problem and why did it work becfore i imported the problematic library.

Do you still have an issuw with plugin update?  Resolves error in my test.

Link to comment
Share on other sites

Happy2Play

Minor but still appears to be one for Largest Movie, all other cards no longer have the broken image.

image.png.c472802b93fede10195448c706f139b1.png

GET http://localhost:8096/Items/00000000-0000-0000-0000-000000000000/Images/Primary 400 (Bad Request)              Primary:1 

 

 

2023-02-20 15:48:51.765 Debug Server: http/1.1 GET http://‌‍‍localhost‌:8096/Items/00000000-0000-0000-0000-000000000000/Images/Primary. UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.50
2023-02-20 15:48:51.766 Debug SqliteItemRepository: GetInternalId from 00000000-0000-0000-0000-000000000000
2023-02-20 15:48:51.767 Error Server: Error processing request
	*** Error Report ***
	Version: 4.7.11.0
	Command line: C:\Users\Media\Desktop\TEST\system\EmbyServer.dll -noautorunwebapp
	Operating system: Microsoft Windows 10.0.25300
	Framework: .NET 6.0.10
	OS/Process: x64/x64
	Runtime: C:/Users/Media/Desktop/TEST/system/System.Private.CoreLib.dll
	Processor count: 8
	Data path: C:\Users\Media\Desktop\TEST\programdata
	Application path: C:\Users\Media\Desktop\TEST\system
	System.ArgumentNullException: System.ArgumentNullException: Value cannot be null. (Parameter 'itemId')
	   at Emby.Server.Implementations.Data.SqliteItemRepository.GetImageInfo(Int64 itemId, ImageType imageType, Int32 index)
	   at Emby.Server.Implementations.Library.LibraryManager.GetImageInfo(Int64 itemId, ImageType imageType, Int32 index)
	   at Emby.Api.Images.ImageService.GetImage(ImageRequest request, Int64 itemId, BaseItem item, Boolean isHeadRequest)
	   at Emby.Server.Implementations.Services.ServiceController.GetTaskResult(Task task)
	   at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost appHost, IRequest httpReq, IResponse httpRes, RestPath restPath, String responseContentType, CancellationToken cancellationToken)
	   at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, ReadOnlyMemory`1 urlString, ReadOnlyMemory`1 localPath, CancellationToken cancellationToken)
	Source: Emby.Server.Implementations
	TargetSite: MediaBrowser.Controller.Entities.ItemImageInfo GetImageInfo(Int64, MediaBrowser.Model.Entities.ImageType, Int32)
	
2023-02-20 15:48:51.767 Debug Server: http/1.1 Response 400 to ‌‍‍::1‌. Time: 1ms. http://‌‍‍localhost‌:8096/Items/00000000-0000-0000-0000-000000000000/Images/Primary

May need a little formatting as previously they were on separate lines. (all cards)

image.png.552f4991054763fff9086fac4e02dc7e.png

Not new but Episode thumb affects card.

image.png.dec4affb04d7868ecff97fee73d15923.png

Edited by Happy2Play
Link to comment
Share on other sites

hackthis02
42 minutes ago, Happy2Play said:

Minor but still appears to be one for Largest Movie, all other cards no longer have the broken image.

image.png.c472802b93fede10195448c706f139b1.png

GET http://localhost:8096/Items/00000000-0000-0000-0000-000000000000/Images/Primary 400 (Bad Request)              Primary:1 

 

 

2023-02-20 15:48:51.765 Debug Server: http/1.1 GET http://‌‍‍localhost‌:8096/Items/00000000-0000-0000-0000-000000000000/Images/Primary. UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.50
2023-02-20 15:48:51.766 Debug SqliteItemRepository: GetInternalId from 00000000-0000-0000-0000-000000000000
2023-02-20 15:48:51.767 Error Server: Error processing request
	*** Error Report ***
	Version: 4.7.11.0
	Command line: C:\Users\Media\Desktop\TEST\system\EmbyServer.dll -noautorunwebapp
	Operating system: Microsoft Windows 10.0.25300
	Framework: .NET 6.0.10
	OS/Process: x64/x64
	Runtime: C:/Users/Media/Desktop/TEST/system/System.Private.CoreLib.dll
	Processor count: 8
	Data path: C:\Users\Media\Desktop\TEST\programdata
	Application path: C:\Users\Media\Desktop\TEST\system
	System.ArgumentNullException: System.ArgumentNullException: Value cannot be null. (Parameter 'itemId')
	   at Emby.Server.Implementations.Data.SqliteItemRepository.GetImageInfo(Int64 itemId, ImageType imageType, Int32 index)
	   at Emby.Server.Implementations.Library.LibraryManager.GetImageInfo(Int64 itemId, ImageType imageType, Int32 index)
	   at Emby.Api.Images.ImageService.GetImage(ImageRequest request, Int64 itemId, BaseItem item, Boolean isHeadRequest)
	   at Emby.Server.Implementations.Services.ServiceController.GetTaskResult(Task task)
	   at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost appHost, IRequest httpReq, IResponse httpRes, RestPath restPath, String responseContentType, CancellationToken cancellationToken)
	   at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, ReadOnlyMemory`1 urlString, ReadOnlyMemory`1 localPath, CancellationToken cancellationToken)
	Source: Emby.Server.Implementations
	TargetSite: MediaBrowser.Controller.Entities.ItemImageInfo GetImageInfo(Int64, MediaBrowser.Model.Entities.ImageType, Int32)
	
2023-02-20 15:48:51.767 Debug Server: http/1.1 Response 400 to ‌‍‍::1‌. Time: 1ms. http://‌‍‍localhost‌:8096/Items/00000000-0000-0000-0000-000000000000/Images/Primary

May need a little formatting as previously they were on separate lines. (all cards)

image.png.552f4991054763fff9086fac4e02dc7e.png

Not new but Episode thumb affects card.

image.png.dec4affb04d7868ecff97fee73d15923.png

The largest movie should be fixed in 3.0.6.4
Yeah, that's a formatting error I didn't catch before posting. 
New episode formatting seems to be an issue with screen size. I can make it look like your screenshot by shrinking the window. 

Link to comment
Share on other sites

Happy2Play
1 minute ago, hackthis02 said:

The largest movie should be fixed in 3.0.6.4

That is the version I am on, restarted server and still see the same.  It is only that card.

image.png.bea0e84d18b3e4037c591979118717a5.png

Link to comment
Share on other sites

hackthis02
1 hour ago, Happy2Play said:

That is the version I am on, restarted server and still see the same.  It is only that card.

image.png.bea0e84d18b3e4037c591979118717a5.png

Fixed the large movie issue. Might look at the formatting later. Don't really want to put that much effort into something no one should really see.

  • Agree 2
Link to comment
Share on other sites

Happy2Play
3 minutes ago, hackthis02 said:

Fixed the large movie issue. Might look at the formatting later. Don't really want to put that much effort into something no one should really see.

Updated reran task, no more errors.

  • Like 1
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...