Prevent screensaver during sync

Initial, repair, manual syncs.
This commit is contained in:
angelblue05 2016-03-02 18:25:17 -06:00
parent 405cecfec7
commit 2a107b45fe
2 changed files with 41 additions and 0 deletions

View file

@ -229,6 +229,8 @@ class LibrarySync(threading.Thread):
music_enabled = utils.settings('enableMusic') == "true"
xbmc.executebuiltin('InhibitIdleShutdown(true)')
screensaver = utils.getScreensaver()
utils.setScreensaver(value="")
window('emby_dbScan', value="true")
# Add sources
utils.sourcesXML()
@ -280,6 +282,7 @@ class LibrarySync(threading.Thread):
completed = process[itemtype](embycursor, kodicursor, pDialog)
if not completed:
xbmc.executebuiltin('InhibitIdleShutdown(false)')
utils.setScreensaver(value=screensaver)
window('emby_dbScan', clear=True)
if pDialog:
pDialog.close()
@ -307,6 +310,7 @@ class LibrarySync(threading.Thread):
completed = self.music(embycursor, musiccursor, pDialog)
if not completed:
xbmc.executebuiltin('InhibitIdleShutdown(false)')
utils.setScreensaver(value=screensaver)
window('emby_dbScan', clear=True)
if pDialog:
pDialog.close()
@ -334,6 +338,7 @@ class LibrarySync(threading.Thread):
elapsedtotal = datetime.now() - starttotal
xbmc.executebuiltin('InhibitIdleShutdown(false)')
utils.setScreensaver(value=screensaver)
window('emby_dbScan', clear=True)
window('emby_initialScan', clear=True)
if forceddialog:
@ -453,6 +458,7 @@ class LibrarySync(threading.Thread):
else:
# Unable to find a match, add the name to our sorted_view list
sorted_views.append(foldername)
log("Couldn't find corresponding grouped view: %s" % sorted_views, 1)
# Get current media folders from emby database
view = emby_db.getView_byId(folderid)

View file

@ -4,6 +4,7 @@
import cProfile
import inspect
import json
import pstats
import sqlite3
import os
@ -119,6 +120,40 @@ def getKodiMusicDBPath():
% dbVersion.get(kodibuild, "")).decode('utf-8')
return dbPath
def getScreensaver():
# Get the current screensaver value
query = {
'jsonrpc': "2.0",
'id': 0,
'method': "Settings.getSettingValue",
'params': {
'setting': "screensaver.mode"
}
}
result = xbmc.executeJSONRPC(json.dumps(query))
result = json.loads(result)
screensaver = result['result']['value']
return screensaver
def setScreensaver(value):
# Toggle the screensaver
query = {
'jsonrpc': "2.0",
'id': 0,
'method': "Settings.setSettingValue",
'params': {
'setting': "screensaver.mode",
'value': value
}
}
result = xbmc.executeJSONRPC(json.dumps(query))
logMsg("EMBY", "Toggling screensaver: %s %s" % (value, result), 1)
def reset():
dialog = xbmcgui.Dialog()