mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-24 09:46:11 +00:00
Fix database discovery
This commit is contained in:
parent
9cc8405a70
commit
d0c5cf5864
2 changed files with 7 additions and 3 deletions
|
@ -32,6 +32,7 @@ class Database(object):
|
|||
'''
|
||||
timeout = 120
|
||||
discovered = False
|
||||
discovered_file = None
|
||||
|
||||
def __init__(self, file=None, commit_close=True):
|
||||
|
||||
|
@ -110,6 +111,7 @@ class Database(object):
|
|||
modified['file'] = file.decode('utf-8')
|
||||
|
||||
LOG.info("Discovered database: %s", modified)
|
||||
self.discovered_file = modified['file']
|
||||
|
||||
return xbmc.translatePath("special://database/%s" % modified['file']).decode('utf-8')
|
||||
|
||||
|
@ -129,13 +131,14 @@ class Database(object):
|
|||
try:
|
||||
loaded = self._get_database(databases[file]) if file in databases else file
|
||||
except Exception as error:
|
||||
LOG.error(error)
|
||||
|
||||
for i in range(1, 10):
|
||||
alt_file = "%s-%s" % (file, i)
|
||||
|
||||
try:
|
||||
loaded = self._get_database(databases[alt_file])
|
||||
|
||||
break
|
||||
except KeyError: # No other db options
|
||||
loaded = None
|
||||
|
||||
|
@ -144,6 +147,7 @@ class Database(object):
|
|||
pass
|
||||
|
||||
if discovered and discovered != loaded:
|
||||
|
||||
databases[file] = discovered
|
||||
self.discovered = True
|
||||
else:
|
||||
|
|
|
@ -124,10 +124,10 @@ class Library(threading.Thread):
|
|||
with Database('music') as musicdb:
|
||||
|
||||
if kodidb.discovered or musicdb.discovered:
|
||||
if kodidb.path != settings('DiscoveredDatabase'):
|
||||
if kodidb.discovered_file != settings('DiscoveredDatabase'):
|
||||
|
||||
LOG.info("Newly discovered database: %s", kodidb.path)
|
||||
settings('DiscoveredDatabase', kodidb.path)
|
||||
settings('DiscoveredDatabase', kodidb.discovered_file)
|
||||
self.monitor.settings['enable_db_discovery'] = True
|
||||
settings('AskDiscoverDatabase.bool', True)
|
||||
|
||||
|
|
Loading…
Reference in a new issue