Fix widgets not updating
This commit is contained in:
parent
484b03482e
commit
4ed17f1a5b
2 changed files with 18 additions and 8 deletions
|
@ -174,16 +174,16 @@ class KodiVideoDB(common.KodiDBBase):
|
||||||
def obsolete_file_ids(self):
|
def obsolete_file_ids(self):
|
||||||
"""
|
"""
|
||||||
Returns a generator for idFile of all Kodi file ids that do not have a
|
Returns a generator for idFile of all Kodi file ids that do not have a
|
||||||
dateAdded set (dateAdded NULL) and the filename start with
|
dateAdded set (dateAdded NULL) and the associated path entry has
|
||||||
'plugin://plugin.video.plexkodiconnect'
|
a field noUpdate of NULL as well as dateAdded of NULL
|
||||||
These entries should be deleted as they're created falsely by Kodi.
|
|
||||||
"""
|
"""
|
||||||
return (x[0] for x in self.cursor.execute("""
|
return (x[0] for x in self.cursor.execute("""
|
||||||
SELECT files.idFile
|
SELECT files.idFile
|
||||||
FROM files
|
FROM files
|
||||||
LEFT JOIN path ON path.idPath = files.idPath
|
LEFT JOIN path ON path.idPath = files.idPath
|
||||||
WHERE files.dateAdded IS NULL
|
WHERE files.dateAdded IS NULL
|
||||||
AND path.strPath LIKE \'%plex.direct%\'
|
AND path.noUpdate IS NULL
|
||||||
|
AND path.dateAdded IS NULL
|
||||||
"""))
|
"""))
|
||||||
|
|
||||||
def show_id_from_path(self, path):
|
def show_id_from_path(self, path):
|
||||||
|
|
|
@ -435,7 +435,7 @@ def _playback_cleanup(ended=False):
|
||||||
'{server}/video/:/transcode/universal/stop',
|
'{server}/video/:/transcode/universal/stop',
|
||||||
parameters={'session': v.PKC_MACHINE_IDENTIFIER})
|
parameters={'session': v.PKC_MACHINE_IDENTIFIER})
|
||||||
if status['plex_type'] in v.PLEX_VIDEOTYPES:
|
if status['plex_type'] in v.PLEX_VIDEOTYPES:
|
||||||
# Bookmarks might not be pickup up correctly, so let's do them
|
# Bookmarks are not be pickup up correctly, so let's do them
|
||||||
# manually. Applies to addon paths, but direct paths might have
|
# manually. Applies to addon paths, but direct paths might have
|
||||||
# started playback via PMS
|
# started playback via PMS
|
||||||
_record_playstate(status, ended)
|
_record_playstate(status, ended)
|
||||||
|
@ -503,13 +503,23 @@ def _record_playstate(status, ended):
|
||||||
totaltime,
|
totaltime,
|
||||||
playcount,
|
playcount,
|
||||||
last_played)
|
last_played)
|
||||||
|
# We might need to reconsider cleaning the file/path table in the future
|
||||||
|
# _clean_file_table()
|
||||||
|
# Update the current view to show e.g. an up-to-date progress bar and use
|
||||||
|
# the latest resume point info
|
||||||
|
if xbmc.getCondVisibility('Container.Content(musicvideos)'):
|
||||||
|
# Prevent cursor from moving
|
||||||
|
xbmc.executebuiltin('Container.Refresh')
|
||||||
|
else:
|
||||||
|
# Update widgets
|
||||||
|
xbmc.executebuiltin('UpdateLibrary(video)')
|
||||||
|
if xbmc.getCondVisibility('Window.IsMedia'):
|
||||||
|
xbmc.executebuiltin('Container.Refresh')
|
||||||
# Hack to force "in progress" widget to appear if it wasn't visible before
|
# Hack to force "in progress" widget to appear if it wasn't visible before
|
||||||
if (app.APP.force_reload_skin and
|
if (app.APP.force_reload_skin and
|
||||||
xbmc.getCondVisibility('Window.IsVisible(Home.xml)')):
|
xbmc.getCondVisibility('Window.IsVisible(Home.xml)')):
|
||||||
LOG.debug('Refreshing skin to update widgets')
|
LOG.debug('Refreshing skin to update widgets')
|
||||||
xbmc.executebuiltin('ReloadSkin()')
|
xbmc.executebuiltin('ReloadSkin()')
|
||||||
task = backgroundthread.FunctionAsTask(_clean_file_table, None)
|
|
||||||
backgroundthread.BGThreader.addTasksToFront([task])
|
|
||||||
|
|
||||||
|
|
||||||
def _clean_file_table():
|
def _clean_file_table():
|
||||||
|
@ -520,7 +530,7 @@ def _clean_file_table():
|
||||||
This function tries for at most 5 seconds to clean the file table.
|
This function tries for at most 5 seconds to clean the file table.
|
||||||
"""
|
"""
|
||||||
LOG.debug('Start cleaning Kodi files table')
|
LOG.debug('Start cleaning Kodi files table')
|
||||||
app.APP.monitor.waitForAbort(1)
|
# app.APP.monitor.waitForAbort(1)
|
||||||
try:
|
try:
|
||||||
with kodi_db.KodiVideoDB() as kodidb:
|
with kodi_db.KodiVideoDB() as kodidb:
|
||||||
file_ids = list(kodidb.obsolete_file_ids())
|
file_ids = list(kodidb.obsolete_file_ids())
|
||||||
|
|
Loading…
Reference in a new issue