luigi311 / JellyPlex-Watched

Sync watched between jellyfin and plex locally
GNU General Public License v3.0
398 stars 22 forks source link

[BUG] Issues with jellyfin 10.9 related to userdata and status #149

Closed Stephan3 closed 4 months ago

Stephan3 commented 8 months ago

Describe the bug Jellyfin 10.9. returns dict, thats not ecxpected.

To Reproduce Steps to reproduce the behavior: Install yellyfin 10.9. , Checkout JellyPlex git and see.

Expected behavior A clear and concise description of what you expected to happen.

Logs JellyPlex:

[INFO]: Dryrun: True
[INFO]: Creating (black/white)lists
[INFO]: Blacklist Library: []
[INFO]: Blacklist Library Type: []
[INFO]: Blacklist Users: []
[INFO]: Whitelist Library: []
[INFO]: Whitelist Library Type: []
[INFO]: Whitelist Users: ['derdigge']
[INFO]: Creating server connections
Server 1: Plex: Skynet: 1.40.0.7775-456fbaf97
Server 2: Jellyfin: Skynet: 10.9.0
[INFO]: Creating users list
[INFO]: Server 1 users: ['derdigge']
[INFO]: Server 2 users: ['derdigge']
[INFO]: User list that exist on both servers {'derdigge': 'derdigge'}
[INFO]: Filtered user list {'derdigge': 'derdigge'}
[INFO]: Server 1 users: [<MyPlexAccount:12845991:derdigge>]
[INFO]: Server 2 users: {'derdigge': '4bd3dcf0fd5640a2a6c8c6f29e5910be'}
[INFO]: Creating watched lists
Plex: Generating watched for derdigge in library Filme
[INFO]: Plex: Got watched for derdigge in library Filme
Plex: Generating watched for derdigge in library Kinderserien
[INFO]: Plex: Got watched for derdigge in library Kinderserien
Plex: Generating watched for derdigge in library Serien
[INFO]: Plex: Got watched for derdigge in library Serien
[INFO]: Finished creating watched list server 1
Jellyfin: Generating watched for derdigge in library Filme
[ERROR]: Jellyfin: Query get /Users/4bd3dcf0fd5640a2a6c8c6f29e5910be/Items?ParentId=7a2175bccb1f1a94152cbd2b2bae8f6d&Filters=IsResumable&IncludeItemTypes=Movie&Recursive=True&Fields=ItemCounts,ProviderIds,MediaSources
Results None
'Response' object has no attribute 'status'
[ERROR]: Jellyfin: Failed to get watched for derdigge in library Filme, Error: 'Response' object has no attribute 'status'
[ERROR]: Traceback (most recent call last):
  File "/home/stephan/JellyPlex-Watched/src/jellyfin.py", line 135, in query
    f"Query failed with status {response.status} {response.reason}"
                                ^^^^^^^^^^^^^^^
