@@ -474,21 +474,18 @@ def watchlist_movies(self):
474474 return self ._movie_watchlist
475475
476476 @property
477- @get
478477 def movie_collection (self ):
479478 """All :class:`Movie`'s in this :class:`User`'s library collection.
480479 Collection items might include blu-rays, dvds, and digital downloads.
481480 Protected users won't return any data unless you are friends.
482481 """
483482 if self ._movie_collection is None :
484- data = yield build_uri ('users/{username}/collection/movies' ,
483+ data = paginate ('users/{username}/collection/movies' ,
485484 username = slugify (self .username ),
486485 extended = 'metadata' )
487- self ._movie_collection = []
488- for movie in data :
489- mov = movie .pop ('movie' )
490- self ._movie_collection .append (Movie (** mov ))
491- yield self ._movie_collection
486+
487+ self ._movie_collection = self ._build_movies (data , merge = False )
488+ return self ._movie_collection
492489
493490 @property
494491 @get
@@ -518,7 +515,7 @@ def show_collection(self):
518515 yield self ._show_collection
519516
520517 @staticmethod
521- def _build_movies (data ):
518+ def _build_movies (data , merge = True ):
522519 """Parse raw API response data into a list of :class:`Movie` objects.
523520
524521 :param data: List of raw movie dicts from the Trakt API
@@ -534,7 +531,9 @@ def _build_movies(data):
534531 logger .warning ("Ignoring invalid Movie with no title: %s" , original )
535532 continue
536533
537- movie_data .update (movie )
534+ if merge :
535+ movie_data .update (movie )
536+
538537 movies .append (Movie (** movie_data ))
539538
540539 return movies
0 commit comments