mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-24 17:56:11 +00:00
Update database discovery
This commit is contained in:
parent
11b80271dd
commit
357182ca82
4 changed files with 11 additions and 42 deletions
|
@ -85,9 +85,14 @@ class Database(object):
|
|||
|
||||
def _discover_database(self, database):
|
||||
|
||||
''' Grab the first database encountered, by most recent.
|
||||
Will likely not work, but heck.
|
||||
''' Use UpdateLibrary(video) to update the date modified
|
||||
on the database file used by Kodi.
|
||||
'''
|
||||
if database == 'video':
|
||||
|
||||
xbmc.executebuiltin('UpdateLibrary(video)')
|
||||
xbmc.sleep(200)
|
||||
|
||||
databases = xbmc.translatePath("special://database/").decode('utf-8')
|
||||
types = {
|
||||
'video': "MyVideos",
|
||||
|
@ -99,6 +104,7 @@ class Database(object):
|
|||
modified = {'file': None, 'time': 0}
|
||||
|
||||
for file in reversed(files):
|
||||
|
||||
if (file.startswith(database) and not file.endswith('-wal') and
|
||||
not file.endswith('-shm') and not file.endswith('db-journal')):
|
||||
|
||||
|
@ -124,7 +130,7 @@ class Database(object):
|
|||
'''
|
||||
databases = obj.Objects().objects
|
||||
|
||||
if file not in ('video', 'music', 'texture') or databases.get('database_set%s' % file):
|
||||
if file not in ('video', 'music') or databases.get('database_set%s' % file):
|
||||
return self._get_database(databases[file], True)
|
||||
|
||||
discovered = self._discover_database(file) if not databases.get('database_set%s' % file) else None
|
||||
|
|
|
@ -53,7 +53,6 @@ class Service(xbmc.Monitor):
|
|||
self.settings['enable_context'] = settings('enableContext.bool')
|
||||
self.settings['enable_context_transcode'] = settings('enableContextTranscode.bool')
|
||||
self.settings['kodi_companion'] = settings('kodiCompanion.bool')
|
||||
self.settings['enable_db_discovery'] = settings('AskDiscoverDatabase.bool')
|
||||
window('emby_logLevel', value=str(self.settings['log_level']))
|
||||
window('emby_kodiProfile', value=self.settings['profile'])
|
||||
settings('platformDetected', client.get_platform())
|
||||
|
@ -453,14 +452,6 @@ class Service(xbmc.Monitor):
|
|||
self.settings['enable_context_transcode'] = settings('enableContextTranscode.bool')
|
||||
LOG.warn("New context transcode setting: %s", self.settings['enable_context_transcode'])
|
||||
|
||||
if settings('AskDiscoverDatabase.bool') != self.settings['enable_db_discovery']:
|
||||
LOG.warn(self.settings['enable_db_discovery'])
|
||||
self.settings['enable_db_discovery'] = settings('AskDiscoverDatabase.bool')
|
||||
LOG.warn("Enable database discovery: %s", self.settings['enable_db_discovery'])
|
||||
|
||||
if dialog("yesno", heading="{emby}", line1=_(33191)):
|
||||
window('emby.restart.bool', True)
|
||||
|
||||
if settings('useDirectPaths') != self.settings['mode'] and self.library_thread.started:
|
||||
|
||||
self.settings['mode'] = settings('useDirectPaths')
|
||||
|
|
|
@ -122,18 +122,7 @@ class Library(threading.Thread):
|
|||
'''
|
||||
with Database('video') as kodidb:
|
||||
with Database('music') as musicdb:
|
||||
|
||||
if kodidb.discovered or musicdb.discovered:
|
||||
if kodidb.discovered_file != settings('DiscoveredDatabase'):
|
||||
|
||||
LOG.info("Newly discovered database: %s", kodidb.path)
|
||||
settings('DiscoveredDatabase', kodidb.discovered_file)
|
||||
self.monitor.settings['enable_db_discovery'] = True
|
||||
settings('AskDiscoverDatabase.bool', True)
|
||||
|
||||
return False
|
||||
|
||||
return True
|
||||
pass
|
||||
|
||||
@stop()
|
||||
def service(self):
|
||||
|
@ -320,23 +309,7 @@ class Library(threading.Thread):
|
|||
Check databases.
|
||||
Check for the server plugin.
|
||||
'''
|
||||
if not self.test_databases():
|
||||
if settings('AskDiscoverDatabase.bool'):
|
||||
|
||||
self.monitor.settings['enable_db_discovery'] = False
|
||||
settings('AskDiscoverDatabase.bool', False)
|
||||
result = dialog("yesno", heading="{emby}", line1=_(33189))
|
||||
settings('DiscoverDatabase.bool', result == 1)
|
||||
|
||||
if not result:
|
||||
LOG.info("Do not discover database again.")
|
||||
|
||||
return False
|
||||
|
||||
elif not settings('DiscoverDatabase.bool'):
|
||||
LOG.info("Do not re-discover database again.")
|
||||
|
||||
return False
|
||||
self.test_databases()
|
||||
|
||||
Views().get_views()
|
||||
Views().get_nodes()
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
<setting label="30507" id="syncIndicator" type="number" default="999" visible="eq(-1,true)" subsetting="true"/>
|
||||
<setting label="33185" id="syncDuringPlay" type="bool" default="true" />
|
||||
<setting label="30536" id="dbSyncScreensaver" type="bool" default="true" />
|
||||
<setting label="33190" id="AskDiscoverDatabase" type="bool" default="true" />
|
||||
<setting label="33111" type="lsep" />
|
||||
<setting label="30511" id="useDirectPaths" type="enum" lvalues="33036|33037" default="1" />
|
||||
|
||||
|
|
Loading…
Reference in a new issue