diff --git a/trakt/movies.py b/trakt/movies.py index fd5f15cf..a4b4b60d 100644 --- a/trakt/movies.py +++ b/trakt/movies.py @@ -2,8 +2,8 @@ """Interfaces to all of the Movie objects offered by the Trakt.tv API""" from collections import namedtuple from trakt.core import Alias, Comment, Genre, get, delete -from trakt.sync import (Scrobbler, comment, rate, add_to_history, - remove_from_history, add_to_watchlist, +from trakt.sync import (Scrobbler, comment, rate, remove_rating, + add_to_history, remove_from_history, add_to_watchlist, remove_from_watchlist, add_to_collection, remove_from_collection, search, checkin_media, delete_checkin) @@ -320,6 +320,13 @@ def rate(self, rating): """ rate(self, rating) + def remove_rating(self): + """Remove rating for this :class:`Movie` on trakt. Depending on the + current users settings, this may also send out social updates to + facebook, twitter, tumblr, and path. + """ + remove_rating(self) + def remove_from_library(self): """Remove this :class:`Movie` from your library.""" remove_from_collection(self) diff --git a/trakt/sync.py b/trakt/sync.py index c4bf7cfe..d80d415a 100644 --- a/trakt/sync.py +++ b/trakt/sync.py @@ -7,11 +7,11 @@ __author__ = 'Jon Nappi' -__all__ = ['Scrobbler', 'comment', 'rate', 'add_to_history', 'get_collection', - 'get_watchlist', 'add_to_watchlist', 'remove_from_history', - 'remove_from_watchlist', 'add_to_collection', - 'remove_from_collection', 'search', 'search_by_id', 'checkin_media', - 'delete_checkin'] +__all__ = ['Scrobbler', 'comment', 'rate', 'remove_rating', + 'add_to_history', 'get_collection', 'get_watchlist', + 'add_to_watchlist', 'remove_from_history', 'remove_from_watchlist', + 'add_to_collection', 'remove_from_collection', 'search', + 'search_by_id', 'checkin_media', 'delete_checkin'] @post @@ -55,6 +55,18 @@ def rate(media, rating, rated_at=None): yield result +@post +def remove_rating(media): + """Remove rating from :class:`Movie`, :class:`TVShow`, or + :class:`TVEpisode`. + + :param media: The media object to remove rating from""" + data = dict() + data.update(media.ids) + result = yield 'sync/ratings/remove', {media.media_type: [data]} + yield result + + @post def add_to_history(media, watched_at=None): """Add a :class:`Movie`, :class:`TVShow`, or :class:`TVEpisode` to your diff --git a/trakt/tv.py b/trakt/tv.py index 9c60d9f1..15c754d6 100644 --- a/trakt/tv.py +++ b/trakt/tv.py @@ -4,10 +4,11 @@ from datetime import datetime, timedelta from trakt.core import Airs, Alias, Comment, Genre, delete, get from trakt.errors import NotFoundException -from trakt.sync import (Scrobbler, rate, comment, add_to_collection, - add_to_watchlist, add_to_history, remove_from_history, - remove_from_collection, remove_from_watchlist, search, - checkin_media, delete_checkin) +from trakt.sync import (Scrobbler, rate, remove_rating, comment, + add_to_collection, add_to_watchlist, add_to_history, + remove_from_history, remove_from_collection, + remove_from_watchlist, search, checkin_media, + delete_checkin) from trakt.utils import slugify, extract_ids, airs_date from trakt.people import Person @@ -473,6 +474,13 @@ def rate(self, rating): """ return rate(self, rating) + def remove_rating(self): + """Remove rating for this :class:`TVShow` on trakt. Depending on the + current users settings, this may also send out social updates to + facebook, twitter, tumblr, and path. + """ + return remove_rating(self) + def remove_from_library(self): """Remove this :class:`TVShow` from your library.""" return remove_from_collection(self) @@ -800,6 +808,13 @@ def rate(self, rating): """ rate(self, rating) + def remove_rating(self): + """Remove rating for this :class:`TVEpisode` on trakt. Depending on the + current users settings, this may also send out social updates to + facebook, twitter, tumblr, and path. + """ + remove_rating(self) + def add_to_library(self): """Add this :class:`TVEpisode` to your Trakt.tv library""" add_to_collection(self)