mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 02:06:09 +00:00
add screen app size to GA
only ping GA if playing dont send an app stopped message
This commit is contained in:
parent
9360843988
commit
ab33ef5848
4 changed files with 21 additions and 10 deletions
|
@ -5,6 +5,7 @@ import requests
|
|||
import logging
|
||||
import clientinfo
|
||||
import md5
|
||||
import xbmcgui
|
||||
from utils import window, settings, language as lang
|
||||
|
||||
log = logging.getLogger("EMBY."+__name__)
|
||||
|
@ -29,6 +30,10 @@ class GoogleAnalytics():
|
|||
# use md5 for client and user for analytics
|
||||
self.device_id = md5.new(self.device_id).hexdigest()
|
||||
self.user_name = md5.new(self.user_name).hexdigest()
|
||||
|
||||
# resolution
|
||||
self.height = xbmcgui.Window(10000).getHeight()
|
||||
self.width = xbmcgui.Window(10000).getWidth()
|
||||
|
||||
def formatException(self):
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
|
@ -76,6 +81,9 @@ class GoogleAnalytics():
|
|||
data['t'] = 'event' # action type
|
||||
data['ec'] = eventCategory # Event Category
|
||||
data['ea'] = eventAction # Event Action
|
||||
|
||||
# add width and height
|
||||
data['sr'] = str(self.width) + "x" + str(self.height)
|
||||
|
||||
if(eventLabel != None):
|
||||
data['el'] = eventLabel # Event Label
|
||||
|
|
|
@ -81,9 +81,6 @@ class LibrarySync(threading.Thread):
|
|||
|
||||
# Run at start up - optional to use the server plugin
|
||||
if settings('SyncInstallRunDone') == "true":
|
||||
|
||||
ga.sendEventData("SyncAction", "FastSync")
|
||||
|
||||
# Validate views
|
||||
self.refreshViews()
|
||||
completed = False
|
||||
|
@ -97,11 +94,13 @@ class LibrarySync(threading.Thread):
|
|||
if plugin['Name'] == "Emby.Kodi Sync Queue":
|
||||
log.debug("Found server plugin.")
|
||||
self.isFastSync = True
|
||||
ga.sendEventData("SyncAction", "FastSync")
|
||||
completed = self.fastSync()
|
||||
break
|
||||
|
||||
if not completed:
|
||||
# Fast sync failed or server plugin is not found
|
||||
ga.sendEventData("SyncAction", "Sync")
|
||||
completed = ManualSync().sync()
|
||||
else:
|
||||
# Install sync is not completed
|
||||
|
|
|
@ -476,6 +476,9 @@ class Player(xbmc.Player):
|
|||
xbmcvfs.delete("%s%s" % (path, file))
|
||||
|
||||
self.played_info.clear()
|
||||
|
||||
ga = GoogleAnalytics()
|
||||
ga.sendEventData("PlayAction", "Stopped")
|
||||
|
||||
def stopPlayback(self, data):
|
||||
|
||||
|
|
|
@ -140,13 +140,14 @@ class Service(object):
|
|||
# or Kodi is shut down.
|
||||
self._server_online_check()
|
||||
|
||||
# ping metrics server to keep sessions alive
|
||||
# ping every 3 min
|
||||
# ping metrics server to keep sessions alive while playing
|
||||
# ping every 5 min
|
||||
timeSinceLastPing = time.time() - self.lastMetricPing
|
||||
if(timeSinceLastPing > 180):
|
||||
if(timeSinceLastPing > 300):
|
||||
self.lastMetricPing = time.time()
|
||||
ga = GoogleAnalytics()
|
||||
ga.sendEventData("Application", "Ping")
|
||||
if self.kodi_player.isPlaying():
|
||||
ga = GoogleAnalytics()
|
||||
ga.sendEventData("PlayAction", "PlayPing")
|
||||
|
||||
if self.monitor.waitForAbort(1):
|
||||
# Abort was requested while waiting. We should exit
|
||||
|
@ -297,8 +298,8 @@ class Service(object):
|
|||
|
||||
def shutdown(self):
|
||||
|
||||
ga = GoogleAnalytics()
|
||||
ga.sendEventData("Application", "Shutdown")
|
||||
#ga = GoogleAnalytics()
|
||||
#ga.sendEventData("Application", "Shutdown")
|
||||
|
||||
if self.userclient_running:
|
||||
self.userclient_thread.stop_client()
|
||||
|
|
Loading…
Reference in a new issue