Exemplo n.º 1
0
 def build_movie(cls, ws):
     return {
         'movie': ActionHelper.set_identifier({
             'title': ws.title,
             'year': ws.metadata.year,
         }, ws.guid, strict=False)
     }
    def from_movie(cls, movie, guid):
        # Set identifier
        movie = ActionHelper.set_identifier({}, guid)

        if not movie:
            # Couldn't find a valid identifier
            return None

        return {
            'movies': [movie]
        }
Exemplo n.º 3
0
    def build_show(cls, ws):
        season, episodes = ws.identifier

        if ws.cur_episode >= len(episodes):
            log.warn('Unable to find episode at index %s, available episodes: %s', ws.cur_episode, episodes)
            return None

        return {
            'show': ActionHelper.set_identifier({
                'title': ws.title,
                'year': ws.metadata.year
            }, ws.guid, strict=False),
            'episode': {
                'title': ws.metadata.title,

                'season': season,
                'number': episodes[ws.cur_episode]
            }
        }
    def from_episode(cls, episode, guid):
        # Build request
        show = {
            'seasons': [
                {
                    'number': episode.season.index,
                    'episodes': ActionHelper.trakt.episodes([episode])
                }
            ]
        }

        # Set identifier
        show = ActionHelper.set_identifier(show, guid)

        if not show:
            # Couldn't find a valid identifier
            return None

        return {
            'shows': [show]
        }