'Sends a request to trakt indicating that the given episode is part of our library.
ep_obj: The TVEpisode object to add to trakt'

def update_library(self, ep_obj):

    trakt_id = sickbeard.indexerApi(ep_obj.show.indexer).config[u'trakt_id']
    trakt_api = TraktAPI(sickbeard.SSL_VERIFY, sickbeard.TRAKT_TIMEOUT)
    if sickbeard.USE_TRAKT:
        try:
            data = {u'shows': [{u'title': ep_obj.show.name, u'year': ep_obj.show.startyear, u'ids': {}}]}
            if (trakt_id == u'tvdb_id'):
                data[u'shows'][0][u'ids'][u'tvdb'] = ep_obj.show.indexerid
            else:
                data[u'shows'][0][u'ids'][u'tvrage'] = ep_obj.show.indexerid
            if (sickbeard.TRAKT_SYNC_WATCHLIST and sickbeard.TRAKT_REMOVE_SERIESLIST):
                trakt_api.traktRequest(u'sync/watchlist/remove', data, method=u'POST')
            data[u'shows'][0][u'seasons'] = [{u'number': ep_obj.season, u'episodes': []}]
            for relEp_Obj in ([ep_obj] + ep_obj.relatedEps):
                data[u'shows'][0][u'seasons'][0][u'episodes'].append({u'number': relEp_Obj.episode})
            if (sickbeard.TRAKT_SYNC_WATCHLIST and sickbeard.TRAKT_REMOVE_WATCHLIST):
                trakt_api.traktRequest(u'sync/watchlist/remove', data, method=u'POST')
            trakt_api.traktRequest(u'sync/collection', data, method=u'POST')
        except (traktException, traktAuthException, traktServerBusy) as e:
            logger.log(u'Could    not    connect    to    Trakt    service:    {0}'.format(ex(e)), logger.WARNING)
