Fix playback start: Don't lock databases when starting playback

- Partially fixes #599
This commit is contained in:
croneter 2019-01-16 17:13:23 +01:00
parent 4c2332ca99
commit 3e3aa49d0d
2 changed files with 4 additions and 4 deletions

View file

@ -299,7 +299,7 @@ def _prep_playlist_stack(xml):
api.plex_type() not in (v.PLEX_TYPE_CLIP, v.PLEX_TYPE_EPISODE)): 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 # If user chose to play via PMS or force transcode, do not
# use the item path stored in the Kodi DB # 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()) db_item = plexdb.item_by_id(api.plex_id(), api.plex_type())
kodi_id = db_item['kodi_id'] if db_item else None kodi_id = db_item['kodi_id'] if db_item else None
kodi_type = db_item['kodi_type'] 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): 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 # Do NOT use item.offset directly but get it from the DB
# (user might have initiated same video twice) # (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) db_item = plexdb.item_by_id(item.plex_id, item.plex_type)
file_id = db_item['kodi_fileid'] if db_item else None 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) item.offset = kodidb.get_resume(file_id)
LOG.info('Resuming playback at %s', item.offset) LOG.info('Resuming playback at %s', item.offset)
if v.KODIVERSION >= 18 and api: if v.KODIVERSION >= 18 and api:

View file

@ -51,7 +51,7 @@ class PlaybackTask(backgroundthread.Task):
resolve=resolve) resolve=resolve)
elif mode == 'navigation': elif mode == 'navigation':
# e.g. when plugin://...tvshows is called for entire season # 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')) show_id = kodidb.show_id_from_path(params.get('path'))
if show_id: if show_id:
js.activate_window('videos', js.activate_window('videos',