joaoneto 1 Posted March 6, 2021 Share Posted March 6, 2021 (edited) Hey folks, I'm trying to perform a get via API of all my watched episodes but I'm bumping into a database error: > curl "http://REDACTEC/emby/Items?Recursive=true&IncludeItemTypes=Episode&IsPlayed=True&api_key=REDACTED" -H "accept: application/json" Exception of type 'SQLitePCL.pretty.SQLiteException' was thrown.% Apparently the API is expecting the database to have a `played` column in the `UserDatas` table: *** Error Report *** Version: 4.5.4.0 Command line: /opt/emby-server/system/EmbyServer.dll -programdata /var/lib/emby -ffdetect /opt/emby-server/bin/ffdetect -ffmpeg /opt/emby-server/bin/ffmpeg -ffprobe /opt/emby-server/bin/ffprobe -restartexitcode 3 -updatepackage emby-server-deb_{version}_armhf.deb Operating system: Linux version 4.19.66-v7+ (dom@buildbot) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1253 SMP Thu Aug 15 11:49:46 BST 2019 Framework: .NET Core 3.1.8 OS/Process: arm/arm Runtime: opt/emby-server/system/System.Private.CoreLib.dll Processor count: 4 Data path: /var/lib/emby Application path: /opt/emby-server/system SQLitePCL.pretty.SQLiteException: Error: no such column: UserDatas.played - select A.data,A.Id,A.IndexNumber,A.Name,A.ParentIndexNumber,A.RunTimeTicks,A.guid,A.ParentId,A.IsVirtualItem,A.SeriesName,A.Album,A.AlbumId,A.SeriesId,A.Images from MediaItems A where type=@type AND UserDatas.played=@IsPlayed 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 Emby.Server.Implementations.Library.LibraryManager.GetItemsResult(InternalItemsQuery query) at MediaBrowser.Controller.Entities.Folder.QueryRecursive(InternalItemsQuery query) at MediaBrowser.Controller.Entities.Folder.GetItemsInternal(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 lambda_method(Closure , Object , Object ) 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) Here's also a full log file from boot to the error in question https://pastebin.com/mLNqrL0s Could you guys give me some help? Thanks in advance! Edited March 6, 2021 by joaoneto Link to comment Share on other sites More sharing options...
Abobader 2933 Posted March 6, 2021 Share Posted March 6, 2021 Hello joaoneto, ** This is an auto reply ** Please wait for someone from staff support or our members to reply to you. It's recommended to provide more info, as it explain in this thread: Thank you. Emby Team Link to comment Share on other sites More sharing options...
chef 3744 Posted March 6, 2021 Share Posted March 6, 2021 Try adding a user id to your url?? Maybe? I believe isPlayed is user specific. Link to comment Share on other sites More sharing options...
joaoneto 1 Posted March 6, 2021 Author Share Posted March 6, 2021 (edited) 7 hours ago, chef said: Try adding a user id to your url?? Maybe? I believe isPlayed is user specific. Thanks for the suggestion @chef. I've tried it and got a different error. > curl -X GET "http://REDACTED/emby/Users/1/Items?Recursive=true&IncludeItemTypes=Episode&IsPlayed=True&api_key=REDACTED" -H "accept: application/json" Input string was not in a correct format.% And the logs say: *** Error Report *** Version: 4.5.4.0 Command line: /opt/emby-server/system/EmbyServer.dll -programdata /var/lib/emby -ffdetect /opt/emby-server/bin/ffdetect -ffmpeg /opt/emby-server/bin/ffmpeg -ffprobe /opt/emby-server/bin/ffprobe -restartexitcode 3 -updatepackage emby-server-deb_{version}_armhf.deb Operating system: Linux version 4.19.66-v7+ (dom@buildbot) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1253 SMP Thu Aug 15 11:49:46 BST 2019 Framework: .NET Core 3.1.8 OS/Process: arm/arm Runtime: opt/emby-server/system/System.Private.CoreLib.dll Processor count: 4 Data path: /var/lib/emby Application path: /opt/emby-server/system System.FormatException: System.FormatException: Input string was not in a correct format. at ServiceStack.Text.DefaultMemory.ParseGeneralStyleGuid(ReadOnlySpan`1 value, Int32& len) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\DefaultMemory.cs:line 629 at ServiceStack.Text.DefaultMemory.ParseGuid(ReadOnlySpan`1 value) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\DefaultMemory.cs:line 414 at ServiceStack.Text.Common.DeserializeBuiltin`1.<>c.<GetParseStringSpanFn>b__7_6(ReadOnlySpan`1 value) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Common\DeserializeBuiltin.cs:line 72 at ServiceStack.Text.Common.JsReader`1.<>c__DisplayClass4_0`1.<GetCoreParseStringSpanFn>b__3(ReadOnlySpan`1 value) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Common\JsReader.cs:line 70 at ServiceStack.Text.Jsv.JsvReader.<>c__DisplayClass2_0.<GetParseFn>b__0(String v) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Jsv\JsvReader.Generic.cs:line 18 at Emby.Server.Implementations.ApplicationHost.<>c__DisplayClass346_0.<GetParseFn>b__0(String s) at Emby.Server.Implementations.Services.StringMapTypeDeserializer.PopulateFromMap(Object instance, IDictionary`2 keyValuePairs) at Emby.Server.Implementations.Services.RestPath.CreateRequest(String pathInfo, Dictionary`2 queryStringAndFormData, Object fromInstance) at Emby.Server.Implementations.Services.ServiceHandler.CreateRequest(IRequest httpReq, RestPath restPath, Dictionary`2 requestParams, Object requestDto) at Emby.Server.Implementations.Services.ServiceHandler.CreateRequest(HttpListenerHost host, IRequest httpReq, RestPath restPath) 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: ServiceStack.Text TargetSite: System.Guid ParseGeneralStyleGuid(System.ReadOnlySpan`1[System.Char], Int32 ByRef) Edited March 6, 2021 by joaoneto Link to comment Share on other sites More sharing options...
chef 3744 Posted March 6, 2021 Share Posted March 6, 2021 (edited) 1 hour ago, joaoneto said: Thanks for the suggestion @chef. I've tried it and got a different error. > curl -X GET "http://REDACTED/emby/Users/1/Items?Recursive=true&IncludeItemTypes=Episode&IsPlayed=True&api_key=REDACTED" -H "accept: application/json" Input string was not in a correct format.% And the logs say: *** Error Report *** Version: 4.5.4.0 Command line: /opt/emby-server/system/EmbyServer.dll -programdata /var/lib/emby -ffdetect /opt/emby-server/bin/ffdetect -ffmpeg /opt/emby-server/bin/ffmpeg -ffprobe /opt/emby-server/bin/ffprobe -restartexitcode 3 -updatepackage emby-server-deb_{version}_armhf.deb Operating system: Linux version 4.19.66-v7+ (dom@buildbot) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1253 SMP Thu Aug 15 11:49:46 BST 2019 Framework: .NET Core 3.1.8 OS/Process: arm/arm Runtime: opt/emby-server/system/System.Private.CoreLib.dll Processor count: 4 Data path: /var/lib/emby Application path: /opt/emby-server/system System.FormatException: System.FormatException: Input string was not in a correct format. at ServiceStack.Text.DefaultMemory.ParseGeneralStyleGuid(ReadOnlySpan`1 value, Int32& len) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\DefaultMemory.cs:line 629 at ServiceStack.Text.DefaultMemory.ParseGuid(ReadOnlySpan`1 value) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\DefaultMemory.cs:line 414 at ServiceStack.Text.Common.DeserializeBuiltin`1.<>c.<GetParseStringSpanFn>b__7_6(ReadOnlySpan`1 value) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Common\DeserializeBuiltin.cs:line 72 at ServiceStack.Text.Common.JsReader`1.<>c__DisplayClass4_0`1.<GetCoreParseStringSpanFn>b__3(ReadOnlySpan`1 value) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Common\JsReader.cs:line 70 at ServiceStack.Text.Jsv.JsvReader.<>c__DisplayClass2_0.<GetParseFn>b__0(String v) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Jsv\JsvReader.Generic.cs:line 18 at Emby.Server.Implementations.ApplicationHost.<>c__DisplayClass346_0.<GetParseFn>b__0(String s) at Emby.Server.Implementations.Services.StringMapTypeDeserializer.PopulateFromMap(Object instance, IDictionary`2 keyValuePairs) at Emby.Server.Implementations.Services.RestPath.CreateRequest(String pathInfo, Dictionary`2 queryStringAndFormData, Object fromInstance) at Emby.Server.Implementations.Services.ServiceHandler.CreateRequest(IRequest httpReq, RestPath restPath, Dictionary`2 requestParams, Object requestDto) at Emby.Server.Implementations.Services.ServiceHandler.CreateRequest(HttpListenerHost host, IRequest httpReq, RestPath restPath) 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: ServiceStack.Text TargetSite: System.Guid ParseGeneralStyleGuid(System.ReadOnlySpan`1[System.Char], Int32 ByRef) Ops! Sorry, don't hit the Users endpoint try "&UserId=" in the url params while still hitting the "Items" endpoint. Edited March 6, 2021 by chef Link to comment Share on other sites More sharing options...
pünktchen 1241 Posted March 6, 2021 Share Posted March 6, 2021 The Users endpoint is correct, but the UserId is not. It has to be the GUID without hyphens, not the Long InternalId. If you edit a user profile you can see the id in the browser's adress bar. 1 Link to comment Share on other sites More sharing options...
chef 3744 Posted March 7, 2021 Share Posted March 7, 2021 (edited) So then use the parent Id for the media type with a "Recursive=true" to get all items of a particular type under a user? And perhaps try using the "filter" param with "isPlayed", to get only played items for a particular user. Edited March 7, 2021 by chef Link to comment Share on other sites More sharing options...
Happy2Play 8138 Posted March 7, 2021 Share Posted March 7, 2021 (edited) Have you looked at the log when you get this info in the UI? Quote 2021-03-06 16:39:02.056 Info Server: http/1.1 GET http://localhost:8096/emby/Users/5a53fdcxxxxxxxxxx5b768aae1a4271b/Items?SortBy=DateLastContentAdded,SortName&SortOrder=Descending&IncludeItemTypes=Series&Recursive=true&Fields=BasicSyncInfo,CanDelete,PrimaryImageAspectRatio,ProductionYear,Status,EndDate&ImageTypeLimit=1&EnableImageTypes=Primary,Backdrop,Thumb&StartIndex=0&Limit=50&ParentId=6c2a057148b4d7c20a207c789aba6d07&Filters=IsPlayed&X-Emby-Client=Emby But via itemsservice Quote curl -X GET "http://homeserver:8096/emby/Users/5a53fdcxxxxxxxxxx5b768aae1a4271b/Items?ParentId=f137a2dd21bbc1b99aa5c0f6bf02a805&IsPlayed=true&api_key=3ee0af11668xxxxxxxxxx90ee338d1a0" -H "accept: application/json" or Quote curl -X GET "http://homeserver:8096/emby/Users/5a53fdcxxxxxxxxxx5b768aae1a4271b/Items?ParentId=f137a2dd21bbc1b99aa5c0f6bf02a805&Filters=IsPlayed&api_key=3ee0af11668xxxxxxxxxx90ee338d1a0" -H "accept: application/json" so filter=isplayed or isplayed=true by specific library (parentid) Edited March 7, 2021 by Happy2Play Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now