Merge branch 'beta-version'

This commit is contained in:
croneter 2018-07-08 13:27:41 +02:00
commit 8bb6236c4a
8 changed files with 62 additions and 14 deletions

View file

@ -1,5 +1,5 @@
[![stable version](https://img.shields.io/badge/stable_version-2.1.3-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.1.5-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.2.10-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.2.11-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.2.10" provider-name="croneter"> <addon id="plugin.video.plexkodiconnect" name="PlexKodiConnect" version="2.2.11" 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,15 @@
<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.2.10 (beta only): <news>version 2.2.11 (beta only):
- Fix OnDeck widget for Direct Paths
- Fix Plex Companion crashing when connected to Plex Web
- Fix Plex Companion crash when connected to Plex Web playing playlist music
- Improve Plex playback report when playing music playlist
- Improve reliability in Kodi song playback
- Catch some errors if user mixes audio and video in Kodi playqueue
version 2.2.10 (beta only):
- Fix playlists getting recreated and deleted in an endless loop - Fix playlists getting recreated and deleted in an endless loop
- Add some safety nets for playlist sync - Add some safety nets for playlist sync
- Fix FutureWarning - Fix FutureWarning

View file

@ -1,3 +1,11 @@
version 2.2.11 (beta only):
- Fix OnDeck widget for Direct Paths
- Fix Plex Companion crashing when connected to Plex Web
- Fix Plex Companion crash when connected to Plex Web playing playlist music
- Improve Plex playback report when playing music playlist
- Improve reliability in Kodi song playback
- Catch some errors if user mixes audio and video in Kodi playqueue
version 2.2.10 (beta only): version 2.2.10 (beta only):
- Fix playlists getting recreated and deleted in an endless loop - Fix playlists getting recreated and deleted in an endless loop
- Add some safety nets for playlist sync - Add some safety nets for playlist sync

View file

@ -13,11 +13,14 @@ from xbmcgui import ListItem
from . import utils from . import utils
from . import path_ops from . import path_ops
from . import initialsetup
from .downloadutils import DownloadUtils as DU from .downloadutils import DownloadUtils as DU
from .plex_api import API from .plex_api import API
from . import plex_functions as PF from . import plex_functions as PF
from . import json_rpc as js from . import json_rpc as js
from . import variables as v from . import variables as v
# Be careful - your using state in another Python instance!
from . import state
############################################################################### ###############################################################################
LOG = getLogger('PLEX.entrypoint') LOG = getLogger('PLEX.entrypoint')
@ -31,7 +34,6 @@ def choose_pms_server():
""" """
LOG.info("Choosing PMS server requested, starting") LOG.info("Choosing PMS server requested, starting")
from . import initialsetup
setup = initialsetup.InitialSetup() setup = initialsetup.InitialSetup()
server = setup.pick_pms(showDialog=True) server = setup.pick_pms(showDialog=True)
if server is None: if server is None:
@ -80,7 +82,6 @@ def toggle_plex_tv_sign_in():
utils.plex_command('PLEX_USERNAME', '') utils.plex_command('PLEX_USERNAME', '')
else: else:
LOG.info('Login to plex.tv') LOG.info('Login to plex.tv')
from . import initialsetup
initialsetup.InitialSetup().plex_tv_sign_in() initialsetup.InitialSetup().plex_tv_sign_in()
utils.dialog('notification', utils.dialog('notification',
utils.lang(29999), utils.lang(29999),
@ -551,7 +552,15 @@ def on_deck_episodes(viewid, tagname, limit):
LOG.error('Could not download PMS xml for view %s', viewid) LOG.error('Could not download PMS xml for view %s', viewid)
xbmcplugin.endOfDirectory(int(argv[1]), False) xbmcplugin.endOfDirectory(int(argv[1]), False)
return return
direct_paths = utils.settings('useDirectPaths') == '1' # We're using another python instance - need to load some vars
if utils.settings('useDirectPaths') == '1':
state.DIRECT_PATHS = True
state.REPLACE_SMB_PATH = utils.settings('replaceSMB') == 'true'
state.REMAP_PATH = utils.settings('remapSMB') == 'true'
if state.REMAP_PATH:
initialsetup.set_replace_paths()
# Let's NOT check paths for widgets!
state.PATH_VERIFIED = True
counter = 0 counter = 0
for item in xml: for item in xml:
api = API(item) api = API(item)
@ -560,7 +569,7 @@ def on_deck_episodes(viewid, tagname, limit):
append_sxxexx=append_sxxexx) append_sxxexx=append_sxxexx)
if api.resume_point(): if api.resume_point():
listitem.setProperty('resumetime', str(api.resume_point())) listitem.setProperty('resumetime', str(api.resume_point()))
path = api.path(force_first_media=False, direct_paths=direct_paths) path = api.path(force_first_media=True)
xbmcplugin.addDirectoryItem( xbmcplugin.addDirectoryItem(
handle=int(argv[1]), handle=int(argv[1]),
url=path, url=path,

View file

@ -425,6 +425,7 @@ class KodiMonitor(xbmc.Monitor):
state.PLAYER_STATES[playerid] = copy.deepcopy(state.PLAYSTATE) state.PLAYER_STATES[playerid] = copy.deepcopy(state.PLAYSTATE)
return return
item = PL.init_plex_playqueue(playqueue, plex_id=plex_id) item = PL.init_plex_playqueue(playqueue, plex_id=plex_id)
item.file = path
# Set the Plex container key (e.g. using the Plex playqueue) # Set the Plex container key (e.g. using the Plex playqueue)
container_key = None container_key = None
if info['playlistid'] != -1: if info['playlistid'] != -1:

View file

@ -15,6 +15,7 @@ from . import utils
from . import path_ops from . import path_ops
from . import json_rpc as js from . import json_rpc as js
from . import variables as v from . import variables as v
from . import state
############################################################################### ###############################################################################
@ -342,10 +343,18 @@ def verify_kodi_item(plex_id, kodi_item):
if plex_id is not None or kodi_item.get('id') is not None: if plex_id is not None or kodi_item.get('id') is not None:
# Got all the info we need # Got all the info we need
return kodi_item return kodi_item
# Special case playlist startup - got type but no id
if (not state.DIRECT_PATHS and state.ENABLE_MUSIC and
kodi_item.get('type') == v.KODI_TYPE_SONG and
kodi_item['file'].startswith('http')):
kodi_item['id'], _ = kodidb.kodiid_from_filename(kodi_item['file'],
v.KODI_TYPE_SONG)
LOG.debug('Detected song. Research results: %s', kodi_item)
return kodi_item
# Need more info since we don't have kodi_id nor type. Use file path. # Need more info since we don't have kodi_id nor type. Use file path.
if (kodi_item['file'].startswith('plugin') or if (kodi_item['file'].startswith('plugin') or
kodi_item['file'].startswith('http')): kodi_item['file'].startswith('http')):
LOG.error('kodi_item %s cannot be used for Plex playback', kodi_item) LOG.info('kodi_item %s cannot be used for Plex playback', kodi_item)
raise PlaylistError raise PlaylistError
LOG.debug('Starting research for Kodi id since we didnt get one: %s', LOG.debug('Starting research for Kodi id since we didnt get one: %s',
kodi_item) kodi_item)

View file

@ -141,9 +141,14 @@ class PlayqueueMonitor(Thread):
del old[j], index[j] del old[j], index[j]
break break
elif identical: elif identical:
LOG.debug('Detected playqueue item %s moved to position %s', LOG.debug('Playqueue item %s moved to position %s',
i + j, i) i + j, i)
PL.move_playlist_item(playqueue, i + j, i) try:
PL.move_playlist_item(playqueue, i + j, i)
except PL.PlaylistError:
LOG.error('Could not modify playqueue positions')
LOG.error('This is likely caused by mixing audio and '
'video tracks in the Kodi playqueue')
del old[j], index[j] del old[j], index[j]
break break
else: else:
@ -175,7 +180,12 @@ class PlayqueueMonitor(Thread):
# Kodi exit # Kodi exit
return return
LOG.debug('Detected deletion of playqueue element at pos %s', i) LOG.debug('Detected deletion of playqueue element at pos %s', i)
PL.delete_playlist_item_from_PMS(playqueue, i) try:
PL.delete_playlist_item_from_PMS(playqueue, i)
except PL.PlaylistError:
LOG.error('Could not delete PMS element from position %s', i)
LOG.error('This is likely caused by mixing audio and '
'video tracks in the Kodi playqueue')
LOG.debug('Done comparing playqueues') LOG.debug('Done comparing playqueues')
def run(self): def run(self):

View file

@ -114,6 +114,7 @@ class SubscriptionMgr(object):
self.server = "" self.server = ""
self.protocol = "http" self.protocol = "http"
self.port = "" self.port = ""
self.isplaying = False
self.location = 'navigation' self.location = 'navigation'
# In order to be able to signal a stop at the end # In order to be able to signal a stop at the end
self.last_params = {} self.last_params = {}
@ -142,7 +143,7 @@ class SubscriptionMgr(object):
if playqueue.kodi_playlist_playback: if playqueue.kodi_playlist_playback:
position = 0 position = 0
else: else:
position = info['position'] position = info['position'] or 0
return position return position
def msg(self, players): def msg(self, players):
@ -150,6 +151,7 @@ class SubscriptionMgr(object):
Returns a timeline xml as str Returns a timeline xml as str
(xml containing video, audio, photo player state) (xml containing video, audio, photo player state)
""" """
self.isplaying = False
self.location = 'navigation' self.location = 'navigation'
answ = str(XML) answ = str(XML)
timelines = { timelines = {
@ -198,10 +200,11 @@ class SubscriptionMgr(object):
'type': ptype, 'type': ptype,
'state': 'stopped' 'state': 'stopped'
} }
self.isplaying = True
self.stop_sent_to_web = False
if ptype in (v.PLEX_PLAYLIST_TYPE_VIDEO, if ptype in (v.PLEX_PLAYLIST_TYPE_VIDEO,
v.PLEX_PLAYLIST_TYPE_PHOTO): v.PLEX_PLAYLIST_TYPE_PHOTO):
self.location = 'fullScreenVideo' self.location = 'fullScreenVideo'
self.stop_sent_to_web = False
pbmc_server = utils.window('pms_server') pbmc_server = utils.window('pms_server')
if pbmc_server: if pbmc_server:
(self.protocol, self.server, self.port) = pbmc_server.split(':') (self.protocol, self.server, self.port) = pbmc_server.split(':')