def _get_one_item_details_from_database(self, id): response = helper.execute_json_rpc( '{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovieDetails", "params": {"properties": [%s], "movieid":%s }, "id": 1}' % (self._get_item_details_fields(), id) ) details = response.get("result", {}).get("moviedetails", None) if details: details["id"] = details["movieid"] return details
def __fetch_all_items_from_directory_source(self, directory): result = [] response = helper.execute_json_rpc('{"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory": "%s", "media": "%s", "properties": [%s]}, "id": 1}' %(directory, self.mediaType, self._get_item_details_fields())) files = response.get( "result", {} ).get( "files" ) if files: for _file in files: if xbmc.abortRequested: break if _file['filetype'] == 'directory': directoryFiles = self.__fetch_all_items_from_directory_source(_file['file']) for directoryFile in directoryFiles: id = directoryFile.get('id', -1) if id != -1 and id not in [file['id'] for file in result]: result.append(directoryFile) else: id = _file.get('id', -1) if id != -1 and id not in [file['id'] for file in result]: result.append(_file) return result
def _get_one_item_details_from_database(self, id): response = helper.execute_json_rpc('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMusicVideoDetails", "params": {"properties": [%s], "musicvideoid":%s }, "id": 1}' %(self._get_item_details_fields(), id)) details = response.get( 'result', {} ).get( 'musicvideodetails', None ) if details: details['id'] = details['musicvideoid'] return details