parent
8e5f6d5d6d
commit
f5ea8cc3ec
3 changed files with 27 additions and 9 deletions
12
default.py
12
default.py
|
@ -6,7 +6,7 @@ import logging
|
||||||
from sys import argv
|
from sys import argv
|
||||||
from urlparse import parse_qsl
|
from urlparse import parse_qsl
|
||||||
from xbmc import sleep, executebuiltin
|
from xbmc import sleep, executebuiltin
|
||||||
from xbmcgui import ListItem
|
from xbmcgui import ListItem, getCurrentWindowId
|
||||||
from xbmcplugin import setResolvedUrl
|
from xbmcplugin import setResolvedUrl
|
||||||
|
|
||||||
from resources.lib import entrypoint, utils, pickler, pkc_listitem, \
|
from resources.lib import entrypoint, utils, pickler, pkc_listitem, \
|
||||||
|
@ -69,6 +69,16 @@ class Main():
|
||||||
elif mode == 'channels':
|
elif mode == 'channels':
|
||||||
entrypoint.channels()
|
entrypoint.channels()
|
||||||
|
|
||||||
|
elif mode == 'route_to_extras':
|
||||||
|
# Hack so we can store this path in the Kodi DB
|
||||||
|
handle = ('plugin://%s?mode=extras&plex_id=%s'
|
||||||
|
% (v.ADDON_ID, params.get('plex_id')))
|
||||||
|
if getCurrentWindowId() == 10025:
|
||||||
|
# Video Window
|
||||||
|
executebuiltin('Container.Update(\"%s\")' % handle)
|
||||||
|
else:
|
||||||
|
executebuiltin('ActivateWindow(videos, \"%s\")' % handle)
|
||||||
|
|
||||||
elif mode == 'extras':
|
elif mode == 'extras':
|
||||||
entrypoint.extras(plex_id=params.get('plex_id'))
|
entrypoint.extras(plex_id=params.get('plex_id'))
|
||||||
|
|
||||||
|
|
|
@ -207,11 +207,7 @@ class Movies(Items):
|
||||||
studio = studios[0]
|
studio = studios[0]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
studio = None
|
studio = None
|
||||||
|
trailer = api.trailers()
|
||||||
trailer = api.trailer_id()
|
|
||||||
if trailer:
|
|
||||||
trailer = ('plugin://%s.movies/?plex_id=%s&plex_type=%s&mode=play'
|
|
||||||
% (v.ADDON_ID, trailer, v.PLEX_TYPE_CLIP))
|
|
||||||
|
|
||||||
# GET THE FILE AND PATH #####
|
# GET THE FILE AND PATH #####
|
||||||
do_indirect = not state.DIRECT_PATHS
|
do_indirect = not state.DIRECT_PATHS
|
||||||
|
|
|
@ -728,10 +728,13 @@ class API(object):
|
||||||
answ.append(extra)
|
answ.append(extra)
|
||||||
return answ
|
return answ
|
||||||
|
|
||||||
def trailer_id(self):
|
def trailers(self):
|
||||||
"""
|
"""
|
||||||
Returns the ratingKey (plex_id) of the trailer or None
|
Returns the URL for a single trailer, an addon path for extras
|
||||||
|
(route_to_extras) if several trailers are present. Or None
|
||||||
"""
|
"""
|
||||||
|
url = None
|
||||||
|
number = 0
|
||||||
for extras in self.item.iterfind('Extras'):
|
for extras in self.item.iterfind('Extras'):
|
||||||
for extra in extras:
|
for extra in extras:
|
||||||
try:
|
try:
|
||||||
|
@ -740,7 +743,16 @@ class API(object):
|
||||||
typus = None
|
typus = None
|
||||||
if typus != 1:
|
if typus != 1:
|
||||||
continue
|
continue
|
||||||
return extra.get('ratingKey')
|
number += 1
|
||||||
|
url = extra.get('ratingKey')
|
||||||
|
if number > 1:
|
||||||
|
# Several trailers present. Hence let the user choose
|
||||||
|
url = ('plugin://%s?mode=route_to_extras&plex_id=%s'
|
||||||
|
% (v.ADDON_ID, self.plex_id()))
|
||||||
|
elif url:
|
||||||
|
url = ('plugin://%s.movies/?plex_id=%s&plex_type=%s&mode=play'
|
||||||
|
% (v.ADDON_ID, url, v.PLEX_TYPE_CLIP))
|
||||||
|
return url
|
||||||
|
|
||||||
def mediastreams(self):
|
def mediastreams(self):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue