Merge branch 'beta-version'

This commit is contained in:
croneter 2018-08-23 15:42:11 +02:00
commit fd4a0e8e0d
27 changed files with 179 additions and 44 deletions

View file

@ -1,5 +1,5 @@
[![stable version](https://img.shields.io/badge/stable_version-2.3.8-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.8-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.9-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)
[![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"?>
<addon id="plugin.video.plexkodiconnect" name="PlexKodiConnect" version="2.3.8" provider-name="croneter">
<addon id="plugin.video.plexkodiconnect" name="PlexKodiConnect" version="2.3.9" provider-name="croneter">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
<import addon="script.module.requests" version="2.9.1" />
@ -73,7 +73,12 @@
<summary lang="uk_UA">Нативна інтеграція Plex в Kodi</summary>
<description lang="uk_UA">Підключає Kodi до серверу Plex. Цей плагін передбачає, що ви керуєте всіма своїми відео за допомогою Plex (і ніяк не Kodi). Ви можете втратити дані, які вже зберігаються у відео та музичних БД Kodi (оскільки цей плагін безпосередньо їх змінює). Використовуйте на свій страх і ризик!</description>
<disclaimer lang="uk_UA">Використовуйте на свій ризик</disclaimer>
<news>version 2.3.8:
<news>version 2.3.9 (beta only):
- Fix playback not resuming (Kodi 18 ignores listitem "StartOffset")
- Fix playerid not being retrieved for Kodi 18
- Prefer local trailers; new setting to list extras instead of playing trailer
version 2.3.8:
- Fix typo
- Make version 2.3.4-2.3.7 available for everyone

View file

@ -1,3 +1,8 @@
version 2.3.9 (beta only):
- Fix playback not resuming (Kodi 18 ignores listitem "StartOffset")
- Fix playerid not being retrieved for Kodi 18
- Prefer local trailers; new setting to list extras instead of playing trailer
version 2.3.8:
- Fix typo
- Make version 2.3.4-2.3.7 available for everyone

View file

@ -119,13 +119,13 @@ msgstr "Vyhledávání na FanartTV dokončeno"
# PKC settings sync options
msgctxt "#30020"
msgid "Sync Plex playlists"
msgid "Sync Plex playlists (reboot Kodi!)"
msgstr ""
# PKC settings sync options
msgctxt "#30021"
msgid "Only sync specific Plex playlists to Kodi"
msgstr ""
msgstr "Synchronizovat pouze konktrétní playlisty do Kodi"
# PKC settings category
msgctxt "#30022"
@ -135,7 +135,7 @@ msgstr "Rozšířené"
# PKC settings sync options
msgctxt "#30023"
msgid "Only sync specific Kodi playlists to Plex"
msgstr ""
msgstr "Synchronizovat pouze konkrétní playlisty do Plexu"
msgctxt "#30024"
msgid "Username"
@ -148,12 +148,12 @@ msgstr "Zobrazit zprávu při odpojení PMS"
# PKC settings sync options
msgctxt "#30026"
msgid "Prefix in Plex playlist name to trigger sync"
msgstr ""
msgstr "Předpona jména playlistu v Kodi pro synchronizaci"
# PKC settings sync options
msgctxt "#30027"
msgid "Prefix in Kodi playlist name to trigger sync"
msgstr ""
msgstr "Předpona jména playlistu v Plexu pro synchronizaci"
msgctxt "#30030"
msgid "Port Number"
@ -589,6 +589,11 @@ msgctxt "#30542"
msgid "Always pick best quality for trailers"
msgstr "Vždy vybrat nejlepší kvalitu ukázek"
# PKC Settings - Artwork
msgctxt "#30543"
msgid "Prefer Kodi artwork for collections/sets"
msgstr ""
msgctxt "#30544"
msgid "Artwork"
msgstr "Obrázky"

View file

@ -115,7 +115,7 @@ msgstr ""
# PKC settings sync options
msgctxt "#30020"
msgid "Sync Plex playlists"
msgid "Sync Plex playlists (reboot Kodi!)"
msgstr ""
# PKC settings sync options
@ -582,6 +582,11 @@ msgctxt "#30542"
msgid "Always pick best quality for trailers"
msgstr "Altid vælge bedste kvalitet til anhængere"
# PKC Settings - Artwork
msgctxt "#30543"
msgid "Prefer Kodi artwork for collections/sets"
msgstr ""
msgctxt "#30544"
msgid "Artwork"
msgstr "Illustrationer"

View file

@ -117,8 +117,8 @@ msgstr "FanartTV Nachforschungen beendet"
# PKC settings sync options
msgctxt "#30020"
msgid "Sync Plex playlists"
msgstr "Plex Wiedergabelisten synchronisieren"
msgid "Sync Plex playlists (reboot Kodi!)"
msgstr "Plex Wiedergabelisten synchronisieren (Kodi neu starten!)"
# PKC settings sync options
msgctxt "#30021"
@ -587,6 +587,11 @@ msgctxt "#30542"
msgid "Always pick best quality for trailers"
msgstr "Trailer immer in der besten Qualität abspielen"
# PKC Settings - Artwork
msgctxt "#30543"
msgid "Prefer Kodi artwork for collections/sets"
msgstr "Kodi Bilder für Filmsammlungen/Sets bevorzugen"
msgctxt "#30544"
msgid "Artwork"
msgstr "Artwork"

View file

@ -464,6 +464,11 @@ msgctxt "#30513"
msgid "Limit artwork cache threads (recommended for rpi)"
msgstr ""
# PKC Settings - Sync Options
msgctxt "#30514"
msgid "Show all Plex extras instead of immediately playing trailers"
msgstr ""
# PKC Settings - Sync Options
msgctxt "#30515"
msgid "Maximum items to request from the server at once"

View file

@ -115,7 +115,7 @@ msgstr ""
# PKC settings sync options
msgctxt "#30020"
msgid "Sync Plex playlists"
msgid "Sync Plex playlists (reboot Kodi!)"
msgstr ""
# PKC settings sync options
@ -583,6 +583,11 @@ msgctxt "#30542"
msgid "Always pick best quality for trailers"
msgstr "Escoger siempre la mejor calidad para tráilers"
# PKC Settings - Artwork
msgctxt "#30543"
msgid "Prefer Kodi artwork for collections/sets"
msgstr ""
msgctxt "#30544"
msgid "Artwork"
msgstr "Arte"

View file

@ -115,7 +115,7 @@ msgstr ""
# PKC settings sync options
msgctxt "#30020"
msgid "Sync Plex playlists"
msgid "Sync Plex playlists (reboot Kodi!)"
msgstr ""
# PKC settings sync options
@ -583,6 +583,11 @@ msgctxt "#30542"
msgid "Always pick best quality for trailers"
msgstr "Escoger siempre la mejor calidad para tráilers"
# PKC Settings - Artwork
msgctxt "#30543"
msgid "Prefer Kodi artwork for collections/sets"
msgstr ""
msgctxt "#30544"
msgid "Artwork"
msgstr "Arte"

View file

@ -115,7 +115,7 @@ msgstr ""
# PKC settings sync options
msgctxt "#30020"
msgid "Sync Plex playlists"
msgid "Sync Plex playlists (reboot Kodi!)"
msgstr ""
# PKC settings sync options
@ -583,6 +583,11 @@ msgctxt "#30542"
msgid "Always pick best quality for trailers"
msgstr "Escoger siempre la mejor calidad para tráilers"
# PKC Settings - Artwork
msgctxt "#30543"
msgid "Prefer Kodi artwork for collections/sets"
msgstr ""
msgctxt "#30544"
msgid "Artwork"
msgstr "Arte"

View file

@ -118,7 +118,7 @@ msgstr ""
# PKC settings sync options
msgctxt "#30020"
msgid "Sync Plex playlists"
msgid "Sync Plex playlists (reboot Kodi!)"
msgstr ""
# PKC settings sync options
@ -588,6 +588,11 @@ msgctxt "#30542"
msgid "Always pick best quality for trailers"
msgstr "Toujours séléctionner la meilleure qualité pour les bande-annonces"
# PKC Settings - Artwork
msgctxt "#30543"
msgid "Prefer Kodi artwork for collections/sets"
msgstr ""
msgctxt "#30544"
msgid "Artwork"
msgstr "Contenu graphique"

View file

@ -120,7 +120,7 @@ msgstr ""
# PKC settings sync options
msgctxt "#30020"
msgid "Sync Plex playlists"
msgid "Sync Plex playlists (reboot Kodi!)"
msgstr ""
# PKC settings sync options
@ -590,6 +590,11 @@ msgctxt "#30542"
msgid "Always pick best quality for trailers"
msgstr "Toujours séléctionner la meilleure qualité pour les bande-annonces"
# PKC Settings - Artwork
msgctxt "#30543"
msgid "Prefer Kodi artwork for collections/sets"
msgstr ""
msgctxt "#30544"
msgid "Artwork"
msgstr "Contenu graphique"

View file

@ -117,7 +117,7 @@ msgstr ""
# PKC settings sync options
msgctxt "#30020"
msgid "Sync Plex playlists"
msgid "Sync Plex playlists (reboot Kodi!)"
msgstr ""
# PKC settings sync options
@ -589,6 +589,11 @@ msgctxt "#30542"
msgid "Always pick best quality for trailers"
msgstr "Mindig válassza a legjobb minőséget filmelőzetesek lejátszásakor"
# PKC Settings - Artwork
msgctxt "#30543"
msgid "Prefer Kodi artwork for collections/sets"
msgstr ""
msgctxt "#30544"
msgid "Artwork"
msgstr "Művészképek"

View file

@ -120,7 +120,7 @@ msgstr ""
# PKC settings sync options
msgctxt "#30020"
msgid "Sync Plex playlists"
msgid "Sync Plex playlists (reboot Kodi!)"
msgstr ""
# PKC settings sync options
@ -588,6 +588,11 @@ msgctxt "#30542"
msgid "Always pick best quality for trailers"
msgstr "Scegli sempre qualità migliore per i trailer"
# PKC Settings - Artwork
msgctxt "#30543"
msgid "Prefer Kodi artwork for collections/sets"
msgstr ""
msgctxt "#30544"
msgid "Artwork"
msgstr "Immagine"

View file

@ -118,7 +118,7 @@ msgstr ""
# PKC settings sync options
msgctxt "#30020"
msgid "Sync Plex playlists"
msgid "Sync Plex playlists (reboot Kodi!)"
msgstr ""
# PKC settings sync options
@ -587,6 +587,11 @@ msgctxt "#30542"
msgid "Always pick best quality for trailers"
msgstr "Kies altijd beste kwaliteit voor trailers"
# PKC Settings - Artwork
msgctxt "#30543"
msgid "Prefer Kodi artwork for collections/sets"
msgstr ""
msgctxt "#30544"
msgid "Artwork"
msgstr "Illustraties"

View file

@ -116,7 +116,7 @@ msgstr ""
# PKC settings sync options
msgctxt "#30020"
msgid "Sync Plex playlists"
msgid "Sync Plex playlists (reboot Kodi!)"
msgstr ""
# PKC settings sync options
@ -583,6 +583,11 @@ msgctxt "#30542"
msgid "Always pick best quality for trailers"
msgstr "Velg alltid traileren med best kvalitet"
# PKC Settings - Artwork
msgctxt "#30543"
msgid "Prefer Kodi artwork for collections/sets"
msgstr ""
msgctxt "#30544"
msgid "Artwork"
msgstr "Kunst"

View file

@ -115,7 +115,7 @@ msgstr ""
# PKC settings sync options
msgctxt "#30020"
msgid "Sync Plex playlists"
msgid "Sync Plex playlists (reboot Kodi!)"
msgstr ""
# PKC settings sync options
@ -583,6 +583,11 @@ msgctxt "#30542"
msgid "Always pick best quality for trailers"
msgstr "Escolher sempre a melhor qualidade para trailers"
# PKC Settings - Artwork
msgctxt "#30543"
msgid "Prefer Kodi artwork for collections/sets"
msgstr ""
msgctxt "#30544"
msgid "Artwork"
msgstr "Ilustrações"

View file

@ -117,7 +117,7 @@ msgstr ""
# PKC settings sync options
msgctxt "#30020"
msgid "Sync Plex playlists"
msgid "Sync Plex playlists (reboot Kodi!)"
msgstr ""
# PKC settings sync options
@ -585,6 +585,11 @@ msgctxt "#30542"
msgid "Always pick best quality for trailers"
msgstr "Escolher sempre a melhor qualidade para trailers"
# PKC Settings - Artwork
msgctxt "#30543"
msgid "Prefer Kodi artwork for collections/sets"
msgstr ""
msgctxt "#30544"
msgid "Artwork"
msgstr "Ilustrações"

View file

@ -124,7 +124,7 @@ msgstr "Поиск FanartTV завершен"
# PKC settings sync options
msgctxt "#30020"
msgid "Sync Plex playlists"
msgid "Sync Plex playlists (reboot Kodi!)"
msgstr ""
# PKC settings sync options
@ -594,6 +594,11 @@ msgctxt "#30542"
msgid "Always pick best quality for trailers"
msgstr "Всегда выбирать лучшее качество для трейлеров"
# PKC Settings - Artwork
msgctxt "#30543"
msgid "Prefer Kodi artwork for collections/sets"
msgstr ""
msgctxt "#30544"
msgid "Artwork"
msgstr "Иллюстрации"

View file

@ -118,7 +118,7 @@ msgstr "Огляд FanartTV завершено"
# PKC settings sync options
msgctxt "#30020"
msgid "Sync Plex playlists"
msgid "Sync Plex playlists (reboot Kodi!)"
msgstr ""
# PKC settings sync options
@ -589,6 +589,11 @@ msgctxt "#30542"
msgid "Always pick best quality for trailers"
msgstr "Завжди обирати найліпшу якість трейлерів"
# PKC Settings - Artwork
msgctxt "#30543"
msgid "Prefer Kodi artwork for collections/sets"
msgstr ""
msgctxt "#30544"
msgid "Artwork"
msgstr "Зображення"

View file

@ -116,7 +116,7 @@ msgstr ""
# PKC settings sync options
msgctxt "#30020"
msgid "Sync Plex playlists"
msgid "Sync Plex playlists (reboot Kodi!)"
msgstr ""
# PKC settings sync options
@ -582,6 +582,11 @@ msgctxt "#30542"
msgid "Always pick best quality for trailers"
msgstr "总是为预告片挑选最佳质量"
# PKC Settings - Artwork
msgctxt "#30543"
msgid "Prefer Kodi artwork for collections/sets"
msgstr ""
msgctxt "#30544"
msgid "Artwork"
msgstr "插图"

View file

@ -115,7 +115,7 @@ msgstr ""
# PKC settings sync options
msgctxt "#30020"
msgid "Sync Plex playlists"
msgid "Sync Plex playlists (reboot Kodi!)"
msgstr ""
# PKC settings sync options
@ -581,6 +581,11 @@ msgctxt "#30542"
msgid "Always pick best quality for trailers"
msgstr "總是挑選最好品質的預告片"
# PKC Settings - Artwork
msgctxt "#30543"
msgid "Prefer Kodi artwork for collections/sets"
msgstr ""
msgctxt "#30544"
msgid "Artwork"
msgstr "背景海報"

View file

@ -52,7 +52,8 @@ STATE_SETTINGS = {
'fetch_pms_item_number': 'FETCH_PMS_ITEM_NUMBER',
'imageSyncNotifications': 'IMAGE_SYNC_NOTIFICATIONS',
'syncSpecificPlexPlaylists': 'SYNC_SPECIFIC_PLEX_PLAYLISTS',
'syncSpecificKodiPlaylists': 'SYNC_SPECIFIC_KODI_PLAYLISTS'
'syncSpecificKodiPlaylists': 'SYNC_SPECIFIC_KODI_PLAYLISTS',
'showExtrasInsteadOfTrailer': 'SHOW_EXTRAS_INSTEAD_OF_PLAYING_TRAILER'
}
###############################################################################
@ -372,13 +373,27 @@ class KodiMonitor(xbmc.Monitor):
LOG.info('Aborting playback report - item invalid for updates %s',
data)
return
kodi_id = data['item'].get('id') if 'item' in data else None
kodi_type = data['item'].get('type') if 'item' in data else None
path = data['item'].get('file') if 'item' in data else None
if playerid == -1:
# Kodi might return -1 for "last player"
# Getting the playerid is really a PITA
try:
playerid = js.get_player_ids()[0]
except IndexError:
LOG.error('Could not retreive active player - aborting')
return
# E.g. Kodi 18 doesn't tell us anything useful
if kodi_type in v.KODI_VIDEOTYPES:
playlist_type = v.KODI_TYPE_VIDEO_PLAYLIST
elif kodi_type in v.KODI_AUDIOTYPES:
playlist_type = v.KODI_TYPE_AUDIO_PLAYLIST
else:
LOG.error('Unexpected type %s, data %s', kodi_type, data)
return
playerid = js.get_playlist_id(playlist_type)
if not playerid:
LOG.error('Coud not get playerid for data', data)
return
playqueue = PQ.PLAYQUEUES[playerid]
info = js.get_player_props(playerid)
if playqueue.kodi_playlist_playback:
@ -390,9 +405,6 @@ class KodiMonitor(xbmc.Monitor):
pos = info['position'] if info['position'] != -1 else 0
LOG.debug('Detected position %s for %s', pos, playqueue)
status = state.PLAYER_STATES[playerid]
kodi_id = data.get('id')
kodi_type = data.get('type')
path = data.get('file')
try:
item = playqueue.items[pos]
except IndexError:

View file

@ -411,6 +411,7 @@ def _conclude_playback(playqueue, pos):
playutils = PlayUtils(api, item)
playurl = playutils.getPlayUrl()
else:
api = None
playurl = item.file
listitem.setPath(utils.try_encode(playurl))
if item.playmethod == 'DirectStream':
@ -428,8 +429,14 @@ def _conclude_playback(playqueue, pos):
with kodidb.GetKodiDB('video') as kodi_db:
item.offset = kodi_db.get_resume(file_id)
LOG.info('Resuming playback at %s', item.offset)
listitem.setProperty('StartOffset', str(item.offset))
listitem.setProperty('resumetime', str(item.offset))
if v.KODIVERSION >= 18 and api:
# Kodi 18 Alpha 3 broke StartOffset
percent = float(item.offset) / api.runtime() * 100.0
LOG.debug('Resuming at %s percent', percent)
listitem.setProperty('StartPercent', str(percent))
else:
listitem.setProperty('StartOffset', str(item.offset))
listitem.setProperty('resumetime', str(item.offset))
# Reset the resumable flag
result.listitem = listitem
pickler.pickle_me(result)

View file

@ -743,26 +743,33 @@ class API(object):
def trailers(self):
"""
Returns the URL for a single trailer, an addon path for extras
(route_to_extras) if several trailers are present. Or None
Returns the URL for a single trailer (local trailer preferred; first
trailer found returned) or an add-on path to list all Plex extras
if the user setting showExtrasInsteadOfTrailer is set.
Returns None if nothing is found.
"""
url = None
number = 0
for extras in self.item.iterfind('Extras'):
# There will always be only 1 extras element
if (len(extras) > 0 and
state.SHOW_EXTRAS_INSTEAD_OF_PLAYING_TRAILER):
return ('plugin://%s?mode=route_to_extras&plex_id=%s'
% (v.ADDON_ID, self.plex_id()))
for extra in extras:
try:
typus = int(extra.attrib['extraType'])
except (KeyError, TypeError):
typus = None
if typus != 1:
# Skip non-trailers
continue
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:
if extra.get('guid', '').startswith('file:'):
url = extra.get('ratingKey')
# Always prefer local trailers (first one listed)
break
elif not url:
url = extra.get('ratingKey')
if url:
url = ('plugin://%s.movies/?plex_id=%s&plex_type=%s&mode=play'
% (v.ADDON_ID, url, v.PLEX_TYPE_CLIP))
return url

View file

@ -45,6 +45,9 @@ RESTRICTED_USER = False
DIRECT_PATHS = False
# Shall we replace custom user ratings with the number of versions available?
INDICATE_MEDIA_VERSIONS = False
# Will sync movie trailer differently: either play trailer directly or show
# all the Plex extras for the user to choose
SHOW_EXTRAS_INSTEAD_OF_PLAYING_TRAILER = False
# Do we need to run a special library scan?
RUN_LIB_SCAN = None
# Number of items to fetch and display in widgets

View file

@ -75,6 +75,7 @@
<setting id="backgroundsync_saftyMargin" type="slider" label="39051" default="5" option="int" range="5,1,300" visible="eq(-1,true)" subsetting="true" />
<setting type="sep" />
<setting type="lsep" label="30538" /><!-- Manual complete reset of Kodi database necessary, see "Advanced" -->
<setting id="showExtrasInsteadOfTrailer" type="bool" label="30514" default="false" /><!-- Show all Plex extras instead of immediately playing trailers -->
<setting id="indicate_media_versions" type="bool" label="39719" default="false" /><!-- Replace user ratings with number of versions -->
<setting id="enableMusic" type="bool" label="30509" default="true" />
<setting id="useDirectPaths" type="enum" label="30511" values="Addon(Default)|Native(Direct paths)" default="0" visible="true"/> <!-- Playback mode -->