From a15a804000da9eac9170ada2daa22bce5e113c65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Sat, 11 Jul 2026 15:13:58 +0300 Subject: [PATCH 1/3] Paginage user.movie_collection property --- trakt/users.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/trakt/users.py b/trakt/users.py index efe71c9..bf40374 100644 --- a/trakt/users.py +++ b/trakt/users.py @@ -474,21 +474,20 @@ def watchlist_movies(self): return self._movie_watchlist @property - @get def movie_collection(self): """All :class:`Movie`'s in this :class:`User`'s library collection. Collection items might include blu-rays, dvds, and digital downloads. Protected users won't return any data unless you are friends. """ if self._movie_collection is None: - data = yield build_uri('users/{username}/collection/movies', + data = paginate('users/{username}/collection/movies', username=slugify(self.username), extended='metadata') self._movie_collection = [] for movie in data: mov = movie.pop('movie') self._movie_collection.append(Movie(**mov)) - yield self._movie_collection + return self._movie_collection @property @get From 557568c5e7435316f5498db4d16634d9f0c57282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Sat, 11 Jul 2026 15:15:15 +0300 Subject: [PATCH 2/3] Add merge=True to _build_movies Allow re-use code, but don't break if merge is unwanted --- trakt/users.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/trakt/users.py b/trakt/users.py index bf40374..44d40c4 100644 --- a/trakt/users.py +++ b/trakt/users.py @@ -517,7 +517,7 @@ def show_collection(self): yield self._show_collection @staticmethod - def _build_movies(data): + def _build_movies(data, merge=True): """Parse raw API response data into a list of :class:`Movie` objects. :param data: List of raw movie dicts from the Trakt API @@ -533,7 +533,9 @@ def _build_movies(data): logger.warning("Ignoring invalid Movie with no title: %s", original) continue - movie_data.update(movie) + if merge: + movie_data.update(movie) + movies.append(Movie(**movie_data)) return movies From 6179d4291491500885e5d2b5b94440542ee800b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Sat, 11 Jul 2026 15:15:55 +0300 Subject: [PATCH 3/3] Re-use _build_movies in movie_collection --- trakt/users.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/trakt/users.py b/trakt/users.py index 44d40c4..1a4c6ed 100644 --- a/trakt/users.py +++ b/trakt/users.py @@ -483,10 +483,8 @@ def movie_collection(self): data = paginate('users/{username}/collection/movies', username=slugify(self.username), extended='metadata') - self._movie_collection = [] - for movie in data: - mov = movie.pop('movie') - self._movie_collection.append(Movie(**mov)) + + self._movie_collection = self._build_movies(data, merge=False) return self._movie_collection @property