From 3e3aa49d0d544ea5f03760ae7bd4615ff9c1cd09 Mon Sep 17 00:00:00 2001 From: croneter Date: Wed, 16 Jan 2019 17:13:23 +0100 Subject: [PATCH] Fix playback start: Don't lock databases when starting playback - Partially fixes #599 --- resources/lib/playback.py | 6 +++--- resources/lib/playback_starter.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/lib/playback.py b/resources/lib/playback.py index d0968fd1..8e3b84b8 100644 --- a/resources/lib/playback.py +++ b/resources/lib/playback.py @@ -299,7 +299,7 @@ def _prep_playlist_stack(xml): api.plex_type() not in (v.PLEX_TYPE_CLIP, v.PLEX_TYPE_EPISODE)): # If user chose to play via PMS or force transcode, do not # use the item path stored in the Kodi DB - with PlexDB() as plexdb: + with PlexDB(lock=False) as plexdb: db_item = plexdb.item_by_id(api.plex_id(), api.plex_type()) kodi_id = db_item['kodi_id'] if db_item else None kodi_type = db_item['kodi_type'] if db_item else None @@ -412,10 +412,10 @@ def _conclude_playback(playqueue, pos): if item.plex_type not in (v.PLEX_TYPE_SONG, v.PLEX_TYPE_CLIP): # Do NOT use item.offset directly but get it from the DB # (user might have initiated same video twice) - with PlexDB() as plexdb: + with PlexDB(lock=False) as plexdb: db_item = plexdb.item_by_id(item.plex_id, item.plex_type) file_id = db_item['kodi_fileid'] if db_item else None - with KodiVideoDB() as kodidb: + with KodiVideoDB(lock=False) as kodidb: item.offset = kodidb.get_resume(file_id) LOG.info('Resuming playback at %s', item.offset) if v.KODIVERSION >= 18 and api: diff --git a/resources/lib/playback_starter.py b/resources/lib/playback_starter.py index 2d3f52cd..d23aae7b 100644 --- a/resources/lib/playback_starter.py +++ b/resources/lib/playback_starter.py @@ -51,7 +51,7 @@ class PlaybackTask(backgroundthread.Task): resolve=resolve) elif mode == 'navigation': # e.g. when plugin://...tvshows is called for entire season - with KodiVideoDB() as kodidb: + with KodiVideoDB(lock=False) as kodidb: show_id = kodidb.show_id_from_path(params.get('path')) if show_id: js.activate_window('videos',