Skip to content

Instantly share code, notes, and snippets.

@henryjfry
Last active January 19, 2020 12:05
Show Gist options
  • Save henryjfry/42779d05219f0452fe770f6cdaa001ca to your computer and use it in GitHub Desktop.
Save henryjfry/42779d05219f0452fe770f6cdaa001ca to your computer and use it in GitHub Desktop.
TMDB Helper - Play from TVDB_ID - ~/.kodi/addons/plugin.video.themoviedb.helper/resources/lib/container.py
def list_play(self):
# xbmc.log(str(tmdb_id)+'===>TMDB_HELPER_3', level=xbmc.LOGNOTICE)
tmdb_id = ''
if self.params.get('query') and self.params.get('type') == 'episode':
tmdb_id = self.tmdb.get_tmdb_id(itemtype='tv', query=self.params.get('query'))
if self.params.get('query') and self.params.get('type') == 'movie':
movie_title = self.params.get('query')
movie_year = self.params.get('year')
tmdb_id = self.tmdb.get_tmdb_id(itemtype='movie', query=self.params.get('query'))
if self.params.get('tvdb_id') and self.params.get('type') == 'episode':
tvdb_id = self.params.get('tvdb_id')
tmdb_id = self.tmdb.get_tmdb_id(itemtype='tv', tvdb_id=tvdb_id)
if tmdb_id <> '' and self.params.get('type') == 'episode':
pass
elif not self.params.get('type') or not self.params.get('tmdb_id'):
return
season, episode = self.params.get('season'), self.params.get('episode')
if self.params.get('tvdb_id') or self.params.get('query') and self.params.get('type') == 'episode':
command = 'RunScript(plugin.video.themoviedb.helper,play={0},tmdb_id={1}{{0}})'.format(self.params.get('type'), tmdb_id)
self.details_tv = self.tmdb.get_detailed_item('tv', tmdb_id, season=season, episode=episode)
else:
command = 'RunScript(plugin.video.themoviedb.helper,play={0},tmdb_id={1}{{0}})'.format(self.params.get('type'), self.params.get('tmdb_id'))
self.details_tv = self.tmdb.get_detailed_item('tv', self.params.get('tmdb_id'), season=season, episode=episode)
command = command.format(',season={0},episode={1}'.format(season, episode) if season and episode else '')
xbmc.executebuiltin(command)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment