예제 #1
0
    def construct(cls, client, media, item, keys=None, **kwargs):
        if keys is None:
            _, keys = cls.get_ids(media, item)

        if media == 'movie':
            return Movie._construct(client, keys, item, **kwargs)

        if media == 'show':
            return Show._construct(client, keys, item, **kwargs)

        if media == 'season':
            return Season._construct(client, keys, item, **kwargs)

        if media == 'episode':
            return Episode._construct(client, keys, item, **kwargs)

        if media == 'comment':
            return Comment._construct(client, keys, item, **kwargs)

        if media == 'custom_list':
            return CustomList._construct(client, keys, item, **kwargs)

        if media == 'person':
            return Person._construct(client, keys, item, **kwargs)

        if media == 'watched_progress':
            return WatchedProgress._construct(client, item, **kwargs)

        if media == 'collection_progress':
            return CollectionProgress._construct(client, item, **kwargs)

        raise ValueError('Unknown media type provided')
예제 #2
0
파일: base.py 프로젝트: TWaalen/trakt.py
    def construct(cls, client, media, item, keys=None, **kwargs):
        if keys is None:
            _, keys = cls.get_ids(media, item)

        if media == 'movie':
            return Movie._construct(client, keys, item, **kwargs)

        if media == 'show':
            return Show._construct(client, keys, item, **kwargs)

        if media == 'season':
            return Season._construct(client, keys, item, **kwargs)

        if media == 'episode':
            return Episode._construct(client, keys, item, **kwargs)

        if media == 'person':
            return Person._construct(client, keys, item, **kwargs)

        if media == 'comment':
            return Comment._construct(client, keys, item, **kwargs)

        if media == 'custom_list':
            return CustomList._construct(client, keys, item, **kwargs)

        raise ValueError('Unknown media type provided')
예제 #3
0
    def create(cls, media, item, keys=None, **kwargs):
        if keys is None:
            pk, keys = cls.get_ids(media, item)
        else:
            pk = keys[0]

        if media == 'show':
            return Show.create(keys, item, **kwargs)

        if media == 'movie':
            return Movie.create(keys, item, **kwargs)

        if media == 'episode':
            return Episode.create(pk, **kwargs)

        raise ValueError('Unknown media type provided')
예제 #4
0
    def create(cls, media, item, keys=None, **kwargs):
        if keys is None:
            pk, keys = cls.get_keys(media, item)
        else:
            pk = keys[0]

        if media == 'shows':
            return Show.create(keys, item, **kwargs)

        if media == 'movies':
            return Movie.create(keys, item, **kwargs)

        if media == 'episodes':
            return Episode.create(pk, **kwargs)

        raise ValueError('Unknown media type provided')
예제 #5
0
    def create(cls, media, item, keys=None, **kwargs):
        if keys is None:
            _, keys = cls.get_ids(media, item)

        if media == 'movie':
            return Movie.create(keys, item, **kwargs)

        if media == 'show':
            return Show.create(keys, item, **kwargs)

        if media == 'season':
            return Season.create(keys, item, **kwargs)

        if media == 'episode':
            return Episode.create(keys, item, **kwargs)

        raise ValueError('Unknown media type provided')
예제 #6
0
    def construct(cls, client, media, item, keys=None, **kwargs):
        if keys is None:
            _, keys = cls.get_ids(media, item)

        if media == 'movie':
            return Movie._construct(client, keys, item, **kwargs)

        if media == 'show':
            return Show._construct(client, keys, item, **kwargs)

        if media == 'season':
            return Season._construct(client, keys, item, **kwargs)

        if media == 'episode':
            return Episode._construct(client, keys, item, **kwargs)

        if media == 'custom_list':
            return CustomList._construct(client, keys, item, **kwargs)

        raise ValueError('Unknown media type provided')