Skip to content

Instantly share code, notes, and snippets.

@henryjfry
Last active February 17, 2020 09:25
Show Gist options
  • Save henryjfry/16337665766cd7897c7ab26744766540 to your computer and use it in GitHub Desktop.
Save henryjfry/16337665766cd7897c7ab26744766540 to your computer and use it in GitHub Desktop.
TMDB => Container Alternate routes /home/osmc/.kodi/addons/plugin.video.themoviedb.helper/resources/lib/container.py
###/home/osmc/.kodi/addons/plugin.video.themoviedb.helper/resources/lib/player.py
# return self.play_external(force_dialog=True) # Ask user to select a different player
###/home/osmc/.kodi/addons/plugin.video.themoviedb.helper/resources/lib/container.py
elif self.params.get('info') == 'trakt_collection2':
items = TraktAPI(tmdb='tv', login=True).get_collection2('tv', utils.try_parse_int(self.params.get('page', 1)))
if self.params.get('info') == 'strm_pl':
# xbmc.log(str(xbmc.getInfoLabel('System.CurrentControl')) + 'CONTROL===>OPENINFO', level=xbmc.LOGNOTICE)
# xbmc.executebuiltin('ActivateWindow(busydialognocancel)')
from resources.lib.player import Player
params = self.params
if self.params.get('type') == 'episode':
params = self.params.copy()
params['type'] = 'tv'
# self.params['tmdb_id'] = self.get_tmdb_id(**params)
# tmdb_id_no = self.params['tmdb_id']
tmdb_id_no = self.get_tmdb_id(**params)
if xbmcgui.getCurrentWindowDialogId() <> 10138 or 'Play with ' in xbmc.getInfoLabel('System.CurrentControl') or 'Search ' in xbmc.getInfoLabel('System.CurrentControl'):
xbmcplugin.setResolvedUrl(self.handle, True, xbmcgui.ListItem(path=str()))
xbmc.executebuiltin('Playlist.Clear')
# xbmc.executebuiltin('Dialog.Close(busydialognocancel)')
# exit()
# xbmc.sleep(10000)
return
xbmc.log(str(xbmcgui.getCurrentWindowDialogId()) + '===>OPENINFO', level=xbmc.LOGNOTICE)
xbmc.log(str(str(xbmcgui.Window(xbmcgui.getCurrentWindowDialogId()).getProperty('label'))) + '===>OPENINFO', level=xbmc.LOGNOTICE)
xbmc.log(str(tmdb_id_no) + '===>OPENMETA1', level=xbmc.LOGNOTICE)
xbmc.log(str(self.params.get('type')) + '===>OPENMETA1', level=xbmc.LOGNOTICE)
xbmcplugin.setResolvedUrl(self.handle, True, xbmcgui.ListItem(path=str()))
import xbmcaddon
AddonName = xbmc.getInfoLabel('Container.PluginName')
AddonName = xbmcaddon.Addon(AddonName).getAddonInfo('name')
xbmc.log(str(AddonName) + 'AddonName===>OPENINFO', level=xbmc.LOGNOTICE)
if self.params.get('type') == 'movie':
Player().play(itemtype='movie', tmdb_id=tmdb_id_no)
else:
Player().play(itemtype='episode', tmdb_id=tmdb_id_no, season=self.params.get('season'), episode=self.params.get('episode'))
# while xbmcgui.getCurrentWindowDialogId() == 10138 or 'Play with ' in xbmc.getInfoLabel('System.CurrentControl') or 'Search ' in xbmc.getInfoLabel('System.CurrentControl'):
# xbmc.sleep(10000)
while not xbmc.getCondVisibility('Player.HasVideo'):
xbmc.sleep(10000)
if xbmc.getCondVisibility('Player.HasVideo'):
exit()
return
if self.params.get('info') == 'play3':
from resources.lib.player import Player
xbmcplugin.setResolvedUrl(self.handle, True, xbmcgui.ListItem(path=str()))
xbmcplugin.endOfDirectory(self.handle)
# import xbmcaddon
# AddonName = xbmc.getInfoLabel('Container.PluginName')
# AddonName = xbmcaddon.Addon(AddonName).getAddonInfo('name')
# xbmc.log(str(AddonName) + '===AddonName===>play3', level=xbmc.LOGNOTICE)
if xbmcgui.getCurrentWindowDialogId() <> 10138 or 'Play with ' in xbmc.getInfoLabel('System.CurrentControl') or 'Search ' in xbmc.getInfoLabel('System.CurrentControl'):
exit()
params = self.params
if self.params.get('type') == 'episode':
params = self.params.copy()
params['type'] = 'tv'
tmdb_id_no = self.get_tmdb_id(**params)
xbmc.log(str(xbmcgui.getCurrentWindowDialogId()) + 'play3===>TMDB', level=xbmc.LOGNOTICE)
if self.params.get('type') == 'movie':
Player().play(itemtype='movie', tmdb_id=tmdb_id_no)
else:
Player().play(itemtype='episode', tmdb_id=tmdb_id_no, season=self.params.get('season'), episode=self.params.get('episode'))
xbmc.sleep(30000)
while not xbmc.getCondVisibility('Player.HasVideo'):
xbmc.sleep(30000)
if xbmc.getCondVisibility('Player.HasVideo') or xbmcgui.getCurrentWindowDialogId() <> 10138 or 'Play with ' in xbmc.getInfoLabel('System.CurrentControl') or 'Search ' in xbmc.getInfoLabel('System.CurrentControl'):
exit()
if self.params.get('info') == 'play2':
xbmcplugin.setResolvedUrl(self.handle, True, xbmcgui.ListItem(path=str()))
if xbmcgui.getCurrentWindowDialogId() <> 10138 or 'Play with ' in xbmc.getInfoLabel('System.CurrentControl') or 'Search ' in xbmc.getInfoLabel('System.CurrentControl'):
exit()
self.list_getid()
self.list_play()
xbmc.sleep(30000)
while not xbmc.getCondVisibility('Player.HasVideo'):
xbmc.sleep(30000)
if xbmc.getCondVisibility('Player.HasVideo'):
exit()
if self.params.get('info') == 'stream':
from resources.lib.player import Player
xbmcplugin.setResolvedUrl(self.handle, True, xbmcgui.ListItem(path=str()))
params = self.params.copy()
Player().play(itemtype='episode', tmdb_id=self.params.get('tmdb_id'), season=self.params.get('season'), episode=self.params.get('episode'))
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment