Jump to content

ItemsService IsPlayed doesn't work anymore


wegwerfaccount2
Go to solution Solved by Luke,

Recommended Posts

wegwerfaccount2

I used to use the ItemService with Recursive=true, IsFavorite=false and IsPlayed=true to find and subsequently delete items.

This call now always returns an empty list.
Please help with this, it is such a valuable tool to do housekeeping on my library.

Link to comment
Share on other sites

wegwerfaccount2
Posted (edited)

Hi, Sorry, sure:

 

curl -H "X-Emby-Token: XXX" https://YYY:8920/Users/ZZZ/Items?Recursive=true&IsPlayed=true&IsFavorite=false
{"Items":[],"TotalRecordCount":0}



I just found out what the issue is, if I set IncludeItemTypes I get results, so I guess what changed is that IncludeItemTypes is not optional anymore.

Edit:
And by the way, the /Items endpoint yields a sqlite exception:
 

curl -k -H "X-Emby-Token: XXX" "https://YYY:8920/emby/Items?IncludeItemTypes=Episode&Recursive=true&IsPlayed=true&IsFavorite=false"
Exception of type 'SQLitePCL.pretty.SQLiteException' was thrown.


Edit2:
I also just saw that Items with Played=true in UserData now always have a PlayCount of 0

Edited by wegwerfaccount2
Link to comment
Share on other sites

adminExitium
21 minutes ago, wegwerfaccount2 said:

I also just saw that Items with Played=true in UserData now always have a PlayCount of 0

You need to add UserDataPlayCount (for the play count) and UserDataLastPlayedDate (for the last played date) to your requested fields.

26 minutes ago, wegwerfaccount2 said:

the /Items endpoint yields a sqlite exception:

Need the server logs when this happened.

Link to comment
Share on other sites

wegwerfaccount2
6 minutes ago, adminExitium said:

You need to add UserDataPlayCount (for the play count) and UserDataLastPlayedDate (for the last played date) to your requested fields.

Ok, that works, thanks!
I didn't see these fields in the API Doc.

Server logs for the exception:
 

