Example #1
0
def event_info(videoid):
    """Retrieve info for the events"""
    if videoid.mediatype not in [common.VideoId.EPISODE, common.VideoId.MOVIE,
                                 common.VideoId.SUPPLEMENTAL]:
        raise common.InvalidVideoId('Cannot request event info for {}'
                                    .format(videoid))
    common.debug('Requesting event info for {}', videoid)
    paths = build_paths(['videos', videoid.value], EVENT_PATHS)
    return common.make_call('path_request', paths)
 def req_video_list_supplemental(self, videoid, supplemental_type):
     """Retrieve a video list of supplemental type videos"""
     if videoid.mediatype != common.VideoId.SHOW and videoid.mediatype != common.VideoId.MOVIE:
         raise common.InvalidVideoId('Cannot request video list supplemental for {}'.format(videoid))
     common.debug('Requesting video list supplemental of type "{}" for {}', supplemental_type, videoid)
     path = build_paths(
         ['videos', videoid.value, supplemental_type, {"from": 0, "to": 35}], TRAILER_PARTIAL_PATHS
     )
     path_response = self.netflix_session._path_request(path)
     return VideoListSorted(path_response, 'videos', videoid.value, supplemental_type)
Example #3
0
def supplemental_video_list(videoid, supplemental_type):
    """Retrieve a supplemental video list"""
    if videoid.mediatype != common.VideoId.SHOW and videoid.mediatype != common.VideoId.MOVIE:
        raise common.InvalidVideoId('Cannot request supplemental list for {}'
                                    .format(videoid))
    common.debug('Requesting supplemental ({}) list for {}', supplemental_type, videoid)
    callargs = build_paths(
        ['videos', videoid.value, supplemental_type,
         {"from": 0, "to": 35}], TRAILER_PARTIAL_PATHS)
    return VideoListSorted(common.make_call('path_request', callargs),
                           'videos', videoid.value, supplemental_type)
Example #4
0
def single_info(videoid):
    """Retrieve info for a single episode"""
    if videoid.mediatype not in [common.VideoId.EPISODE, common.VideoId.MOVIE]:
        raise common.InvalidVideoId(
            'Cannot request info for {}'.format(videoid))
    common.debug('Requesting info for {}'.format(videoid))
    paths = build_paths(['videos', videoid.value], EPISODES_PARTIAL_PATHS)
    if videoid.mediatype == common.VideoId.EPISODE:
        paths.extend(
            build_paths(['videos', videoid.tvshowid],
                        ART_PARTIAL_PATHS + [['title']]))
    return common.make_call('path_request', paths)
 def req_seasons(self, videoid, perpetual_range_start):
     """Retrieve the seasons of a tv show"""
     if videoid.mediatype != common.VideoId.SHOW:
         raise common.InvalidVideoId('Cannot request season list for {}'.format(videoid))
     common.debug('Requesting the seasons list for show {}', videoid)
     call_args = {
         'paths': build_paths(['videos', videoid.tvshowid], SEASONS_PARTIAL_PATHS),
         'length_params': ['stdlist_wid', ['videos', videoid.tvshowid, 'seasonList']],
         'perpetual_range_start': perpetual_range_start
     }
     path_response = self.netflix_session._perpetual_path_request(**call_args)
     return SeasonList(videoid, path_response)
Example #6
0
def seasons(videoid):
    """Retrieve seasons of a TV show"""
    if videoid.mediatype != common.VideoId.SHOW:
        raise common.InvalidVideoId('Cannot request season list for {}'
                                    .format(videoid))
    common.debug('Requesting season list for show {}', videoid)
    paths = build_paths(['videos', videoid.tvshowid], SEASONS_PARTIAL_PATHS)
    callargs = {
        'paths': paths,
        'length_params': ['stdlist_wid', ['videos', videoid.tvshowid, 'seasonList']]
    }
    return SeasonList(videoid, common.make_call('perpetual_path_request', callargs))
