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 InvalidVideoId('Cannot request video list supplemental for {}'.format(videoid))
     LOG.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.nfsession.path_request(path)
     return VideoListSorted(path_response, 'videos', videoid.value, supplemental_type)
 def req_seasons(self, videoid, perpetual_range_start):
     """Retrieve the seasons of a tv show"""
     if videoid.mediatype != common.VideoId.SHOW:
         raise InvalidVideoId('Cannot request season list for {}'.format(videoid))
     LOG.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.nfsession.perpetual_path_request(**call_args)
     return SeasonList(videoid, path_response)
def is_videoid_in_db(videoid):
    """Return True if the video is in the database, 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 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 InvalidVideoId('Cannot request episode list for {}'.format(videoid))
     LOG.debug('Requesting episode list for {}', videoid)
     paths = ([['seasons', videoid.seasonid, 'summary']] +
              build_paths(['seasons', videoid.seasonid, 'episodes', RANGE_PLACEHOLDER], 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.nfsession.perpetual_path_request(**call_args)
     return EpisodeList(videoid, path_response)