Skip to content

Commit

Permalink
reload after editing list
Browse files Browse the repository at this point in the history
  • Loading branch information
meisnate12 committed Apr 25, 2023
1 parent 821d772 commit e86ec09
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tmdbapis/objs/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,7 @@ def update(self, name: Optional[str] = None, description: Optional[str] = None,
public=public,
sort_by=sort_by
)
self.reload()

def _check_item(self, item):
if isinstance(item, Movie):
Expand Down Expand Up @@ -828,6 +829,7 @@ def add_items(self, items: List[Union[Movie, TVShow, Tuple[int, str]]]):
else:
for item_id in item_ids:
self._api.lists_add_movie(self.id, item_id["media_id"])
self.reload()

def remove_items(self, items: List[Union[Movie, TVShow, Tuple[int, str]]]):
""" Adds the items given to the list.
Expand All @@ -850,6 +852,7 @@ def remove_items(self, items: List[Union[Movie, TVShow, Tuple[int, str]]]):
else:
for item_id in item_ids:
self._api.lists_remove_movie(self.id, item_id["media_id"])
self.reload()

def update_items(self, items: List[Tuple[Union[Movie, TVShow, Tuple[int, str]], str]]):
""" Updates the items on the list.
Expand All @@ -868,13 +871,15 @@ def update_items(self, items: List[Tuple[Union[Movie, TVShow, Tuple[int, str]],
comment = item[1]
item_ids.append({"media_type": item_type, "media_id": item_id, "comment": comment})
self._tmdb._v4_check(write=True).list_update_items(self.id, item_ids)
self.reload()

def clear(self):
""" Clear all items from the list. """
if self._api4 and self._api4.has_write_token:
self._api4.list_clear_list(self.id)
else:
self._api.lists_clear_list(self.id, confirm=True)
self.reload()

def delete(self):
""" Delete the list. """
Expand Down

0 comments on commit e86ec09

Please sign in to comment.