Don't lock DBs when messing with the playqueue

This commit is contained in:
croneter 2019-01-28 18:05:40 +01:00
parent 1d991fd606
commit e04c74392f
2 changed files with 5 additions and 5 deletions

View file

@ -29,7 +29,7 @@ def kodiid_from_filename(path, kodi_type=None, db_type=None):
filename = path.rsplit('\\', 1)[1] filename = path.rsplit('\\', 1)[1]
path = path.rsplit('\\', 1)[0] + '\\' path = path.rsplit('\\', 1)[0] + '\\'
if kodi_type == v.KODI_TYPE_SONG or db_type == 'music': if kodi_type == v.KODI_TYPE_SONG or db_type == 'music':
with KodiMusicDB() as kodidb: with KodiMusicDB(lock=False) as kodidb:
try: try:
kodi_id = kodidb.song_id_from_filename(filename, path) kodi_id = kodidb.song_id_from_filename(filename, path)
except TypeError: except TypeError:
@ -37,7 +37,7 @@ def kodiid_from_filename(path, kodi_type=None, db_type=None):
else: else:
kodi_type = v.KODI_TYPE_SONG kodi_type = v.KODI_TYPE_SONG
else: else:
with KodiVideoDB() as kodidb: with KodiVideoDB(lock=False) as kodidb:
try: try:
kodi_id, kodi_type = kodidb.video_id_from_filename(filename, kodi_id, kodi_type = kodidb.video_id_from_filename(filename,
path) path)

View file

@ -320,7 +320,7 @@ def playlist_item_from_kodi(kodi_item):
item.kodi_id = kodi_item.get('id') item.kodi_id = kodi_item.get('id')
item.kodi_type = kodi_item.get('type') item.kodi_type = kodi_item.get('type')
if item.kodi_id: if item.kodi_id:
with PlexDB() as plexdb: with PlexDB(lock=False) as plexdb:
db_item = plexdb.item_by_kodi_id(kodi_item['id'], kodi_item['type']) db_item = plexdb.item_by_kodi_id(kodi_item['id'], kodi_item['type'])
if db_item: if db_item:
item.plex_id = db_item['plex_id'] item.plex_id = db_item['plex_id']
@ -397,7 +397,7 @@ def playlist_item_from_plex(plex_id):
""" """
item = Playlist_Item() item = Playlist_Item()
item.plex_id = plex_id item.plex_id = plex_id
with PlexDB() as plexdb: with PlexDB(lock=False) as plexdb:
db_item = plexdb.item_by_id(plex_id) db_item = plexdb.item_by_id(plex_id)
if db_item: if db_item:
item.plex_type = db_item['plex_type'] item.plex_type = db_item['plex_type']
@ -429,7 +429,7 @@ def playlist_item_from_xml(xml_video_element, kodi_id=None, kodi_type=None):
item.kodi_id = kodi_id item.kodi_id = kodi_id
item.kodi_type = kodi_type item.kodi_type = kodi_type
elif item.plex_id is not None and item.plex_type != v.PLEX_TYPE_CLIP: elif item.plex_id is not None and item.plex_type != v.PLEX_TYPE_CLIP:
with PlexDB() as plexdb: with PlexDB(lock=False) as plexdb:
db_element = plexdb.item_by_id(item.plex_id) db_element = plexdb.item_by_id(item.plex_id)
if db_element: if db_element:
item.kodi_id = db_element['kodi_id'] item.kodi_id = db_element['kodi_id']