From be57db9200357528491d096583cc182a8ed035bb Mon Sep 17 00:00:00 2001 From: croneter Date: Thu, 4 Oct 2018 19:45:44 +0200 Subject: [PATCH 1/4] Increase logging --- resources/lib/kodimonitor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lib/kodimonitor.py b/resources/lib/kodimonitor.py index 6373124b..24e9712e 100644 --- a/resources/lib/kodimonitor.py +++ b/resources/lib/kodimonitor.py @@ -535,7 +535,7 @@ def _playback_cleanup(ended=False): state.PLAYER_STATES[playerid] = copy.deepcopy(state.PLAYSTATE) # As all playback has halted, reset the players that have been active state.ACTIVE_PLAYERS = set() - LOG.debug('Finished PKC playback cleanup') + LOG.info('Finished PKC playback cleanup') def _record_playstate(status, ended): From 0d0a5948ac12475a6ed20769e86a2f8ba84100f2 Mon Sep 17 00:00:00 2001 From: croneter Date: Thu, 4 Oct 2018 19:48:13 +0200 Subject: [PATCH 2/4] Fix rare case when playback would not start-up --- resources/lib/playback.py | 100 +++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/resources/lib/playback.py b/resources/lib/playback.py index dd115f0f..d187bf9c 100644 --- a/resources/lib/playback.py +++ b/resources/lib/playback.py @@ -57,66 +57,66 @@ def playback_triage(plex_id=None, plex_type=None, path=None, resolve=True): utils.dialog('notification', utils.lang(29999), utils.lang(30017)) _ensure_resolve(abort=True) return - playqueue = PQ.get_playqueue_from_type( - v.KODI_PLAYLIST_TYPE_FROM_PLEX_TYPE[plex_type]) - try: - pos = js.get_position(playqueue.playlistid) - except KeyError: - # Kodi bug - Playlist plays (not Playqueue) will ALWAYS be audio for - # add-on paths - LOG.info('No position returned from Kodi player! Assuming playlist') - playqueue = PQ.get_playqueue_from_type(v.KODI_PLAYLIST_TYPE_AUDIO) + with state.LOCK_PLAYQUEUES: + playqueue = PQ.get_playqueue_from_type( + v.KODI_PLAYLIST_TYPE_FROM_PLEX_TYPE[plex_type]) try: pos = js.get_position(playqueue.playlistid) except KeyError: - LOG.info('Assuming video instead of audio playlist playback') - playqueue = PQ.get_playqueue_from_type(v.KODI_PLAYLIST_TYPE_VIDEO) + # Kodi bug - Playlist plays (not Playqueue) will ALWAYS be audio for + # add-on paths + LOG.info('No position returned from player! Assuming playlist') + playqueue = PQ.get_playqueue_from_type(v.KODI_PLAYLIST_TYPE_AUDIO) try: pos = js.get_position(playqueue.playlistid) except KeyError: - LOG.error('Still no position - abort') - # "Play error" - utils.dialog('notification', - utils.lang(29999), - utils.lang(30128), - icon='{error}') - _ensure_resolve(abort=True) + LOG.info('Assuming video instead of audio playlist playback') + playqueue = PQ.get_playqueue_from_type(v.KODI_PLAYLIST_TYPE_VIDEO) + try: + pos = js.get_position(playqueue.playlistid) + except KeyError: + LOG.error('Still no position - abort') + # "Play error" + utils.dialog('notification', + utils.lang(29999), + utils.lang(30128), + icon='{error}') + _ensure_resolve(abort=True) + return + # HACK to detect playback of playlists for add-on paths + items = js.playlist_get_items(playqueue.playlistid) + try: + item = items[pos] + except IndexError: + LOG.info('Could not apply playlist hack! Probably Widget playback') + else: + if ('id' not in item and + item.get('type') == 'unknown' and item.get('title') == ''): + LOG.info('Kodi playlist play detected') + _playlist_playback(plex_id, plex_type) return - # HACK to detect playback of playlists for add-on paths - items = js.playlist_get_items(playqueue.playlistid) - try: - item = items[pos] - except IndexError: - LOG.info('Could not apply playlist hack! Probably Widget playback') - else: - if ('id' not in item and - item.get('type') == 'unknown' and item.get('title') == ''): - LOG.info('Kodi playlist play detected') - _playlist_playback(plex_id, plex_type) - return - # Can return -1 (as in "no playlist") - pos = pos if pos != -1 else 0 - LOG.debug('playQueue position %s for %s', pos, playqueue) - # Have we already initiated playback? - try: - item = playqueue.items[pos] - except IndexError: - LOG.debug('PKC playqueue yet empty, need to initialize playback') - initiate = True - else: - if item.plex_id != plex_id: - LOG.debug('Received new plex_id %s, expected %s. Init playback', - plex_id, item.plex_id) + # Can return -1 (as in "no playlist") + pos = pos if pos != -1 else 0 + LOG.debug('playQueue position %s for %s', pos, playqueue) + # Have we already initiated playback? + try: + item = playqueue.items[pos] + except IndexError: + LOG.debug('PKC playqueue yet empty, need to initialize playback') initiate = True else: - initiate = False - with state.LOCK_PLAYQUEUES: - if initiate: - _playback_init(plex_id, plex_type, playqueue, pos) - else: - # kick off playback on second pass - _conclude_playback(playqueue, pos) + if item.plex_id != plex_id: + LOG.debug('Received new plex_id %s, expected %s', + plex_id, item.plex_id) + initiate = True + else: + initiate = False + if initiate: + _playback_init(plex_id, plex_type, playqueue, pos) + else: + # kick off playback on second pass + _conclude_playback(playqueue, pos) def _playlist_playback(plex_id, plex_type): From a0f99951a285bdffc915583091b9fddf70fb18b1 Mon Sep 17 00:00:00 2001 From: croneter Date: Thu, 4 Oct 2018 19:49:45 +0200 Subject: [PATCH 3/4] Beta version bump 2.4.4 --- README.md | 2 +- addon.xml | 8 ++++++-- changelog.txt | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9d17dfa2..61b42744 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![stable version](https://img.shields.io/badge/stable_version-2.4.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.4.3-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.4.4-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) diff --git a/addon.xml b/addon.xml index daef72d5..1c26c5c1 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + @@ -74,7 +74,11 @@ Нативна інтеграція Plex в Kodi Підключає Kodi до серверу Plex. Цей плагін передбачає, що ви керуєте всіма своїми відео за допомогою Plex (і ніяк не Kodi). Ви можете втратити дані, які вже зберігаються у відео та музичних БД Kodi (оскільки цей плагін безпосередньо їх змінює). Використовуйте на свій страх і ризик! Використовуйте на свій ризик - version 2.4.3: + version 2.4.4 (beta only): +- Fix rare case when playback would not start-up +- Increase logging + +version 2.4.3: - Fix Kodi addons throwing jsonrpc errors (database reset needed) version 2.4.2: diff --git a/changelog.txt b/changelog.txt index 6ab5c62a..bc6f6a5c 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +version 2.4.4 (beta only): +- Fix rare case when playback would not start-up +- Increase logging + version 2.4.3: - Fix Kodi addons throwing jsonrpc errors (database reset needed) From 9f35e1d99e02beefaaebfa9dc318c6b7f90ce338 Mon Sep 17 00:00:00 2001 From: croneter Date: Sat, 6 Oct 2018 13:30:43 +0200 Subject: [PATCH 4/4] Fix playback not starting up at all --- resources/lib/playback.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/lib/playback.py b/resources/lib/playback.py index d187bf9c..f14dfd2b 100644 --- a/resources/lib/playback.py +++ b/resources/lib/playback.py @@ -112,11 +112,11 @@ def playback_triage(plex_id=None, plex_type=None, path=None, resolve=True): initiate = True else: initiate = False - if initiate: - _playback_init(plex_id, plex_type, playqueue, pos) - else: - # kick off playback on second pass - _conclude_playback(playqueue, pos) + if initiate: + _playback_init(plex_id, plex_type, playqueue, pos) + else: + # kick off playback on second pass + _conclude_playback(playqueue, pos) def _playlist_playback(plex_id, plex_type):