From e1c9690b57da5aa3347493550046119b190ec2fe Mon Sep 17 00:00:00 2001 From: croneter Date: Sun, 8 Jul 2018 11:08:30 +0200 Subject: [PATCH] Catch some errors if user mixes audio and video in Kodi playqueue - Plex does not support mixed playqueues nor playlists --- resources/lib/playqueue.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/resources/lib/playqueue.py b/resources/lib/playqueue.py index 5cead379..1f08cc8b 100644 --- a/resources/lib/playqueue.py +++ b/resources/lib/playqueue.py @@ -141,9 +141,14 @@ class PlayqueueMonitor(Thread): del old[j], index[j] break elif identical: - LOG.debug('Detected playqueue item %s moved to position %s', + LOG.debug('Playqueue item %s moved to position %s', 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] break else: @@ -175,7 +180,12 @@ class PlayqueueMonitor(Thread): # Kodi exit return 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') def run(self):