Skip to content

Instantly share code, notes, and snippets.

@henryjfry
Created October 28, 2019 21:20
Show Gist options
  • Save henryjfry/0e9149b5b6714ce927bfac4972494bb8 to your computer and use it in GitHub Desktop.
Save henryjfry/0e9149b5b6714ce927bfac4972494bb8 to your computer and use it in GitHub Desktop.
/home/osmc/.kodi/addons/script.extendedinfo/resources/lib/VideoPlayer.py
def play(self, url, listitem, window=False):
super(VideoPlayer, self).play(item=url, listitem=listitem, windowed=False, startpos=-1)
for i in range(30):
if xbmc.getCondVisibility('VideoPlayer.IsFullscreen'):
if window and window.window_type == 'dialog':
wm.add_to_stack(window)
window.close()
self.wait_for_video_end()
return wm.pop_stack()
xbmc.sleep(1000)
def play_from_button(self, url, listitem, window=False, type='', dbid=0):
Utils.show_busy()
if dbid != 0:
item = '{"%s": %s}' % (type, dbid)
Utils.get_kodi_json(method='Player.Open', params='{"item": %s}' % item)
else:
item = '{"file": "%s"}' % url
xbmc.executebuiltin('RunPlugin(%s)' % url)
for i in range(90):
xbmc.log(str(xbmcgui.getCurrentWindowDialogId())+'===>OPENINFO', level=xbmc.LOGNOTICE)
if xbmcgui.getCurrentWindowDialogId() > 11999 and xbmcgui.getCurrentWindowDialogId() < 12999:
Utils.hide_busy()
if xbmc.getCondVisibility('VideoPlayer.IsFullscreen'):
if window and window.window_type == 'dialog':
wm.add_to_stack(window)
window.close()
self.wait_for_video_end()
return wm.pop_stack()
xbmc.sleep(1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment