Jump to content

Most Viewed Film and Series


Recommended Posts

killride
Posted

Hi guys,

 

I would like to do a fancy dashboard displaying the most viewed Film and Series of the week.

 

Do you know if we can do this through the API?

 

Thanks in advance.

 

Jim

Posted

You can't for just the week but you can sort media on play count, if that helps.

killride
Posted

Yes, I will have a look on this. So I get the full list and sort it by playcount

killride
Posted (edited)

xxxxxx:8096/emby/items?SortBy=PlayCount&api_key=xxxxxxxx&Recursive=true&IncludeItemTypes=Movie doesn't work

 

I have this error : Exception of type 'SQLitePCL.pretty.SQLiteException' was thrown.

 

xxxxxxx:8096/emby/items?SortBy=Random&api_key=xxxxxxxxxxxx&Recursive=true&IncludeItemTypes=Movie Works

 

Any idea why?

 

Am I doing something wrong?

Edited by killride
Posted

And the details?

killride
Posted

which details? server log?

killride
Posted

2020-04-23 07:30:35.524 Info HttpServer: HTTP GET http://192.168.1.254:8096/emby/items?Recursive=true&Limit=10&IncludeItemTypes=Series&SortBy=PlayCount. UserAgent: PostmanRuntime/7.24.1
2020-04-23 07:30:35.539 Error HttpServer: Error processing request
    *** Error Report ***
    Version: 4.4.2.0
    Command line: C:\EmbyV3\system\EmbyServer.dll
    Operating system: Microsoft Windows NT 6.2.9200.0
    64-Bit OS: True
    64-Bit Process: True
    User Interactive: True
    Runtime: file:///C:/EmbyV3/system/System.Private.CoreLib.dll
    System.Environment.Version: 3.1.3
    Processor count: 8
    Program data path: C:\EmbyV3\programdata
    Application directory: C:\EmbyV3\system
    SQLitePCL.pretty.SQLiteException: Error: no such column: UserDatas.PlayCount - select A.Id,A.Name,A.RunTimeTicks,A.guid,A.ParentId,A.Images from MediaItems A where type=@@type ORDER BY UserDatas.PlayCount ASC LIMIT 10
    SQLitePCL.pretty.SQLiteException: Exception of type 'SQLitePCL.pretty.SQLiteException' was thrown.
     at SQLitePCL.pretty.SQLiteDatabaseConnection.PrepareStatement(String sql, String& tail)
     at SQLitePCL.pretty.DatabaseConnection.PrepareStatement(IDatabaseConnection This, String sql)
     at Emby.Server.Implementations.Data.SqliteItemRepository.QueryItemsInTransaction[T](InternalItemsQuery query, IDatabaseConnection db, String[] columnsToSelect, Func`5 rowReaderFn, Boolean singleResult, String methodName)
     at Emby.Server.Implementations.Data.SqliteItemRepository.GetItems(InternalItemsQuery query)
     at MediaBrowser.Controller.Entities.Folder.GetItems(InternalItemsQuery query)
     at MediaBrowser.Api.UserLibrary.ItemsService.GetQueryResult(GetItems request, DtoOptions dtoOptions, User user)
     at MediaBrowser.Api.UserLibrary.ItemsService.GetItems(GetItems request)
     at MediaBrowser.Api.UserLibrary.ItemsService.Get(GetItems request)
     at Emby.Server.Implementations.Services.ServiceController.Execute(HttpListenerHost appHost, Object requestDto, IRequest req)
     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: SQLitePCL.pretty
    TargetSite: SQLitePCL.pretty.IStatement PrepareStatement(System.String, System.String ByRef)
    

PenkethBoy
Posted

You need to use the ../emby/users/<userId>/items endpoint

 

As playcount is user specific - where random is not

 

Adding in the userId and it works fine

killride
Posted

But playcount will count the amond of played from every users right?

PenkethBoy
Posted

No - for the user you supply as the playcount is user specific

killride
Posted

So it's useless.

PenkethBoy
Posted

no its not

 

Explain what you want in detail so we have a chance to understand better what you are trying to do

 

And why cant you combine the results of each user to get a total count per movie/epsiode etc

killride
Posted

I would like to do a web page displaying the top 10 most viewed movies and TV shows

PenkethBoy
Posted

Well what i would do is...

 

Query Emby for each user - to get playcounts

 

Combine those results and use the info to find the 10 top for Movies and Episodes which can be translated into Series

 

If you are expecting a single command to do this then you are going to be disappointed

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...