Monitor for DB file path change

This commit is contained in:
croneter 2018-02-20 18:02:34 +01:00
parent 0173129ffc
commit aac22c3369
2 changed files with 22 additions and 1 deletions

View File

@ -44,6 +44,20 @@ class Kodidb_Functions():
self.cursor = cursor
self.artwork = artwork.Artwork()
def check_path(self):
query = ' '.join((
"SELECT idPath",
"FROM path",
"WHERE strPath = ?"
))
self.cursor.execute(query, ('smb://TOMSNAS/PlexMovies/',))
try:
pathid = self.cursor.fetchone()[0]
except TypeError:
pathid = None
return pathid
def setup_path_table(self):
"""
Use with Kodi video DB

View File

@ -15,6 +15,7 @@ from plexbmchelper.subscribers import LOCK
from playback import play_xml
import json_rpc as js
import variables as v
import kodidb_functions as kodidb
###############################################################################
LOG = getLogger("PLEX." + __name__)
@ -218,6 +219,7 @@ class PlayqueueMonitor(Thread):
stopped = self.stopped
suspended = self.suspended
LOG.info("----===## Starting PlayqueueMonitor ##===----")
tested = False
while not stopped():
while suspended():
if stopped():
@ -230,5 +232,10 @@ class PlayqueueMonitor(Thread):
# compare old and new playqueue
self._compare_playqueues(playqueue, kodi_pl)
playqueue.old_kodi_pl = list(kodi_pl)
sleep(200)
with kodidb.GetKodiDB('video') as kodi_db:
# Setup the paths for addon-paths (even when using direct paths)
if kodi_db.check_path() and not tested:
tested = True
LOG.error('NOW!')
sleep(50)
LOG.info("----===## PlayqueueMonitor stopped ##===----")