mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Ping server session every 4min30
To keep the session alive under active player
This commit is contained in:
parent
fc308b95a5
commit
d3840ed27b
1 changed files with 5 additions and 15 deletions
|
@ -46,7 +46,6 @@ class Service(object):
|
||||||
library_thread = None
|
library_thread = None
|
||||||
|
|
||||||
last_progress = datetime.today()
|
last_progress = datetime.today()
|
||||||
lastMetricPing = time.time()
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
|
@ -129,6 +128,9 @@ class Service(object):
|
||||||
# Verify if user is set and has access to the server
|
# Verify if user is set and has access to the server
|
||||||
if user_client.get_user() is not None and user_client.get_access():
|
if user_client.get_user() is not None and user_client.get_access():
|
||||||
|
|
||||||
|
if self.kodi_player.isPlaying():
|
||||||
|
self._report_progress()
|
||||||
|
|
||||||
# If an item is playing
|
# If an item is playing
|
||||||
if not self.startup:
|
if not self.startup:
|
||||||
self.startup = self._startup()
|
self.startup = self._startup()
|
||||||
|
@ -278,7 +280,6 @@ class Service(object):
|
||||||
# Abort was requested while waiting. We should exit
|
# Abort was requested while waiting. We should exit
|
||||||
break
|
break
|
||||||
|
|
||||||
"""
|
|
||||||
def _report_progress(self):
|
def _report_progress(self):
|
||||||
# Update and report playback progress
|
# Update and report playback progress
|
||||||
kodi_player = self.kodi_player
|
kodi_player = self.kodi_player
|
||||||
|
@ -292,27 +293,16 @@ class Service(object):
|
||||||
difference = datetime.today() - self.last_progress
|
difference = datetime.today() - self.last_progress
|
||||||
difference_seconds = difference.seconds
|
difference_seconds = difference.seconds
|
||||||
|
|
||||||
# Report progress to Emby server
|
# Ping session every 4-5 minutes
|
||||||
if difference_seconds > 9:
|
if difference_seconds > 270:
|
||||||
kodi_player.reportPlayback()
|
|
||||||
self.last_progress = datetime.today()
|
|
||||||
|
|
||||||
elif window('emby_command') == "true":
|
|
||||||
# Received a remote control command that
|
|
||||||
# requires updating immediately
|
|
||||||
window('emby_command', clear=True)
|
|
||||||
kodi_player.reportPlayback()
|
kodi_player.reportPlayback()
|
||||||
self.last_progress = datetime.today()
|
self.last_progress = datetime.today()
|
||||||
|
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
log.exception(error)
|
log.exception(error)
|
||||||
"""
|
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
|
|
||||||
#ga = GoogleAnalytics()
|
|
||||||
#ga.sendEventData("Application", "Shutdown")
|
|
||||||
|
|
||||||
if self.monitor.special_monitor:
|
if self.monitor.special_monitor:
|
||||||
self.monitor.special_monitor.stop_monitor()
|
self.monitor.special_monitor.stop_monitor()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue