Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TV Shows added to IMDB Top Movies list? #228

Closed
BEisem opened this issue Apr 12, 2021 · 34 comments · Fixed by #293
Closed

TV Shows added to IMDB Top Movies list? #228

BEisem opened this issue Apr 12, 2021 · 34 comments · Fixed by #293

Comments

@BEisem
Copy link

BEisem commented Apr 12, 2021

When I do a full sync, I'm seeing several entries in the log like the following:

2021-04-11 19:21:35,765 INFO[PlexTraktSync]:Show [St. Elsewhere (1982)]: s02e09 added to list IMDB: Top Rated Movies
2021-04-11 19:21:35,786 INFO[PlexTraktSync]:Show [St. Elsewhere (1982)]: s02e15 added to list IMDB: Top Rated Movies

The problem is, it is indicating that a TV show episode is being added to a list called IMDB Top Rated Movies.

@glensc
Copy link
Collaborator

glensc commented Apr 12, 2021

@BEisem Please include version info in your bugreport!

But other than that, I don't understand what are you reporting here:

  1. what is the problem with what it's doing now?
  2. what is the expected outcome?

I'm not familiar with the feature myself.

@BEisem
Copy link
Author

BEisem commented Apr 12, 2021

Sorry, I don't know how to determine the version. I pulled this from the "main" branch. Is that sufficient? How else can I determine the version I'm using?

As far as the problem... the list is called IMDB Top Rated Movies, but it is adding TV show episodes to the list. I guess I would expect it to add movies to a movie list, not TV episodes.

I'm not familiar with the feature either, I just noticed the entries in the logs, so I figured if it was going to add things to a movie list, it should be adding movies, not TV episodes.

@glensc
Copy link
Collaborator

glensc commented Apr 12, 2021

Sorry, I don't know how to determine the version. I pulled this from the "main" branch. Is that sufficient? How else can I determine the version I'm using?

Third time already pointing you to this info:

I do not know what means "pulled from the main branch" in your case. if it's git pull, then git describe --tags should print the closest tag. if you used zip download, you should have used zip for tag rather than a branch.

@glensc
Copy link
Collaborator

glensc commented Apr 12, 2021

regarding the issue at hand: ok, now I see what you mean.

if you don't use the feature you can turn it off, it's either "liked_lists" or "watchlist":

@BEisem
Copy link
Author

BEisem commented Apr 12, 2021

Ok, previously I was downloading the zip file from the "main" branch, but now I understand how to use git clone with a tag. I have cloned 0.6.44 (currently the latest) and tested this, and it is still occurring.

I know I could turn off the feature, but as a test, I believe it should be fixed anyway, in case someone does want to use the feature.

@glensc
Copy link
Collaborator

glensc commented Apr 12, 2021

I don't argue it shouldn't be fixed :)

@simonc56
Copy link
Collaborator

simonc56 commented Apr 19, 2021

The script is mixing trakt ids from Movies and TV episodes. That's the reason.

Some trakt ids are identicals such as 1034 corresponding to both :

  • St. Elsewhere (1982) s02e09
  • Raging Bull (a movie in IMDB top 250)

id 1040 corresponding to both :

  • St. Elsewhere (1982) s02e15
  • It's a Wonderfull Life (a movie in IMDB top 250)

I didn't dig further into the code yet.
When searching an item from its trakt id, the script should specify the type shows or movies.

Trakt doc says :

type (string) : Filter for a specific item type
Possible values: movie , show , season , episode , person .

Trakt Q&A : trakt/trakt-api#287

@glensc
Copy link
Collaborator

glensc commented Apr 19, 2021

@twolaw can you point to any code you looked at?

at least our search_by_id trakt method matches correct media type:

  • @rate_limit()
    def search_by_id(self, media_id: str, id_type: str, media_type: str):
    search = trakt.sync.search_by_id(media_id, id_type=id_type, media_type=media_type)
    # look for the first wanted type in the results
    for m in search:
    if m.media_type == f"{media_type}s":
    return m
    return None

however, our extra check is no longer necessary there, as media_type is passed as an argument. haven't yet cleaned up.

@simonc56
Copy link
Collaborator

