Skip to content

Instantly share code, notes, and snippets.

@henryjfry
henryjfry / DialogVideoList.py
Created October 28, 2019 21:23
/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')
@henryjfry
henryjfry / DialogSeasonInfo.py
Created October 28, 2019 21:22
/home/osmc/.kodi/addons/script.extendedinfo/resources/lib/DialogSeasonInfo.py
@ch.action('contextmenu', 2000)
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')
episode_id = self.listitem.getProperty('episode')
# xbmc.log(str(dbid)+'===>OPENINFO', level=xbmc.LOGNOTICE)
@henryjfry
henryjfry / VideoPlayer.py
Created October 28, 2019 21:20
/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)
@henryjfry
henryjfry / DialogEpisodeInfo.py
Created October 25, 2019 13:02
/home/osmc/.kodi/addons/script.extendedinfo/resources/lib/DialogEpisodeInfo.py => change episode play behaviour for speed + show_busy/hide_busy
@ch.click(8)
def play_episode(self):
Utils.show_busy()
url = 'plugin://plugin.video.openmeta/tv/play/%s/%s/%s' % (Utils.fetch(TheMovieDB.get_tvshow_ids(self.tvshow_id), 'tvdb_id'), self.info['season'], self.info['episode'])
Utils.hide_busy()
xbmc.executebuiltin('RunPlugin(%s)' % url)
# if self.dbid and int(self.dbid) > 0:
# dbid = self.dbid
# url = ''
# PLAYER.play_from_button(url, listitem=None, window=self, type='episodeid', dbid=dbid)
@henryjfry
henryjfry / DialogVideoInfo.py
Created October 25, 2019 13:01
~/.kodi/addons/script.extendedinfo/resources/lib/DialogVideoInfo.py => change movie play behaviour for speed + show_busy/hide_busy
@ch.click(8)
def play_movie(self):
Utils.show_busy()
url = 'plugin://plugin.video.openmeta/movies/play/tmdb/%s' % self.info.get('id', '')
Utils.hide_busy()
xbmc.executebuiltin('RunPlugin(%s)' % url)
# if self.dbid and int(self.dbid) > 0:
# dbid = self.dbid
# url = ''
# PLAYER.play_from_button(url, listitem=None, window=self, type='movieid', dbid=dbid)
@henryjfry
henryjfry / DialogVideoList.py
Last active October 25, 2019 12:59
~/.kodi/addons/script.extendedinfo/resources/lib/DialogVideoList.py => Genre Multi Select
###########################
#change play behaviour for movies for greater speed + show_busy/hide_busy
###########################
@ch.action('contextmenu', 500)
def context_menu(self):
if self.listitem.getProperty('dbid') and self.listitem.getProperty('dbid') != 0:
dbid = self.listitem.getProperty('dbid')
else:
dbid = 0
@henryjfry
henryjfry / DialogBaseList.py
Last active June 19, 2020 19:11
~/.kodi/addons/script.extendedinfo/resources/lib/DialogBaseList.py => urllib error
import xbmc, xbmcgui, xbmcaddon, urllib
#########
def add_filter(self, key, value, typelabel, label, force_overwrite=False):
index = -1
new_filter = {
'id': value,
'type': key,
'typelabel': typelabel,
@henryjfry
henryjfry / Trakt.py
Created October 13, 2019 08:53
Openmeta - latest releases - ~/osmc/.kodi/addons/plugin.video.openmeta/resources/lib/Trakt.py
@plugin.cached(TTL=60, cache='Trakt')
def get_latest_releases_movies():
return call_trakt('users/giladg/lists/latest-releases/items?extended=full', with_auth=False)
@plugin.cached(TTL=60, cache='Trakt')
def get_latest_4k_releases_movies():
return call_trakt('users/giladg/lists/latest-4k-releases/items?extended=full', with_auth=False)
@henryjfry
henryjfry / nav_movies.py
Last active October 13, 2019 08:52
openmeta - latest releases - ~/.kodi/addons/plugin.video.openmeta/resources/lib/nav_movies.py
@plugin.route('/movies/trakt/latest_releases')
def trakt_movies_latest_releases(raw=False):
results = sorted(Trakt.get_latest_releases_movies(), key=lambda k: k['listed_at'], reverse=True)
if raw:
return results
else:
return list_trakt_movies(results)
@plugin.route('/movies/trakt/latest_4k_releases')
def trakt_movies_latest_4k_releases(raw=False):
@henryjfry
henryjfry / menu_items.py
Created October 13, 2019 08:51
openmeta - menu_items.py (latest releases - ~/.kodi/addons/plugin.video.openmeta/resources/lib/menu_items.py)
{
'label': 'Latest releases (Trakt)',
'path': plugin.url_for('trakt_movies_latest_releases'),
'thumbnail': plugin.get_media_icon('traktcalendar'),
'fanart': plugin.get_addon_fanart(),
'context_menu': [
('Play (random)', 'RunPlugin(%s)' % plugin.url_for('trakt_movies_play_random_latest_releases'))]
},
{
'label': 'Latest 4K releases (Trakt)',