comments
This commit is contained in:
parent
1af7508eb8
commit
53614c7b78
28
addon.py
28
addon.py
@ -115,32 +115,50 @@ def get_feature(movieid):
|
||||
|
||||
# entry point
|
||||
if __name__ == '__main__':
|
||||
movieid = xbmc.getInfoLabel('ListItem.DBID').decode('utf-8')
|
||||
cinematic_path = ADDON.getSettingString('cinematic_path')
|
||||
# collect info about the selected feature movie
|
||||
movieid = xbmc.getInfoLabel('ListItem.DBID').decode('utf-8')
|
||||
feature = get_feature(movieid)
|
||||
print(feature)
|
||||
|
||||
# let user select one of the JSON programs
|
||||
programs = list_programs(cinematic_path)
|
||||
program_file = cinematic_path + show_dialog(programs)
|
||||
program = conduct_program(program_file, feature)
|
||||
|
||||
# conduct and show playlist
|
||||
program = conduct_program(program_file, feature)
|
||||
print('=== playlist')
|
||||
for entry in program:
|
||||
print(" * [%s] -- %s" % (entry['type'], entry['data']))
|
||||
|
||||
# close modal movie information window
|
||||
if xbmc.getCondVisibility('Window.IsVisible(MovieInformation)'):
|
||||
xbmc.executebuiltin('Dialog.Close(MovieInformation)')
|
||||
|
||||
print('=== playing')
|
||||
"""
|
||||
TODO: this is not the intended way of playing back the conducted playlist.
|
||||
hints for a better implementation are welcome.
|
||||
the plan is to play each video file in the list separately, so the addon is
|
||||
able to perform further tasks in between, like controlling home automation
|
||||
systems. unfortunately, research has to be done in order to find out how
|
||||
that should be implemented.
|
||||
"""
|
||||
|
||||
# build kodi style playlist
|
||||
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
|
||||
playlist.clear()
|
||||
for entry in program:
|
||||
print(" * [%s] -- %s" % (entry['type'], entry['data']))
|
||||
if entry['type'] == 'video':
|
||||
playlist.add(entry['data'])
|
||||
else:
|
||||
# it is planned to implement features other than video playback
|
||||
# e. g. call scripts in home automation to dim the lights
|
||||
print(" unable to handle %s yet" % entry['type'])
|
||||
|
||||
# start playback
|
||||
xbmc.Player().play(playlist)
|
||||
xbmc.sleep(500)
|
||||
|
||||
# wait until program is finished
|
||||
while xbmc.getCondVisibility('Player.HasMedia'):
|
||||
xbmc.sleep(100)
|
||||
print('=== done playing')
|
||||
|
Loading…
Reference in New Issue
Block a user