simonc56 commented Apr 19, 2021

I don't think it's in this search_by_id function.
I think it's when script goes through every episode, it check if its id is in any lists to do the match with Plex id and add to Plex list. At this moment the type check may be missing.
I say this from my mind, I will look the code later.

edit : I'm completely lost will the complete code revamp you did (unexplicit variables such as tm, te, pe,...)

@glensc
Copy link
Collaborator

glensc commented Apr 19, 2021

@twolaw ah, I thought you already looked at the code.

@glensc
Copy link
Collaborator

glensc commented Apr 19, 2021

pm/tm/pe/te are gone now (mostly):

@glensc
Copy link
Collaborator

glensc commented Apr 19, 2021

@twolaw I have not refactored the watchlist thing. so it's just carried over preserving original behavior/logic. I have not touched that part at all, so I can't comment as I don't understand it.

ps: the latest code is in 0.8.x branch.

ps2: here's an overview of the branches: #162 (comment)

@simonc56
Copy link
Collaborator

simonc56 commented Apr 19, 2021

Yes I get it now.

As far as I understand it :

  • A watchlist will only contain movies because the script filters to get only movies (trakt can put anything in a watchlist). That's quite fair because nobody would create a watchlist of tv episodes, that's useless.

  • A custom list can contain movies and episodes. The script filters the trakt response to remove shows and seasons because Plex cannot put a show or a season in a list. Before Add tv episodes to playlist sync trakt->plex #76, a custom list only contained movies.

The script stores watchlist and custom list as TraktList object and removes the attribute movie or episode when building the list. That's the line :

self.traktids = dict(zip(map(lambda e: e.trakt, [elem for elem in UserList._get(listname, username).get_items() if isinstance(elem, (Movie, TVEpisode))]), count(1)))

Usefull links:
#124
#134
#58

@simonc56
Copy link
Collaborator

simonc56 commented Apr 24, 2021

@glensc why is there listutil.addPlexItemToLists for tv (5d06e61) and not for movies ?

# add to plex lists
listutil.addPlexItemToLists(me.trakt_id, me.plex.item)

In 0.6.x the logic has changed and it looks like addPlexItemToLists for movies have been removed f647c82
Can you help me understand ?

@glensc
Copy link
Collaborator

glensc commented Apr 24, 2021

@twolaw I guess I was confused with the listutil line below when refactoring:

Submitted a possible fix: #287

@glensc
Copy link
Collaborator

glensc commented Apr 25, 2021

@twolaw #287 was merged, does this make #228 solved?

@simonc56
Copy link
Collaborator

No, I'm waiting an answer to trakt/trakt-api#287 then I'll write a fix.

@glensc
Copy link
Collaborator

glensc commented Apr 25, 2021

@twolaw I don't understand that question there. you should include URLs or API queries where you got those results. to be clearer. and also, what is unicity?

as I answered here before, each domain (movie,show,episode,actor,director, etc) has its own id, so across the domains, it's expected to have id overlap. you should match with media_type in the queries. as for example for search I already provided an example:

@simonc56
Copy link
Collaborator

As I said it is a clearly defined bug in trakt_list_util (line 17 and more) it is not a problem about trakt queries or trakt answers.

Repository owner deleted a comment from glensc Apr 25, 2021
@simonc56
Copy link
Collaborator

simonc56 commented Apr 26, 2021

@BEisem can you try again IMDB: Top Rated Movies list sync with this fix #293 and tell me if it's OK ?

I tested this list myself and it worked.

@BEisem
Copy link
Author

BEisem commented Apr 26, 2021

@twolaw can you give me instructions on how to sync a specific list? I've never used this feature so I don't know how it works, and I can't find any documentation. Otherwise I'd be happy to test it...

@simonc56
Copy link
Collaborator

Just make sure liked_lists is at True in config file then go for a sync.

@BEisem
Copy link
Author

BEisem commented Apr 26, 2021

Ok, that's what I thought ... but I'm getting errors. Do I have to have a playlist in Plex named IMDB: Top Rated Movies?

