예제 #1
0
 def req_loco_list_root(self):
     """Retrieve root LoCo list"""
     # It is used to following cases:
     # - To get items for the main menu
     #      (when 'loco_known'==True and loco_contexts is set, see MAIN_MENU_ITEMS in globals.py)
     # - To get list items for menus that have multiple contexts set to 'loco_contexts' like 'recommendations' menu
     LOG.debug('Requesting LoCo root lists')
     paths = (
         [
             ['loco', 'componentSummary'],
             ['loco', {
                 'from': 0,
                 'to': 50
             }, 'componentSummary'],
             # Titles of first 4 videos in each video list (needed only to show titles in the plot description)
             [
                 'loco', {
                     'from': 0,
                     'to': 50
                 }, {
                     'from': 0,
                     'to': 3
                 }, 'reference', ['title', 'summary']
             ]
         ] +
         # Art for the first video of each context list (needed only to add art to the menu item)
         build_paths(['loco', {
             'from': 0,
             'to': 50
         }, 0, 'reference'], ART_PARTIAL_PATHS))
     call_args = {'paths': paths}
     path_response = self.nfsession.path_request(**call_args)
     return LoCo(path_response)
 def req_loco_list_genre(self, genre_id):
     """Retrieve LoCo for the given genre"""
     LOG.debug('Requesting LoCo for genre {}', genre_id)
     paths = ([['genres', genre_id, 'name'],
               ['genres', genre_id, 'rw', 'componentSummary'],
               ['genres', genre_id, 'rw', {'from': 0, 'to': 48}, 'componentSummary'],
               # Titles of first 4 videos in each video list (needed only to show titles in the plot description)
               ['genres', genre_id, 'rw',
                {'from': 0, 'to': 48}, {'from': 0, 'to': 3}, 'reference', ['title', 'summary']]] +
              # Art for the first video of each context list (needed only to add art to the menu item)
              build_paths(['genres', genre_id, 'rw', {'from': 0, 'to': 48}, 0, 'reference'], ART_PARTIAL_PATHS) +
              # IDs and names of sub-genres
              [['genres', genre_id, 'subgenres', {'from': 0, 'to': 30}, ['id', 'name']]])
     call_args = {'paths': paths}
     path_response = self.nfsession.path_request(**call_args)
     return LoCo(path_response)
 def req_loco_list_genre(self, genre_id):
     """Retrieve LoCo for the given genre"""
     LOG.debug('Requesting LoCo for genre {}', genre_id)
     # Todo: 20/06/2020 Currently make requests for genres raise this exception from netflix server
     #       (errors visible only with jsonGraph enabled on path request):
     # Msg: No signature of method: api.Lolomo.getLolomoRequest() is applicable for argument types:
     #      (java.util.ArrayList, null, java.lang.Boolean) values: [[jaw, jawEpisode, jawTrailer], null, false]
     # ErrCause: groovy.lang.MissingMethodException: No signature of method: api.Lolomo.getLolomoRequest()
     #           is applicable for argument types: (java.util.ArrayList, null, java.lang.Boolean)
     #           values: [[jaw, jawEpisode, jawTrailer], null, false]
     # For reference the PR to restore the functionality: https://github.com/CastagnaIT/plugin.video.netflix/pull/685
     paths = (
         [['genres', genre_id, 'name'] +
          ['genres', genre_id, 'rw', 'componentSummary'] +
          # Titles of first 4 videos in each video list (needed only to show titles in the plot description)
          [
              'genres', genre_id, 'rw', {
                  'from': 0,
                  'to': 48
              }, {
                  'from': 0,
                  'to': 3
              }, 'reference', ['title', 'summary']
          ]] +
         # Art for the first video of each context list (needed only to add art to the menu item)
         build_paths([
             'genres', genre_id, 'rw', {
                 'from': 0,
                 'to': 48
             }, 0, 'reference'
         ], ART_PARTIAL_PATHS) +
         # IDs and names of sub-genres
         [[
             'genres', 34399, 'subgenres', {
                 'from': 0,
                 'to': 30
             }, ['id', 'name']
         ]])
     call_args = {'paths': paths}
     path_response = self.nfsession.path_request(**call_args)
     return LoCo(path_response)