sbondCo / Watcharr

Open source, self-hostable watched list for all your content (movies, tv series, anime, games) with user authentication, modern and clean UI and a very simple setup.
https://watcharr.app
MIT License
539 stars 22 forks source link

Plex sync doesn't work for tv shows and ratings #517

Closed gravelfreeman closed 5 months ago

gravelfreeman commented 6 months ago

Steps to reproduce:

  1. Plex server is successfully connected to Watcharr
  2. Settings > Press Sync with Plex button

Error message :

Plex Sync
Finished With 3 Errors
Syncing has finished, but with errors:
    series episodes could not be imported (request failed): ***
    series episodes could not be imported (request failed): ***
    series episodes could not be imported (request failed): ***

I can see that my movies have imported but some are missing ratings. The only 3 imported TV shows are the ones in the error above.

Container logs :

[GIN] 2024/05/08 - 00:06:41 | 200 |    2.103599ms |      172.16.0.1 | GET      "/"
[GIN] 2024/05/08 - 00:06:41 | 200 |     967.447µs |  100.97.167.145 | GET      "/api/plex/sync"
[GIN] 2024/05/08 - 00:06:41 | 200 |       92.08µs |  100.97.167.145 | GET      "/api/job/jY6FdaoJepA="
time=2024-05-08T00:06:41.861Z level=INFO msg="plexSyncWatched: Importing movie." movie_name="August Rush" user_id=2
2024/05/08 00:06:41 /server/watched.go:137 duplicated key not allowed
[0.614ms] [rows:0] INSERT INTO `watcheds` (`created_at`,`updated_at`,`deleted_at`,`status`,`rating`,`thoughts`,`pinned`,`user_id`,`content_id`,`game_id`) VALUES ("2023-07-12 23:17:33","2023-07-12 23:17:33",NULL,"FINISHED",0,"",false,2,1,NULL) RETURNING `id`
time=2024-05-08T00:06:41.864Z level=ERROR msg="plexSyncWatched: unique constraint hit. movie must already be on watch list" error="content already on watched list"
time=2024-05-08T00:06:41.864Z level=INFO msg="plexSyncWatched: Importing movie." movie_name="Blast from the Past" user_id=2
2024/05/08 00:06:41 /server/watched.go:137 duplicated key not allowed
[0.510ms] [rows:0] INSERT INTO `watcheds` (`created_at`,`updated_at`,`deleted_at`,`status`,`rating`,`thoughts`,`pinned`,`user_id`,`content_id`,`game_id`) VALUES ("2023-05-27 00:10:14","2023-05-27 00:10:14",NULL,"FINISHED",0,"",false,2,2,NULL) RETURNING `id`
time=2024-05-08T00:06:41.865Z level=ERROR msg="plexSyncWatched: unique constraint hit. movie must already be on watch list" error="content already on watched list"
time=2024-05-08T00:06:41.865Z level=INFO msg="plexSyncWatched: Importing movie." movie_name="Catch Me If You Can" user_id=2
2024/05/08 00:06:41 /server/watched.go:137 duplicated key not allowed
[0.410ms] [rows:0] INSERT INTO `watcheds` (`created_at`,`updated_at`,`deleted_at`,`status`,`rating`,`thoughts`,`pinned`,`user_id`,`content_id`,`game_id`) VALUES ("2023-11-22 04:27:26","2023-11-22 04:27:26",NULL,"FINISHED",0,"",false,2,3,NULL) RETURNING `id`
time=2024-05-08T00:06:41.866Z level=ERROR msg="plexSyncWatched: unique constraint hit. movie must already be on watch list" error="content already on watched list"
time=2024-05-08T00:06:41.866Z level=INFO msg="plexSyncWatched: Importing movie." movie_name="Dead Poets Society" user_id=2

[...]