INFO: Syncing with Plex BlaEis and Trakt binkatl
INFO: Filtering Library: Stand-Up Comedy
INFO: Syncing TV=True, Movies=True
INFO: Loaded Trakt lists in 14.1 seconds
INFO: Downloaded List Rotten Tomatoes: Best of 2019
INFO: Downloaded List IMDB: Top Rated Movies
INFO: Server version 1.22.3.4392-d7c624def updated at: 2021-04-21 10:20:45
INFO: Recently added: [<Movie:386104:F.E.A.R.>, <Season:386081:Phil-of-the-Future-s2>, <Season:386058:Even-Stevens-s3>, <Season:386035:Even-Stevens-s2>, <Season:386014:Even-Stevens-s1>]
Processing Stand-Up Comedy  [##############----------------------]  130/323  00:00:02WARNING: Skipping <imdb:tt2243073:<Movie:365451:Hannah-Gadsby:-Kiss->>: Not found on Trakt
Processing Stand-Up Comedy  [#########################-----------]  229/323  00:00:01WARNING: Skipping <imdb:tt6140294:<Movie:365744:The-Nasty-Show-Hoste>>: Not found on Trakt
Processing Stand-Up Comedy  [####################################]  323/323          
INFO: Stand-Up Comedy processed in 4.3 seconds
ERROR: Playlist Rotten Tomatoes: Best of 2019 not found, so it could not be deleted. Actual playlists: [<Playlist:/playlists/282615:70's-Comedies>, <Playlist:/playlists/280507:80s-Comedy>, <Playlist:/playlists/282612:90's-Comedies>, <Playlist:/playlists/282613:2000's-Comedies>, <Playlist:/playlists/261465:All-Music>, <Playlist:/playlists/261476:All-Music>, <Playlist:/playlists/261466:Recently-Added>, <Playlist:/playlists/261475:Recently-Added>, <Playlist:/playlists/261467:Recently-Played>, <Playlist:/playlists/261477:Recently-Played>, <Playlist:/playlists/128363:Action>, <Playlist:/playlists/141517:Blake-and-Diane>, <Playlist:/playlists/372604:Blake-and-Diane-Movi>, <Playlist:/playlists/128362:Comedy>, <Playlist:/playlists/141481:Drama>, <Playlist:/playlists/362220:Reality-TV>, <Playlist:/playlists/141480:Sci-Fi>]
ERROR: Playlist IMDB: Top Rated Movies not found, so it could not be deleted. Actual playlists: [<Playlist:/playlists/282615:70's-Comedies>, <Playlist:/playlists/280507:80s-Comedy>, <Playlist:/playlists/282612:90's-Comedies>, <Playlist:/playlists/282613:2000's-Comedies>, <Playlist:/playlists/261465:All-Music>, <Playlist:/playlists/261476:All-Music>, <Playlist:/playlists/261466:Recently-Added>, <Playlist:/playlists/261475:Recently-Added>, <Playlist:/playlists/261467:Recently-Played>, <Playlist:/playlists/261477:Recently-Played>, <Playlist:/playlists/128363:Action>, <Playlist:/playlists/141517:Blake-and-Diane>, <Playlist:/playlists/372604:Blake-and-Diane-Movi>, <Playlist:/playlists/128362:Comedy>, <Playlist:/playlists/141481:Drama>, <Playlist:/playlists/362220:Reality-TV>, <Playlist:/playlists/141480:Sci-Fi>]
INFO: Updated plex watchlist in 0.0 seconds
INFO: Completed full sync in 19.3 seconds

@BEisem
Copy link
Author

BEisem commented Apr 26, 2021

I tried creating new playlists on Plex called IMDB: Top Rates Movies and Rotten Tomatoes: Best of 2019but I'm getting the same errors as before...

@simonc56
Copy link
Collaborator

My mistake, I should have told you that syncing lists can be properly achieved only if you sync all Plex libraries.
Script must go through all movies and episodes to find them, do the matching and put them in plex playlists.

Reminder : you use files from https://github.com/twolaw/PlexTraktSync/tree/fix-addPlexItemToLists for this test of course.

ERROR Playlist not found lines are not important here.

@BEisem
Copy link
Author

BEisem commented Apr 26, 2021

Ah, ok... I see. I am starting a full sync now. I don't typically do full syncs because of the size of my library, but I'll let you know the results when it finishes. It will take a few hours, most likely. And yes, I am using the files at the ink you posted above for this test ...

So far, it seems to be working, or at least doing something...

Processing Movies  [------------------------------------]  21/11192  02:19:04INFO: Movie [3 Faces (2018)]: added to list Rotten Tomatoes: Best of 2019
Processing Movies  [------------------------------------]  65/11192  01:40:08INFO: Movie [12 Angry Men (1957)]: added to list IMDB: Top Rated Movies
Processing Movies  [------------------------------------]  76/11192  01:39:32INFO: Movie [12 Years a Slave (2013)]: added to list IMDB: Top Rated Movies
Processing Movies  [------------------------------------]  163/11192  01:30:59INFO: Movie [1917 (2019)]: added to list IMDB: Top Rated Movies
Processing Movies  [------------------------------------]  166/11192  01:30:54INFO: Movie [2001: A Space Odyssey (1968)]: added to list IMDB: Top Rated Movies
Processing Movies  [------------------------------------]  245/11192  01:27:14INFO: Movie [Ad Astra (2019)]: added to list Rotten Tomatoes: Best of 2019

Although I looked in Plex and I don't see those entries added to a Playlist yet. Does it add them in Plex at the end of the run?

@simonc56
Copy link
Collaborator

Yes, at the end.
First it collects them all, then it sends the command to plex to create the lists.

@BEisem
Copy link
Author

BEisem commented Apr 26, 2021

I just completed a full sync, and it worked! Both playlists were added to Plex at the end of the sync.

I have a couple of suggestions. Let me know if you want me to add them as separate Feature Request issues...

The first is, I know you changed the "Playlist not found" to debug log level, and that will get rid of the errors. But it would be nice to have some sort of output at the end, indicating how many (if any) items were added to each list, or what actually happened during the playlist sync.

The other thing, if it's possible, it would be great if it would sync playlists without having to do a full sync of all libraries. If there is a way to add in this logic, let's say I sync only Movies libraries (--sync=movies), could it still sync movies playlists? The reason I ask is, I will probably never do a full sync of all libraries, because of the size of my libraries and the time it takes. I typically sync TV shows throughout the day, and then do a single Movie sync at night. So it would be nice if it handled the Movie playlists during that movie sync, and if there were any TV playlists, it could handle those during the TV library sync. Does that make sense?

@BEisem
Copy link
Author

BEisem commented Apr 26, 2021

One other thing, I just noticed after running this, the trakt_cache.sqlite file has ballooned from 115.6MB to 1.96GB. Did the playlist sync really add that much more to the cache file?

@simonc56
Copy link
Collaborator

simonc56 commented Apr 26, 2021

I don't think the cause is playlist.
I think it is due to your full sync with large libraries which heavily requests trakt API.
Did your previous sync covered all your libraries like this sync ?

@BEisem
Copy link
Author

BEisem commented Apr 26, 2021

I'm not so sure ... I've run both --sync=tv and --sync=movies using this instance, and the largest I've ever seen the cache is the previously mentioned 115.6MB. Essentially, the two combined (--sync=tv + --sync=movies) should be equivalent to a full sync, right?

But then, after running a full sync using #293, suddenly the cache file is almost 20x larger. It's not a big deal, because it's still a reasonable size, but I just wanted to point it out as a possible problem.

I'll try running a full sync using the main version, and see if I get the same results afterwards...

@BEisem
Copy link
Author

BEisem commented Apr 27, 2021

I just completed a full sync using the main branch, and the trakt-cache.sqlite file is only 118.4MB.

@simonc56
Copy link
Collaborator

Ok then you can create a new issue about this cache size problem.
Give as much details as you can (version 0.9.x , step-by-step to reproduce, etc...)

I close this issue now.

@glensc
Copy link
Collaborator

glensc commented Apr 27, 2021

I merged to 0.9.x cache command that can print URLs (requires requests_cache 0.6.x):

it may be useful giving idea of cache contents.

Repository owner locked as resolved and limited conversation to collaborators Jan 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants