mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 02:06:09 +00:00
add back in the service monitor watchdog
This commit is contained in:
parent
0923b649e7
commit
a3b500061a
2 changed files with 35 additions and 4 deletions
|
@ -7,7 +7,7 @@ import os, sys
|
||||||
import threading
|
import threading
|
||||||
import json
|
import json
|
||||||
import urllib
|
import urllib
|
||||||
|
import time
|
||||||
|
|
||||||
WINDOW = xbmcgui.Window(10000)
|
WINDOW = xbmcgui.Window(10000)
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ from API import API
|
||||||
|
|
||||||
##### Play items via plugin://plugin.video.emby/ #####
|
##### Play items via plugin://plugin.video.emby/ #####
|
||||||
def doPlayback(id):
|
def doPlayback(id):
|
||||||
|
checkService()
|
||||||
url = "{server}/mediabrowser/Users/{UserId}/Items/%s?format=json&ImageTypeLimit=1" % id
|
url = "{server}/mediabrowser/Users/{UserId}/Items/%s?format=json&ImageTypeLimit=1" % id
|
||||||
result = DownloadUtils().downloadUrl(url)
|
result = DownloadUtils().downloadUrl(url)
|
||||||
item = PlaybackUtils().PLAY(result, setup="default")
|
item = PlaybackUtils().PLAY(result, setup="default")
|
||||||
|
@ -483,3 +484,30 @@ def doMainListing():
|
||||||
|
|
||||||
xbmcplugin.endOfDirectory(int(sys.argv[1]))
|
xbmcplugin.endOfDirectory(int(sys.argv[1]))
|
||||||
|
|
||||||
|
def checkService():
|
||||||
|
|
||||||
|
timeStamp = xbmcgui.Window(10000).getProperty("Emby_Service_Timestamp")
|
||||||
|
loops = 0
|
||||||
|
monitor = xbmc.Monitor()
|
||||||
|
while(timeStamp == ""):
|
||||||
|
timeStamp = xbmcgui.Window(10000).getProperty("Emby_Service_Timestamp")
|
||||||
|
loops = loops + 1
|
||||||
|
if(loops == 5):
|
||||||
|
xbmc.log("Emby Service Not Running, no time stamp, exiting")
|
||||||
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
|
language = addon.getLocalizedString
|
||||||
|
xbmcgui.Dialog().ok(language(30135), language(30136), language(30137))
|
||||||
|
sys.exit()
|
||||||
|
if monitor.waitForAbort(1):
|
||||||
|
# Abort was requested while waiting. We should exit
|
||||||
|
return
|
||||||
|
|
||||||
|
xbmc.log("Emby Service Timestamp: " + timeStamp)
|
||||||
|
xbmc.log("Emby Current Timestamp: " + str(int(time.time())))
|
||||||
|
|
||||||
|
if((int(timeStamp) + 30) < int(time.time())):
|
||||||
|
xbmc.log("Emby Service Not Running, time stamp to old, exiting")
|
||||||
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
|
language = addon.getLocalizedString
|
||||||
|
xbmcgui.Dialog().ok(language(30135), language(30136), language(30137))
|
||||||
|
sys.exit()
|
||||||
|
|
|
@ -5,6 +5,7 @@ import os
|
||||||
import threading
|
import threading
|
||||||
import json
|
import json
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
import time
|
||||||
|
|
||||||
cwd = xbmcaddon.Addon(id='plugin.video.emby').getAddonInfo('path')
|
cwd = xbmcaddon.Addon(id='plugin.video.emby').getAddonInfo('path')
|
||||||
BASE_RESOURCE_PATH = xbmc.translatePath( os.path.join( cwd, 'resources', 'lib' ) )
|
BASE_RESOURCE_PATH = xbmc.translatePath( os.path.join( cwd, 'resources', 'lib' ) )
|
||||||
|
@ -66,6 +67,7 @@ class Service():
|
||||||
|
|
||||||
WINDOW = self.WINDOW
|
WINDOW = self.WINDOW
|
||||||
WINDOW.setProperty("Server_online", "")
|
WINDOW.setProperty("Server_online", "")
|
||||||
|
WINDOW.setProperty("Emby_Service_Timestamp", str(int(time.time())))
|
||||||
|
|
||||||
ConnectionManager().checkServer()
|
ConnectionManager().checkServer()
|
||||||
lastProgressUpdate = datetime.today()
|
lastProgressUpdate = datetime.today()
|
||||||
|
@ -78,6 +80,7 @@ class Service():
|
||||||
lastFile = None
|
lastFile = None
|
||||||
|
|
||||||
while not self.KodiMonitor.abortRequested():
|
while not self.KodiMonitor.abortRequested():
|
||||||
|
WINDOW.setProperty("Emby_Service_Timestamp", str(int(time.time())))
|
||||||
|
|
||||||
if self.KodiMonitor.waitForAbort(1):
|
if self.KodiMonitor.waitForAbort(1):
|
||||||
# Abort was requested while waiting. We should exit
|
# Abort was requested while waiting. We should exit
|
||||||
|
|
Loading…
Reference in a new issue