get feature information

This commit is contained in:
Ronald Schaten 2021-03-15 21:02:42 +01:00
parent 513d1e75b4
commit dc7e39b7b4

View File

@ -42,7 +42,7 @@ def trailers_from_net(count, genre, rating):
files.append("TODO: find trailer %d" % i) files.append("TODO: find trailer %d" % i)
return files return files
def conduct_program(program_file): def conduct_program(program_file, feature):
filehandle = xbmcvfs.File(program_file) filehandle = xbmcvfs.File(program_file)
program_json = filehandle.read() program_json = filehandle.read()
filehandle.close() filehandle.close()
@ -64,20 +64,34 @@ def conduct_program(program_file):
entry = {'type': 'video', 'data': location} entry = {'type': 'video', 'data': location}
program.append(entry) program.append(entry)
elif settings['source'] == 'feature': elif settings['source'] == 'feature':
entry = {'type': 'video', 'data': ("TODO: find feature %d" % dbid)} entry = {'type': 'video', 'data': feature['file']}
program.append(entry) program.append(entry)
return program return program
def get_feature(movieid):
query = '{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovieDetails", "params": {"movieid": %s, "properties": ["file", "mpaa", "genre"]}, "id": "1"}' % movieid
json_response = xbmc.executeJSONRPC(query)
response = json.loads(json_response)
feature = {
'label': response['result']['moviedetails']['label'],
'file': response['result']['moviedetails']['file'],
'mpaa': response['result']['moviedetails']['mpaa'],
'genre': response['result']['moviedetails']['genre']
}
return feature
if __name__ == '__main__': if __name__ == '__main__':
for arg in sys.argv[1:]: for arg in sys.argv[1:]:
(name, value) = arg.split('=') (name, value) = arg.split('=')
if name == 'dbid': if name == 'dbid':
dbid = int(value) movieid = int(value)
cinematic_path = ADDON.getSettingString('cinematic_path') cinematic_path = ADDON.getSettingString('cinematic_path')
feature = get_feature(movieid)
print(feature)
programs = list_programs(cinematic_path) programs = list_programs(cinematic_path)
program_file = cinematic_path + show_dialog(programs) program_file = cinematic_path + show_dialog(programs)
program = conduct_program(program_file) program = conduct_program(program_file, feature)
print('=== playlist') print('=== playlist')
for entry in program: for entry in program: