Skip to content

Instantly share code, notes, and snippets.

@henryjfry
Created October 28, 2019 21:23
Show Gist options
  • Select an option

  • Save henryjfry/44b861ad5cb08aac61cb1904cd29c785 to your computer and use it in GitHub Desktop.

Select an option

Save henryjfry/44b861ad5cb08aac61cb1904cd29c785 to your computer and use it in GitHub Desktop.
/home/osmc/.kodi/addons/script.extendedinfo/resources/lib/DialogVideoList.py
@ch.action('contextmenu', 500)
def context_menu(self):
Utils.show_busy()
if self.listitem.getProperty('dbid') and self.listitem.getProperty('dbid') != 0:
dbid = self.listitem.getProperty('dbid')
else:
dbid = 0
item_id = self.listitem.getProperty('id')
if self.type == 'tv':
imdb_id = Utils.fetch(TheMovieDB.get_tvshow_ids(item_id), 'imdb_id')
tvdb_id = Utils.fetch(TheMovieDB.get_tvshow_ids(item_id), 'tvdb_id')
else:
imdb_id = TheMovieDB.get_imdb_id_from_movie_id(item_id)
if self.listitem.getProperty('TVShowTitle'):
listitems = ['Play first episode']
else:
listitems = ['Play']
if self.listitem.getProperty('dbid'):
listitems += ['Remove from library']
else:
listitems += ['Add to library']
listitems += ['Trailer']
selection = xbmcgui.Dialog().select(heading='Choose option', list=listitems)
if selection == 0:
if self.listitem.getProperty('TVShowTitle'):
url = 'plugin://plugin.video.openmeta/tv/play/%s/1/1' % tvdb_id
PLAYER.play_from_button(url, listitem=None, window=self, dbid=0)
else:
# window_id = xbmcgui.getCurrentWindowDialogId()
# xbmc.log(str(window_id)+'===>OPENINFO', level=xbmc.LOGNOTICE)
url = 'plugin://plugin.video.openmeta/movies/play/tmdb/%s' % item_id
# xbmc.executebuiltin('Dialog.Close(%s, true)' % window_id)
# xbmc.executebuiltin('RunPlugin(%s)' % url)
if self.listitem.getProperty('dbid'):
dbid = self.listitem.getProperty('dbid')
# url = ''
else:
dbid = 0
# url = 'plugin://plugin.video.openmeta/movies/play/tmdb/%s' % item_id
PLAYER.play_from_button(url, listitem=None, window=self, type='movieid', dbid=dbid)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment