From 10318e0984c6e454d71317b4a8dbd37c42a5a565 Mon Sep 17 00:00:00 2001
From: shaun <shaun@bluebit.com.au>
Date: Sun, 16 Oct 2016 11:12:57 +1100
Subject: [PATCH] set lang, only set screen res if full screen

---
 addon.xml                  |  2 +-
 resources/lib/ga_client.py | 14 ++++++++++----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/addon.xml b/addon.xml
index e5c54fbd..b9c8e2ab 100644
--- a/addon.xml
+++ b/addon.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <addon  id="plugin.video.emby"
         name="Emby" 
-        version="2.2.48"
+        version="2.2.49"
         provider-name="Emby.media">
   <requires>
     <import addon="xbmc.python" version="2.19.0"/>
diff --git a/resources/lib/ga_client.py b/resources/lib/ga_client.py
index 6bd8285e..3cf11cf4 100644
--- a/resources/lib/ga_client.py
+++ b/resources/lib/ga_client.py
@@ -34,8 +34,11 @@ class GoogleAnalytics():
         self.user_name = md5.new(self.user_name).hexdigest()
         
         # resolution
-        self.height = xbmcgui.Window(10000).getHeight()
-        self.width = xbmcgui.Window(10000).getWidth()        
+        self.screen_mode = xbmc.getInfoLabel("System.ScreenMode")
+        self.screen_height = xbmc.getInfoLabel("System.ScreenHeight")
+        self.screen_width = xbmc.getInfoLabel("System.ScreenWidth")
+
+        self.lang = xbmc.getInfoLabel("System.Language")
     
     def getUserAgentOS(self):
     
@@ -101,8 +104,11 @@ class GoogleAnalytics():
         data['ec'] = eventCategory # Event Category
         data['ea'] = eventAction # Event Action
         
-        # add width and height
-        data['sr'] = str(self.width) + "x" + str(self.height)
+        # add width and height, only add if full screen
+        if(self.screen_mode.lower().find("window") == -1):
+            data['sr'] = str(self.screen_width) + "x" + str(self.screen_height)
+        
+        data["ul"] = self.lang
 
         if(eventLabel != None):
             data['el'] = eventLabel # Event Label