Safety net for cleaning Kodi file table
This commit is contained in:
parent
3e754dfd1b
commit
fb364a2275
1 changed files with 10 additions and 6 deletions
|
@ -524,9 +524,13 @@ def _clean_file_table():
|
||||||
"""
|
"""
|
||||||
LOG.debug('Start cleaning Kodi files table')
|
LOG.debug('Start cleaning Kodi files table')
|
||||||
app.APP.monitor.waitForAbort(2)
|
app.APP.monitor.waitForAbort(2)
|
||||||
|
try:
|
||||||
with kodi_db.KodiVideoDB() as kodidb_1:
|
with kodi_db.KodiVideoDB() as kodidb_1:
|
||||||
with kodi_db.KodiVideoDB() as kodidb_2:
|
with kodi_db.KodiVideoDB() as kodidb_2:
|
||||||
for file_id in kodidb_1.obsolete_file_ids():
|
for file_id in kodidb_1.obsolete_file_ids():
|
||||||
LOG.debug('Removing obsolete Kodi file_id %s', file_id)
|
LOG.debug('Removing obsolete Kodi file_id %s', file_id)
|
||||||
kodidb_2.remove_file(file_id, remove_orphans=False)
|
kodidb_2.remove_file(file_id, remove_orphans=False)
|
||||||
|
except utils.OperationalError:
|
||||||
|
LOG.debug('Database was locked, unable to clean file table')
|
||||||
|
else:
|
||||||
LOG.debug('Done cleaning up Kodi file table')
|
LOG.debug('Done cleaning up Kodi file table')
|
||||||
|
|
Loading…
Reference in a new issue