Merge branch 'beta-version'

This commit is contained in:
croneter 2018-08-04 15:13:58 +02:00
commit 7e9c5bbd62
6 changed files with 37 additions and 13 deletions

View file

@ -1,5 +1,5 @@
[![stable version](https://img.shields.io/badge/stable_version-2.3.2-blue.svg?maxAge=60&style=flat) ](https://github.com/croneter/binary_repo/raw/master/stable/repository.plexkodiconnect/repository.plexkodiconnect-1.0.2.zip) [![stable version](https://img.shields.io/badge/stable_version-2.3.3-blue.svg?maxAge=60&style=flat) ](https://github.com/croneter/binary_repo/raw/master/stable/repository.plexkodiconnect/repository.plexkodiconnect-1.0.2.zip)
[![beta version](https://img.shields.io/badge/beta_version-2.3.2-red.svg?maxAge=60&style=flat) ](https://github.com/croneter/binary_repo/raw/master/beta/repository.plexkodiconnectbeta/repository.plexkodiconnectbeta-1.0.2.zip) [![beta version](https://img.shields.io/badge/beta_version-2.3.3-red.svg?maxAge=60&style=flat) ](https://github.com/croneter/binary_repo/raw/master/beta/repository.plexkodiconnectbeta/repository.plexkodiconnectbeta-1.0.2.zip)
[![Installation](https://img.shields.io/badge/wiki-installation-brightgreen.svg?maxAge=60&style=flat)](https://github.com/croneter/PlexKodiConnect/wiki/Installation) [![Installation](https://img.shields.io/badge/wiki-installation-brightgreen.svg?maxAge=60&style=flat)](https://github.com/croneter/PlexKodiConnect/wiki/Installation)
[![FAQ](https://img.shields.io/badge/wiki-FAQ-brightgreen.svg?maxAge=60&style=flat)](https://github.com/croneter/PlexKodiConnect/wiki/faq) [![FAQ](https://img.shields.io/badge/wiki-FAQ-brightgreen.svg?maxAge=60&style=flat)](https://github.com/croneter/PlexKodiConnect/wiki/faq)

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.plexkodiconnect" name="PlexKodiConnect" version="2.3.2" provider-name="croneter"> <addon id="plugin.video.plexkodiconnect" name="PlexKodiConnect" version="2.3.3" provider-name="croneter">
<requires> <requires>
<import addon="xbmc.python" version="2.1.0"/> <import addon="xbmc.python" version="2.1.0"/>
<import addon="script.module.requests" version="2.9.1" /> <import addon="script.module.requests" version="2.9.1" />
@ -73,7 +73,10 @@
<summary lang="uk_UA">Нативна інтеграція Plex в Kodi</summary> <summary lang="uk_UA">Нативна інтеграція Plex в Kodi</summary>
<description lang="uk_UA">Підключає Kodi до серверу Plex. Цей плагін передбачає, що ви керуєте всіма своїми відео за допомогою Plex (і ніяк не Kodi). Ви можете втратити дані, які вже зберігаються у відео та музичних БД Kodi (оскільки цей плагін безпосередньо їх змінює). Використовуйте на свій страх і ризик!</description> <description lang="uk_UA">Підключає Kodi до серверу Plex. Цей плагін передбачає, що ви керуєте всіма своїми відео за допомогою Plex (і ніяк не Kodi). Ви можете втратити дані, які вже зберігаються у відео та музичних БД Kodi (оскільки цей плагін безпосередньо їх змінює). Використовуйте на свій страх і ризик!</description>
<disclaimer lang="uk_UA">Використовуйте на свій ризик</disclaimer> <disclaimer lang="uk_UA">Використовуйте на свій ризик</disclaimer>
<news>version 2.3.2: <news>version 2.3.3:
- Choose trailer if several are present (DB reset required)
version 2.3.2:
- Fix casting to PKC failing - Fix casting to PKC failing
version 2.3.1: version 2.3.1:

View file

@ -1,3 +1,6 @@
version 2.3.3:
- Choose trailer if several are present (DB reset required)
version 2.3.2: version 2.3.2:
- Fix casting to PKC failing - Fix casting to PKC failing

View file

@ -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'))

View file

@ -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

View file

@ -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):
""" """