Example #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')
Example #2
0
    def show_season(show, pk, item=None, **kwargs):
        if pk not in show.seasons:
            show.seasons[pk] = Season.create(pk, item, **kwargs)
        else:
            show.seasons[pk].update(item, **kwargs)

        return show.seasons[pk]
Example #3
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 == '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')
Example #4
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')
Example #5
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')