Example #7
0
def is_in_library(videoid):
    """Return True if the video is in the local Kodi library, else False"""
    if videoid.mediatype == common.VideoId.MOVIE:
        return g.SHARED_DB.movie_id_exists(videoid.value)
    if videoid.mediatype == common.VideoId.SHOW:
        return g.SHARED_DB.tvshow_id_exists(videoid.value)
    if videoid.mediatype == common.VideoId.SEASON:
        return g.SHARED_DB.season_id_exists(videoid.tvshowid, videoid.seasonid)
    if videoid.mediatype == common.VideoId.EPISODE:
        return g.SHARED_DB.episode_id_exists(videoid.tvshowid,
                                             videoid.seasonid,
                                             videoid.episodeid)
    raise common.InvalidVideoId(
        'videoid {} type not implemented'.format(videoid))
 def req_episodes(self, videoid, perpetual_range_start=None):
     """Retrieve the episodes of a season"""
     if videoid.mediatype != common.VideoId.SEASON:
         raise common.InvalidVideoId('Cannot request episode list for {}'.format(videoid))
     common.debug('Requesting episode list for {}', videoid)
     paths = ([['seasons', videoid.seasonid, 'summary']] +
              build_paths(['seasons', videoid.seasonid, 'episodes', RANGE_SELECTOR], EPISODES_PARTIAL_PATHS) +
              build_paths(['videos', videoid.tvshowid], ART_PARTIAL_PATHS + [['title']]))
     call_args = {
         'paths': paths,
         'length_params': ['stdlist_wid', ['seasons', videoid.seasonid, 'episodes']],
         'perpetual_range_start': perpetual_range_start
     }
     path_response = self.netflix_session._perpetual_path_request(**call_args)
     return EpisodeList(videoid, path_response)
Example #9
0
def episodes(videoid, videoid_value, perpetual_range_start=None):  # pylint: disable=unused-argument
    """Retrieve episodes of a season"""
    if videoid.mediatype != common.VideoId.SEASON:
        raise common.InvalidVideoId('Cannot request episode list for {}'
                                    .format(videoid))
    common.debug('Requesting episode list for {}', videoid)
    paths = [['seasons', videoid.seasonid, 'summary']]
    paths.extend(build_paths(['seasons', videoid.seasonid, 'episodes', RANGE_SELECTOR],
                             EPISODES_PARTIAL_PATHS))
    paths.extend(build_paths(['videos', videoid.tvshowid],
                             ART_PARTIAL_PATHS + [['title']]))
    callargs = {
        'paths': paths,
        'length_params': ['stdlist_wid', ['seasons', videoid.seasonid, 'episodes']],
        'perpetual_range_start': perpetual_range_start
    }
    return EpisodeList(videoid, common.make_call('perpetual_path_request', callargs))
Example #10
0
def seasons(videoid):
    """Retrieve seasons of a TV show"""
    if videoid.mediatype != common.VideoId.SHOW:
        raise common.InvalidVideoId(
            'Cannot request season list for {}'.format(videoid))
    common.debug('Requesting season list for show {}'.format(videoid))
    return SeasonList(
        videoid,
        common.make_call(
            'perpetual_path_request', {
                'path_type':
                'seasonlist',
                'paths':
                build_paths(['videos', videoid.tvshowid],
                            SEASONS_PARTIAL_PATHS),
                'length_params1':
                videoid.tvshowid
            }))
Example #11
0
def episodes(videoid):
    """Retrieve episodes of a season"""
    if videoid.mediatype != common.VideoId.SEASON:
        raise common.InvalidVideoId(
            'Cannot request episode list for {}'.format(videoid))
    common.debug('Requesting episode list for {}'.format(videoid))
    return EpisodeList(
        videoid,
        common.make_call(
            'perpetual_path_request', {
                'path_type':
                'episodelist',
                'length_params': [videoid.seasonid],
                'paths':
                [['seasons', videoid.seasonid, 'summary']] + build_paths(
                    ['seasons', videoid.seasonid, 'episodes', RANGE_SELECTOR],
                    EPISODES_PARTIAL_PATHS) +
                build_paths(['videos', videoid.tvshowid],
                            ART_PARTIAL_PATHS + [['title']])
            }))