2024-03-05 10:48:57.444 Info App: Sqlite: 1 - no such column: UserDatas.IsFavorite in "select A.Id,A.IndexNumber,A.Name,A.ParentIndexNumber,A.RunTimeTicks,A.ParentId,A.SeriesName,A.Album,A.AlbumId,A.SeriesId,A.Images,A.SortIndexNumber,A.SortParentIndexNum
2024-03-05 10:48:57.445 Error Server: Error processing request
        *** Error Report ***
        Version: 4.8.3.0
        Command line: /system/EmbyServer.dll -programdata /config -ffdetect /bin/ffdetect -ffmpeg /bin/ffmpeg -ffprobe /bin/ffprobe -restartexitcode 3
        Operating system: Linux version 5.4.0-167-generic (buildd@lcy02-amd64-010) (gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2)) #184-Ubuntu SMP Tue Oct 31 09:21:49 UTC 2
        Framework: .NET 6.0.25
        OS/Process: x64/x64
        Runtime: system/System.Private.CoreLib.dll
        Processor count: 16
        Data path: /config
        Application path: /system
        SQLitePCL.pretty.SQLiteException: Error: no such column: UserDatas.IsFavorite - select A.Id,A.IndexNumber,A.Name,A.ParentIndexNumber,A.RunTimeTicks,A.ParentId,A.SeriesName,A.Album,A.AlbumId,A.SeriesId,A.Images,A.SortIndexNumber,A.SortParentIndexNumber,A.IndexNumberEnd from MediaItems A where A.Type=8 AND Coalesce(UserDatas.IsFavorite, 0)=0 AND UserDatas.played=1
        SQLitePCL.pretty.SQLiteException: Exception of type 'SQLitePCL.pretty.SQLiteException' was thrown.
           at SQLitePCL.pretty.SQLiteDatabaseConnection.PrepareStatement(String sql, ReadOnlySpan`1& tail)
           at SQLitePCL.pretty.DatabaseConnection.PrepareStatement(IDatabaseConnection This, String sql)
           at Emby.Server.Implementations.Data.SqliteItemRepository.QueryItemsInTransaction[T](InternalItemsQuery query, IDatabaseConnection db, String[] columnsToSelect, Boolean filterColumns, String[] groupBy, Func`5 rowReaderFn, String methodName)
           at Emby.Server.Implementations.Data.SqliteItemRepository.GetItems(InternalItemsQuery query)
           at MediaBrowser.Controller.Entities.AggregateFolder.GetItemsInternal(InternalItemsQuery query)
           at MediaBrowser.Controller.Entities.Folder.GetItems(InternalItemsQuery query)
           at Emby.Api.UserLibrary.ItemsService.GetQueryResult(GetItems request, DtoOptions dtoOptions, User user)
           at Emby.Api.UserLibrary.ItemsService.GetItems(GetItems request)
           at Emby.Api.UserLibrary.ItemsService.Get(GetItems request)
           at Emby.Server.Implementations.Services.ServiceController.Execute(HttpListenerHost appHost, Object requestDto, IRequest req, Type serviceType)
           at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost httpHost, IServerApplicationHost appHost, IRequest httpReq, IResponse httpRes, IStreamHelper streamHelper, 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.ReadOnlySpan`1[System.Byte] ByRef)

2024-03-05 10:48:57.445 Info Server: http/2 Response 500 to ‌‍‍10.23.89.150‌. Time: 2ms. GET https://‌‍‍XXX:8920/emby/Items?IncludeItemTypes=Episode&Recursive=true&IsPlayed=true&IsFavorite=false

 

Link to comment
Share on other sites

  • Solution
5 minutes ago, wegwerfaccount2 said:

Ok, that works, thanks!
I didn't see these fields in the API Doc.

Server logs for the exception:
 

2024-03-05 10:48:57.444 Info App: Sqlite: 1 - no such column: UserDatas.IsFavorite in "select A.Id,A.IndexNumber,A.Name,A.ParentIndexNumber,A.RunTimeTicks,A.ParentId,A.SeriesName,A.Album,A.AlbumId,A.SeriesId,A.Images,A.SortIndexNumber,A.SortParentIndexNum
2024-03-05 10:48:57.445 Error Server: Error processing request
        *** Error Report ***
        Version: 4.8.3.0
        Command line: /system/EmbyServer.dll -programdata /config -ffdetect /bin/ffdetect -ffmpeg /bin/ffmpeg -ffprobe /bin/ffprobe -restartexitcode 3
        Operating system: Linux version 5.4.0-167-generic (buildd@lcy02-amd64-010) (gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2)) #184-Ubuntu SMP Tue Oct 31 09:21:49 UTC 2
        Framework: .NET 6.0.25
        OS/Process: x64/x64
        Runtime: system/System.Private.CoreLib.dll
        Processor count: 16
        Data path: /config
        Application path: /system
        SQLitePCL.pretty.SQLiteException: Error: no such column: UserDatas.IsFavorite - select A.Id,A.IndexNumber,A.Name,A.ParentIndexNumber,A.RunTimeTicks,A.ParentId,A.SeriesName,A.Album,A.AlbumId,A.SeriesId,A.Images,A.SortIndexNumber,A.SortParentIndexNumber,A.IndexNumberEnd from MediaItems A where A.Type=8 AND Coalesce(UserDatas.IsFavorite, 0)=0 AND UserDatas.played=1
        SQLitePCL.pretty.SQLiteException: Exception of type 'SQLitePCL.pretty.SQLiteException' was thrown.
           at SQLitePCL.pretty.SQLiteDatabaseConnection.PrepareStatement(String sql, ReadOnlySpan`1& tail)
           at SQLitePCL.pretty.DatabaseConnection.PrepareStatement(IDatabaseConnection This, String sql)
           at Emby.Server.Implementations.Data.SqliteItemRepository.QueryItemsInTransaction[T](InternalItemsQuery query, IDatabaseConnection db, String[] columnsToSelect, Boolean filterColumns, String[] groupBy, Func`5 rowReaderFn, String methodName)
           at Emby.Server.Implementations.Data.SqliteItemRepository.GetItems(InternalItemsQuery query)
           at MediaBrowser.Controller.Entities.AggregateFolder.GetItemsInternal(InternalItemsQuery query)
           at MediaBrowser.Controller.Entities.Folder.GetItems(InternalItemsQuery query)
           at Emby.Api.UserLibrary.ItemsService.GetQueryResult(GetItems request, DtoOptions dtoOptions, User user)
           at Emby.Api.UserLibrary.ItemsService.GetItems(GetItems request)
           at Emby.Api.UserLibrary.ItemsService.Get(GetItems request)
           at Emby.Server.Implementations.Services.ServiceController.Execute(HttpListenerHost appHost, Object requestDto, IRequest req, Type serviceType)
           at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost httpHost, IServerApplicationHost appHost, IRequest httpReq, IResponse httpRes, IStreamHelper streamHelper, 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.ReadOnlySpan`1[System.Byte] ByRef)

2024-03-05 10:48:57.445 Info Server: http/2 Response 500 to ‌‍‍10.23.89.150‌. Time: 2ms. GET https://‌‍‍XXX:8920/emby/Items?IncludeItemTypes=Episode&Recursive=true&IsPlayed=true&IsFavorite=false

 

You're missing userid=xxx from the query string.

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