From d5d63263a9c55a4415b372bc6d08d43123fb3ebf Mon Sep 17 00:00:00 2001
From: sfaulds <sfaulds@connexity.com>
Date: Mon, 10 Oct 2016 09:50:53 +1100
Subject: [PATCH] add metric collection to play actions

---
 resources/lib/player.py | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)

diff --git a/resources/lib/player.py b/resources/lib/player.py
index 29db956f..f7e0c13a 100644
--- a/resources/lib/player.py
+++ b/resources/lib/player.py
@@ -14,6 +14,7 @@ import downloadutils
 import kodidb_functions as kodidb
 import websocket_client as wsc
 from utils import window, settings, language as lang
+from ga_client import GoogleAnalytics
 
 #################################################################################################
 
@@ -28,7 +29,6 @@ class Player(xbmc.Player):
     _shared_state = {}
 
     played_info = {}
-    playStats = {}
     currentFile = None
 
 
@@ -44,10 +44,6 @@ class Player(xbmc.Player):
         log.debug("Starting playback monitor.")
         xbmc.Player.__init__(self)
 
-
-    def GetPlayStats(self):
-        return self.playStats
-
     def onPlayBackStarted(self):
         # Will be called when xbmc starts playing a file
         self.stopAll()
@@ -233,20 +229,8 @@ class Player(xbmc.Player):
                 self.played_info[currentFile] = data
                 log.info("ADDING_FILE: %s" % self.played_info)
 
-                # log some playback stats
-                '''if(itemType != None):
-                    if(self.playStats.get(itemType) != None):
-                        count = self.playStats.get(itemType) + 1
-                        self.playStats[itemType] = count
-                    else:
-                        self.playStats[itemType] = 1
-                        
-                if(playMethod != None):
-                    if(self.playStats.get(playMethod) != None):
-                        count = self.playStats.get(playMethod) + 1
-                        self.playStats[playMethod] = count
-                    else:
-                        self.playStats[playMethod] = 1'''
+                ga = GoogleAnalytics()
+                ga.sendEventData("PlayAction", itemType, playMethod)
 
     def reportPlayback(self):