コード例 #1
0
def get_trakt_movies(user_name, list_name, token):
    trakt.core.AUTH_METHOD = trakt.core.OAUTH_AUTH
    trakt.core.OAUTH_TOKEN = token
    trakt.core.CLIENT_ID = trakt_client_id
    trakt.core.CLIENT_SECRET = trakt_client_secret
    target_list = list()
    if list_name.lower() == "watchlist":
        target_list = users.User(user_name).watchlist_movies
    else:
        target_list = users.User(user_name).get_list(list_name).get_items()
    found_ids = list()
    for item in target_list:
        imdb_id = item.ids["ids"]["imdb"]
        if not imdb_id in found_ids:
            found_ids.append(imdb_id)
            debuglog(_getstr(30012) + (str(item)) + _getstr(30015) + list_name)
    return found_ids
コード例 #2
0
def get_trakt_user():
    """Get PyTrakt user object."""
    try:
        user = users.get_user_settings()
        username = user['user']['username']
        return users.User(username)
    except TraktException as error:
        log.warning('Unable to get trakt user, error: {error}', {'error': error})
        raise
コード例 #3
0
from Objects import mySeason
from extract_existing_files import scanPresentFiles, slugifyFolders
import ConfigParser
from time import sleep

#------------------------------------ Init -------------------------------------
config = ConfigParser.ConfigParser()
# reading config file
config.read('config.ini')
today = DT.now()
trakt.AUTH_METHOD = trakt.OAUTH_AUTH
init(config.get("trakt", "user"), config.get("trakt", "app_id"),
     config.get("trakt", "app_secret"))

tmdb.API_KEY = config.get("tmdb", "api_key")
myuser = users.User(config.get("tmdb", "user"))
BASE_URL = config.get("main", "path")

#---------------------------------------------------------------------------------
#slugify folders for more robust
slugifyFolders(BASE_URL)
print "Finished slugifying folders"


def getWatchedEpisodes(myshow):
    """
    getting watched episodes from trakt API
    :param myshow: which show
    :return: OrderedDict of watched episodes and seasons
    """
    watched = OrderedDict()