AttributeError: 'Response' object has no attribute 'status'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/stephan/JellyPlex-Watched/src/jellyfin.py", line 216, in get_user_library_watched
    in_progress = self.query(
                  ^^^^^^^^^^^
  File "/home/stephan/JellyPlex-Watched/src/jellyfin.py", line 160, in query
    raise Exception(e)
Exception: 'Response' object has no attribute 'status'

[INFO]: Jellyfin: Skipping Library Sammlungen found types: set(), all types: {'BoxSet'}
Jellyfin: Generating watched for derdigge in library Serien
[ERROR]: Jellyfin: Failed to get watched for derdigge in library Serien, Error: 'UserData'
[ERROR]: Traceback (most recent call last):
  File "/home/stephan/JellyPlex-Watched/src/jellyfin.py", line 259, in get_user_library_watched
    if "PlayedPercentage" in show["UserData"]:
                             ~~~~^^^^^^^^^^^^
KeyError: 'UserData'

[INFO]: Finished creating watched list server 2
[INFO]: Cleaning Server 1 Watched
[INFO]: derdigge and None not found in watched list 2
[INFO]: Cleaning Server 2 Watched
......................................

Yellyfin:

[2024-02-05 20:10:19.863 +01:00] [ERR] [172] Jellyfin.Api.Middleware.ExceptionMiddleware: Error processing request. URL "GET" "/Users/4bd3dcf0fd5640a2a6c8c6f29e5910be/Items".
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: 'no such column: playbackPositionTicks'.
   at Microsoft.Data.Sqlite.SqliteCommand.PrepareAndEnumerateStatements()+MoveNext()
   at Microsoft.Data.Sqlite.SqliteCommand.GetStatements()+MoveNext()
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Emby.Server.Implementations.Data.SqliteExtensions.ExecuteQuery(SqliteCommand command)+MoveNext()
   at Emby.Server.Implementations.Data.SqliteItemRepository.GetItemList(InternalItemsQuery query) in /home/stephan/.cache/yay/jellyfin-git/src/jellyfin/Emby.Server.Implementations/Data/SqliteItemRepository.cs:line 2577
   at Emby.Server.Implementations.Data.SqliteItemRepository.GetItems(InternalItemsQuery query) in /home/stephan/.cache/yay/jellyfin-git/src/jellyfin/Emby.Server.Implementations/Data/SqliteItemRepository.cs:line 2666
   at MediaBrowser.Controller.Entities.Folder.QueryRecursive(InternalItemsQuery query)
   at MediaBrowser.Controller.Entities.Folder.GetItemsInternal(InternalItemsQuery query) in /home/stephan/.cache/yay/jellyfin-git/src/jellyfin/MediaBrowser.Controller/Entities/Folder.cs:line 936
   at Jellyfin.Api.Controllers.ItemsController.GetItems(Nullable`1 userId, String maxOfficialRating, Nullable`1 hasThemeSong, Nullable`1 hasThemeVideo, Nullable`1 hasSubtitles, Nullable`1 hasSpecialFeature, Nullable`1 hasTrailer, Nullable`1 adjacentTo, Nullable`1 parentIndexNumber, Nullable`1 hasParentalRating, Nullable`1 isHd, Nullable`1 is4K, LocationType[] locationTypes, LocationType[] excludeLocationTypes, Nullable`1 isMissing, Nullable`1 isUnaired, Nullable`1 minCommunityRating, Nullable`1 minCriticRating, Nullable`1 minPremiereDate, Nullable`1 minDateLastSaved, Nullable`1 minDateLastSavedForUser, Nullable`1 maxPremiereDate, Nullable`1 hasOverview, Nullable`1 hasImdbId, Nullable`1 hasTmdbId, Nullable`1 hasTvdbId, Nullable`1 isMovie, Nullable`1 isSeries, Nullable`1 isNews, Nullable`1 isKids, Nullable`1 isSports, Guid[] excludeItemIds, Nullable`1 startIndex, Nullable`1 limit, Nullable`1 recursive, String searchTerm, SortOrder[] sortOrder, Nullable`1 parentId, ItemFields[] fields, BaseItemKind[] excludeItemTypes, BaseItemKind[] includeItemTypes, ItemFilter[] filters, Nullable`1 isFavorite, MediaType[] mediaTypes, ImageType[] imageTypes, ItemSortBy[] sortBy, Nullable`1 isPlayed, String[] genres, String[] officialRatings, String[] tags, Int32[] years, Nullable`1 enableUserData, Nullable`1 imageTypeLimit, ImageType[] enableImageTypes, String person, Guid[] personIds, String[] personTypes, String[] studios, String[] artists, Guid[] excludeArtistIds, Guid[] artistIds, Guid[] albumArtistIds, Guid[] contributingArtistIds, String[] albums, Guid[] albumIds, Guid[] ids, VideoType[] videoTypes, String minOfficialRating, Nullable`1 isLocked, Nullable`1 isPlaceHolder, Nullable`1 hasOfficialRating, Nullable`1 collapseBoxSetItems, Nullable`1 minWidth, Nullable`1 minHeight, Nullable`1 maxWidth, Nullable`1 maxHeight, Nullable`1 is3D, SeriesStatus[] seriesStatus, String nameStartsWithOrGreater, String nameStartsWith, String nameLessThan, Guid[] studioIds, Guid[] genreIds, Boolean enableTotalRecordCount, Nullable`1 enableImages) in /home/stephan/.cache/yay/jellyfin-git/src/jellyfin/Jellyfin.Api/Controllers/ItemsController.cs:line 511
   at Jellyfin.Api.Controllers.ItemsController.GetItemsByUserId(Guid userId, String maxOfficialRating, Nullable`1 hasThemeSong, Nullable`1 hasThemeVideo, Nullable`1 hasSubtitles, Nullable`1 hasSpecialFeature, Nullable`1 hasTrailer, Nullable`1 adjacentTo, Nullable`1 parentIndexNumber, Nullable`1 hasParentalRating, Nullable`1 isHd, Nullable`1 is4K, LocationType[] locationTypes, LocationType[] excludeLocationTypes, Nullable`1 isMissing, Nullable`1 isUnaired, Nullable`1 minCommunityRating, Nullable`1 minCriticRating, Nullable`1 minPremiereDate, Nullable`1 minDateLastSaved, Nullable`1 minDateLastSavedForUser, Nullable`1 maxPremiereDate, Nullable`1 hasOverview, Nullable`1 hasImdbId, Nullable`1 hasTmdbId, Nullable`1 hasTvdbId, Nullable`1 isMovie, Nullable`1 isSeries, Nullable`1 isNews, Nullable`1 isKids, Nullable`1 isSports, Guid[] excludeItemIds, Nullable`1 startIndex, Nullable`1 limit, Nullable`1 recursive, String searchTerm, SortOrder[] sortOrder, Nullable`1 parentId, ItemFields[] fields, BaseItemKind[] excludeItemTypes, BaseItemKind[] includeItemTypes, ItemFilter[] filters, Nullable`1 isFavorite, MediaType[] mediaTypes, ImageType[] imageTypes, ItemSortBy[] sortBy, Nullable`1 isPlayed, String[] genres, String[] officialRatings, String[] tags, Int32[] years, Nullable`1 enableUserData, Nullable`1 imageTypeLimit, ImageType[] enableImageTypes, String person, Guid[] personIds, String[] personTypes, String[] studios, String[] artists, Guid[] excludeArtistIds, Guid[] artistIds, Guid[] albumArtistIds, Guid[] contributingArtistIds, String[] albums, Guid[] albumIds, Guid[] ids, VideoType[] videoTypes, String minOfficialRating, Nullable`1 isLocked, Nullable`1 isPlaceHolder, Nullable`1 hasOfficialRating, Nullable`1 collapseBoxSetItems, Nullable`1 minWidth, Nullable`1 minHeight, Nullable`1 maxWidth, Nullable`1 maxHeight, Nullable`1 is3D, SeriesStatus[] seriesStatus, String nameStartsWithOrGreater, String nameStartsWith, String nameLessThan, Guid[] studioIds, Guid[] genreIds, Boolean enableTotalRecordCount, Nullable`1 enableImages) in /home/stephan/.cache/yay/jellyfin-git/src/jellyfin/Jellyfin.Api/Controllers/ItemsController.cs:line 703
   at lambda_method1209(Closure, Object, Object[])
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Jellyfin.Api.Middleware.ServerStartupMessageMiddleware.Invoke(HttpContext httpContext, IServerApplicationHost serverApplicationHost, ILocalizationManager localizationManager) in /home/stephan/.cache/yay/jellyfin-git/src/jellyfin/Jellyfin.Api/Middleware/ServerStartupMessageMiddleware.cs:line 41
   at Jellyfin.Api.Middleware.WebSocketHandlerMiddleware.Invoke(HttpContext httpContext, IWebSocketManager webSocketManager) in /home/stephan/.cache/yay/jellyfin-git/src/jellyfin/Jellyfin.Api/Middleware/WebSocketHandlerMiddleware.cs:line 33
   at Jellyfin.Api.Middleware.IPBasedAccessValidationMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager) in /home/stephan/.cache/yay/jellyfin-git/src/jellyfin/Jellyfin.Api/Middleware/IpBasedAccessValidationMiddleware.cs:line 36
   at Jellyfin.Api.Middleware.LanFilteringMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager) in /home/stephan/.cache/yay/jellyfin-git/src/jellyfin/Jellyfin.Api/Middleware/LanFilteringMiddleware.cs:line 37
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Jellyfin.Api.Middleware.QueryStringDecodingMiddleware.Invoke(HttpContext httpContext) in /home/stephan/.cache/yay/jellyfin-git/src/jellyfin/Jellyfin.Api/Middleware/QueryStringDecodingMiddleware.cs:line 36
   at Swashbuckle.AspNetCore.ReDoc.ReDocMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Jellyfin.Api.Middleware.RobotsRedirectionMiddleware.Invoke(HttpContext httpContext) in /home/stephan/.cache/yay/jellyfin-git/src/jellyfin/Jellyfin.Api/Middleware/RobotsRedirectionMiddleware.cs:line 43
   at Jellyfin.Api.Middleware.LegacyEmbyRouteRewriteMiddleware.Invoke(HttpContext httpContext) in /home/stephan/.cache/yay/jellyfin-git/src/jellyfin/Jellyfin.Api/Middleware/LegacyEmbyRouteRewriteMiddleware.cs:line 51
   at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
   at Jellyfin.Api.Middleware.ResponseTimeMiddleware.Invoke(HttpContext context, IServerConfigurationManager serverConfigurationManager) in /home/stephan/.cache/yay/jellyfin-git/src/jellyfin/Jellyfin.Api/Middleware/ResponseTimeMiddleware.cs:line 66
   at Jellyfin.Api.Middleware.ExceptionMiddleware.Invoke(HttpContext context) in /home/stephan/.cache/yay/jellyfin-git/src/jellyfin/Jellyfin.Api/Middleware/ExceptionMiddleware.cs:line 55
[2024-02-05 20:11:24.373 +01:00] [INF] [186] Emby.Server.Implementations.Session.SessionWebSocketListener: Sending ForceKeepAlive message to 1 inactive WebSockets.
[2024-02-05 20:14:12.403 +01:00] [INF] [143] Emby.Server.Implementations.Session.SessionWebSocketListener: Sending ForceKeepAlive message to 1 inactive WebSockets.
[2024-02-05 20:17:48.444 +01:00] [INF] [136] Emby.Server.Implementations.Session.SessionWebSocketListener: Sending ForceKeepAlive message to 1 inactive WebSockets.
[2024-02-05 20:20:36.476 +01:00] [INF] [168] Emby.Server.Implementations.Session.SessionWebSocketListener: Sending ForceKeepAlive message to 1 inactive WebSockets.

Type:

Additional context Add any other context about the problem here.

luigi311 commented 6 months ago

looks like things have moved around for 10.9 based on that error message. Looks like they are hoping to do a release at the end of this month and they are testing 10.9 already ill go ahead and start to take a look and see what needs to be changed and how i will handle this internally without breaking prior releases.

luigi311 commented 5 months ago

looks like this is an issue with the jellyfin 10.9 database failing, ive opened an issue https://github.com/jellyfin/jellyfin/issues/11312

luigi311 commented 4 months ago

Looks like this has been resolved and it is working in 10.9 now.