Skip to content

Commit 106efeb

Browse files
authored
Refactor: Re-use build_movies for watchlist_movies (#124)
2 parents 17571bb + b840214 commit 106efeb

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

trakt/users.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -457,11 +457,7 @@ def watchlist_movies(self):
457457
data = paginate('users/{username}/watchlist/movies',
458458
username=slugify(self.username),
459459
)
460-
self._movie_watchlist = []
461-
for movie in data:
462-
mov = movie.pop('movie')
463-
mov.update(movie)
464-
self._movie_watchlist.append(Movie(**mov))
460+
self._movie_watchlist = self._build_movies(data or [])
465461
return self._movie_watchlist
466462

467463
@property
@@ -515,12 +511,12 @@ def _build_movies(data):
515511
:param data: List of raw movie dicts from the Trakt API
516512
:return: List of :class:`Movie` instances
517513
"""
518-
watched_movies = []
514+
movies = []
519515
for movie in data:
520516
movie_data = movie.pop('movie')
521517
movie_data.update(movie)
522-
watched_movies.append(Movie(**movie_data))
523-
return watched_movies
518+
movies.append(Movie(**movie_data))
519+
return movies
524520

525521
@get
526522
def get_watched_movies(self, page=None, limit=None):

0 commit comments

Comments
 (0)