2024/05/08 00:06:42 /server/watched.go:137 duplicated key not allowed
[0.492ms] [rows:0] INSERT INTO `watcheds` (`created_at`,`updated_at`,`deleted_at`,`status`,`rating`,`thoughts`,`pinned`,`user_id`,`content_id`,`game_id`) VALUES ("2024-04-18 00:48:13","2024-04-18 00:48:13",NULL,"FINISHED",0,"",false,2,117,NULL) RETURNING `id`
time=2024-05-08T00:06:42.635Z level=INFO msg="plexSyncWatched: unique constraint hit. show must already be on watch list" error="content already on watched list"
time=2024-05-08T00:06:42.674Z level=ERROR msg="plexSyncWatched: Failed to fetch series episodes." series_name="The Ranch" series_id=plex://show/5d9c0817e264b7001fc3bba2 user_id=2 error="json: cannot unmarshal string into Go struct field .MediaContainer.viewMode of type int"
time=2024-05-08T00:06:42.674Z level=INFO msg="plexSyncWatched: Importing show." show_name=Wednesday user_id=2
2024/05/08 00:06:42 /server/watched.go:137 duplicated key not allowed
[0.304ms] [rows:0] INSERT INTO `watcheds` (`created_at`,`updated_at`,`deleted_at`,`status`,`rating`,`thoughts`,`pinned`,`user_id`,`content_id`,`game_id`) VALUES ("1970-01-01 00:00:00","1970-01-01 00:00:00",NULL,"FINISHED",0,"",false,2,118,NULL) RETURNING `id`
time=2024-05-08T00:06:42.675Z level=INFO msg="plexSyncWatched: unique constraint hit. show must already be on watch list" error="content already on watched list"
time=2024-05-08T00:06:42.691Z level=ERROR msg="plexSyncWatched: Failed to fetch series episodes." series_name=Wednesday series_id=plex://show/60300ded22d896002c2d4897 user_id=2 error="json: cannot unmarshal string into Go struct field .MediaContainer.viewMode of type int"
time=2024-05-08T00:06:42.737Z level=INFO msg="plexSyncWatched: Importing show." show_name="Les Lavigueur, la vraie histoire" user_id=2
2024/05/08 00:06:42 /server/watched.go:137 duplicated key not allowed
[0.569ms] [rows:0] INSERT INTO `watcheds` (`created_at`,`updated_at`,`deleted_at`,`status`,`rating`,`thoughts`,`pinned`,`user_id`,`content_id`,`game_id`) VALUES ("2023-12-14 02:49:51","2023-12-14 02:49:51",NULL,"FINISHED",0,"",false,2,119,NULL) RETURNING `id`
time=2024-05-08T00:06:42.739Z level=INFO msg="plexSyncWatched: unique constraint hit. show must already be on watch list" error="content already on watched list"
time=2024-05-08T00:06:42.754Z level=ERROR msg="plexSyncWatched: Failed to fetch series episodes." series_name="Les Lavigueur, la vraie histoire" series_id=plex://show/5d9c0801e264b7001fc3992b user_id=2 error="json: cannot unmarshal string into Go struct field .MediaContainer.viewMode of type int"
gravelfreeman commented 6 months ago

I'm curious if you were able to reproduce this? I cancelled my Trakt subscription and Watcharr is my one and only tracking list now!

Let me know if you need someone to test. Also if you have a Discord I could join it!

IRHM commented 5 months ago

Hey @gravelfreeman, sorry I missed this issue, looks like something might be up with the struct we unmarshal the response from Plex into.

From the log it looks like its the ViewMode property, I can confirm we have it down as an int not a string. I don't think we use that property so maybe we can remove it and have you try without it.

I don't use Plex, so it's a bit hard testing, I appreciate that you are willing to do so!

Hopefully I can get a dev build out on the weekend, will ping you when it's built.

p.s. We don't have a discord, but we do have a matrix chat: https://matrix.to/#/#watcharr:matrix.org (no worries if you don't have a matrix account, I'll still ping you here when that build is up)

IRHM commented 5 months ago

Hi @gravelfreeman, going to release an actual build later today, feel free to test this on the latest dev build if you get a chance: https://github.com/sbondCo/Watcharr/pkgs/container/watcharr/227461082?tag=dev

gravelfreeman commented 5 months ago

Hi @gravelfreeman, going to release an actual build later today, feel free to test this on the latest dev build if you get a chance: https://github.com/sbondCo/Watcharr/pkgs/container/watcharr/227461082?tag=dev

I could only test now and there were no errors while importing this time. I feel like there might be missing tv shows but I had to recreate my Plex libraries few months ago which might have destroyed my watch history?

This is really annoying because I thought it was saved on Plex servers and not on my server!