Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions trakt/movies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
22 changes: 17 additions & 5 deletions trakt/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
23 changes: 19 additions & 4 deletions trakt/tv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down