Remove GA

This commit is contained in:
angelblue05 2018-05-12 22:56:53 -05:00
parent 9ecd546ce6
commit e50780bd37
9 changed files with 42 additions and 24 deletions

View file

@ -23,7 +23,7 @@ sys.path.append(_BASE_LIB)
import entrypoint import entrypoint
import loghandler import loghandler
from utils import window, dialog, language as lang from utils import window, dialog, language as lang
from ga_client import GoogleAnalytics #from ga_client import GoogleAnalytics
import database import database
################################################################################################# #################################################################################################
@ -178,10 +178,12 @@ if __name__ == "__main__":
try: try:
Main() Main()
except Exception as error: except Exception as error:
"""
if not (hasattr(error, 'quiet') and error.quiet): if not (hasattr(error, 'quiet') and error.quiet):
ga = GoogleAnalytics() ga = GoogleAnalytics()
errStrings = ga.formatException() errStrings = ga.formatException()
ga.sendEventData("Exception", errStrings[0], errStrings[1]) ga.sendEventData("Exception", errStrings[0], errStrings[1])
"""
log.exception(error) log.exception(error)
raise raise

View file

@ -12,7 +12,7 @@ import clientinfo
import read_embyserver as embyserver import read_embyserver as embyserver
import connect.connectionmanager as connectionmanager import connect.connectionmanager as connectionmanager
from dialogs import ServerConnect, UsersConnect, LoginConnect, LoginManual, ServerManual from dialogs import ServerConnect, UsersConnect, LoginConnect, LoginManual, ServerManual
from ga_client import GoogleAnalytics #from ga_client import GoogleAnalytics
from utils import window from utils import window
################################################################################################## ##################################################################################################
@ -144,8 +144,10 @@ class ConnectManager(object):
def login(self, server=None): def login(self, server=None):
"""
ga = GoogleAnalytics() ga = GoogleAnalytics()
ga.sendEventData("Connect", "UserLogin") ga.sendEventData("Connect", "UserLogin")
"""
# Return user or raise error # Return user or raise error
server = server or self.state['Servers'][0] server = server or self.state['Servers'][0]

View file

@ -13,7 +13,7 @@ import downloadutils
import embydb_functions as embydb import embydb_functions as embydb
import playbackutils as pbutils import playbackutils as pbutils
from utils import window, settings, create_id from utils import window, settings, create_id
from ga_client import log_error #from ga_client import log_error
from database import DatabaseConn from database import DatabaseConn
################################################################################################# #################################################################################################
@ -68,7 +68,7 @@ class KodiMonitor(xbmc.Monitor):
log.info("New context transcode setting: %s", current_context) log.info("New context transcode setting: %s", current_context)
window('emby_context_transcode', value=current_context) window('emby_context_transcode', value=current_context)
@log_error() #@log_error()
def onNotification(self, sender, method, data): def onNotification(self, sender, method, data):
if method not in ('Playlist.OnAdd', 'Player.OnStop', 'Player.OnClear'): if method not in ('Playlist.OnAdd', 'Player.OnStop', 'Player.OnClear'):

View file

@ -24,7 +24,7 @@ import userclient
import views import views
from objects import Movies, MusicVideos, TVShows, Music from objects import Movies, MusicVideos, TVShows, Music
from utils import window, settings, language as lang, should_stop from utils import window, settings, language as lang, should_stop
from ga_client import GoogleAnalytics #from ga_client import GoogleAnalytics
################################################################################################## ##################################################################################################
@ -77,7 +77,7 @@ class LibrarySync(threading.Thread):
def startSync(self): def startSync(self):
ga = GoogleAnalytics() #ga = GoogleAnalytics()
# Run at start up - optional to use the server plugin # Run at start up - optional to use the server plugin
if settings('SyncInstallRunDone') == "true": if settings('SyncInstallRunDone') == "true":
@ -99,17 +99,17 @@ class LibrarySync(threading.Thread):
if plugin['Name'] in ("Emby.Kodi Sync Queue", "Kodi companion"): if plugin['Name'] in ("Emby.Kodi Sync Queue", "Kodi companion"):
log.debug("Found server plugin.") log.debug("Found server plugin.")
self.isFastSync = True self.isFastSync = True
ga.sendEventData("SyncAction", "FastSync") #ga.sendEventData("SyncAction", "FastSync")
completed = self.fastSync() completed = self.fastSync()
break break
if not completed: if not completed:
# Fast sync failed or server plugin is not found # Fast sync failed or server plugin is not found
ga.sendEventData("SyncAction", "Sync") #ga.sendEventData("SyncAction", "Sync")
completed = ManualSync().sync() completed = ManualSync().sync()
else: else:
# Install sync is not completed # Install sync is not completed
ga.sendEventData("SyncAction", "FullSync") #ga.sendEventData("SyncAction", "FullSync")
completed = self.fullSync() completed = self.fullSync()
return completed return completed
@ -648,10 +648,12 @@ class LibrarySync(threading.Thread):
elif "401" in e: elif "401" in e:
pass pass
except Exception as e: except Exception as e:
"""
ga = GoogleAnalytics() ga = GoogleAnalytics()
errStrings = ga.formatException() errStrings = ga.formatException()
if not (hasattr(e, 'quiet') and e.quiet): if not (hasattr(e, 'quiet') and e.quiet):
ga.sendEventData("Exception", errStrings[0], errStrings[1]) ga.sendEventData("Exception", errStrings[0], errStrings[1])
"""
window('emby_dbScan', clear=True) window('emby_dbScan', clear=True)
log.exception(e) log.exception(e)
xbmcgui.Dialog().ok( xbmcgui.Dialog().ok(
@ -659,8 +661,8 @@ class LibrarySync(threading.Thread):
line1=( line1=(
"Library sync thread has exited! " "Library sync thread has exited! "
"You should restart Kodi now. " "You should restart Kodi now. "
"Please report this on the forum."), "Please report this on the forum."))
line2=(errStrings[0] + " (" + errStrings[1] + ")")) #line2=(errStrings[0] + " (" + errStrings[1] + ")"))
def run_internal(self): def run_internal(self):

View file

@ -13,13 +13,13 @@ import api
import artwork import artwork
import downloadutils import downloadutils
import read_embyserver as embyserver import read_embyserver as embyserver
from ga_client import GoogleAnalytics #from ga_client import GoogleAnalytics
from utils import window, settings, dialog, language as lang, should_stop from utils import window, settings, dialog, language as lang, should_stop
################################################################################################## ##################################################################################################
log = logging.getLogger("EMBY."+__name__) log = logging.getLogger("EMBY."+__name__)
ga = GoogleAnalytics() #ga = GoogleAnalytics()
################################################################################################## ##################################################################################################
@ -32,9 +32,11 @@ def catch_except(errors=(Exception, ), default_value=False):
except sqlite3.Error as error: except sqlite3.Error as error:
raise raise
except errors as error: except errors as error:
"""
if not (hasattr(error, 'quiet') and error.quiet): if not (hasattr(error, 'quiet') and error.quiet):
errStrings = ga.formatException() errStrings = ga.formatException()
ga.sendEventData("Exception", errStrings[0], errStrings[1], True) ga.sendEventData("Exception", errStrings[0], errStrings[1], True)
"""
log.exception(error) log.exception(error)
log.error("function: %s \n args: %s \n kwargs: %s", log.error("function: %s \n args: %s \n kwargs: %s",
func.__name__, args, kwargs) func.__name__, args, kwargs)

View file

@ -14,7 +14,7 @@ import downloadutils
import read_embyserver as embyserver import read_embyserver as embyserver
import websocket_client as wsc import websocket_client as wsc
from utils import window, settings, language as lang, JSONRPC from utils import window, settings, language as lang, JSONRPC
from ga_client import GoogleAnalytics, log_error #from ga_client import GoogleAnalytics, log_error
################################################################################################# #################################################################################################
@ -78,7 +78,7 @@ class Player(xbmc.Player):
audio_tracks = len(player.getAvailableAudioStreams()) audio_tracks = len(player.getAvailableAudioStreams())
player.setSubtitleStream(subs_index - audio_tracks - 1) player.setSubtitleStream(subs_index - audio_tracks - 1)
@log_error() #@log_error()
def onPlayBackStarted(self): def onPlayBackStarted(self):
# Will be called when xbmc starts playing a file # Will be called when xbmc starts playing a file
self.stopAll() self.stopAll()
@ -271,9 +271,11 @@ class Player(xbmc.Player):
self.played_info[currentFile] = data self.played_info[currentFile] = data
log.info("ADDING_FILE: %s", self.played_info) log.info("ADDING_FILE: %s", self.played_info)
"""
ga = GoogleAnalytics() ga = GoogleAnalytics()
ga.sendEventData("PlayAction", item_type, play_method) ga.sendEventData("PlayAction", item_type, play_method)
ga.sendScreenView(item_type) ga.sendScreenView(item_type)
"""
def reportPlayback(self): def reportPlayback(self):
@ -381,7 +383,7 @@ class Player(xbmc.Player):
log.debug("Report: %s", postdata) log.debug("Report: %s", postdata)
self.emby.progress_report(postdata) self.emby.progress_report(postdata)
@log_error() #@log_error()
def onPlayBackPaused(self): def onPlayBackPaused(self):
currentFile = self.currentFile currentFile = self.currentFile
@ -392,7 +394,7 @@ class Player(xbmc.Player):
self.reportPlayback() self.reportPlayback()
@log_error() #@log_error()
def onPlayBackResumed(self): def onPlayBackResumed(self):
currentFile = self.currentFile currentFile = self.currentFile
@ -403,7 +405,7 @@ class Player(xbmc.Player):
self.reportPlayback() self.reportPlayback()
@log_error() #@log_error()
def onPlayBackSeek(self, time, seekOffset): def onPlayBackSeek(self, time, seekOffset):
# Make position when seeking a bit more accurate # Make position when seeking a bit more accurate
currentFile = self.currentFile currentFile = self.currentFile
@ -420,14 +422,14 @@ class Player(xbmc.Player):
self.played_info[currentFile]['currentPosition'] = position self.played_info[currentFile]['currentPosition'] = position
self.reportPlayback() self.reportPlayback()
@log_error() #@log_error()
def onPlayBackStopped(self): def onPlayBackStopped(self):
# Will be called when user stops xbmc playing a file # Will be called when user stops xbmc playing a file
log.debug("ONPLAYBACK_STOPPED") log.debug("ONPLAYBACK_STOPPED")
window('emby_customPlaylist.seektime', clear=True) window('emby_customPlaylist.seektime', clear=True)
self.stopAll() self.stopAll()
@log_error() #@log_error()
def onPlayBackEnded(self): def onPlayBackEnded(self):
# Will be called when xbmc stops playing a file # Will be called when xbmc stops playing a file
log.debug("ONPLAYBACK_ENDED") log.debug("ONPLAYBACK_ENDED")
@ -522,8 +524,10 @@ class Player(xbmc.Player):
self.played_info.clear() self.played_info.clear()
"""
ga = GoogleAnalytics() ga = GoogleAnalytics()
ga.sendEventData("PlayAction", "Stopped") ga.sendEventData("PlayAction", "Stopped")
"""
def stop_playback(self, data): def stop_playback(self, data):

View file

@ -21,7 +21,7 @@ import player
import websocket_client as wsc import websocket_client as wsc
from views import VideoNodes from views import VideoNodes
from utils import window, settings, dialog, language as lang from utils import window, settings, dialog, language as lang
from ga_client import GoogleAnalytics #from ga_client import GoogleAnalytics
import hashlib import hashlib
################################################################################################# #################################################################################################
@ -136,8 +136,10 @@ class Service(object):
timeSinceLastPing = time.time() - self.lastMetricPing timeSinceLastPing = time.time() - self.lastMetricPing
if(timeSinceLastPing > 300): if(timeSinceLastPing > 300):
self.lastMetricPing = time.time() self.lastMetricPing = time.time()
"""
ga = GoogleAnalytics() ga = GoogleAnalytics()
ga.sendEventData("PlayAction", "PlayPing") ga.sendEventData("PlayAction", "PlayPing")
"""
self._report_progress() self._report_progress()
@ -184,6 +186,7 @@ class Service(object):
if(serverId != None): if(serverId != None):
serverId = hashlib.md5(serverId).hexdigest() serverId = hashlib.md5(serverId).hexdigest()
"""
ga = GoogleAnalytics() ga = GoogleAnalytics()
ga.sendEventData("Application", "Startup", serverId) ga.sendEventData("Application", "Startup", serverId)
try: try:
@ -191,6 +194,7 @@ class Service(object):
ga.sendEventData("Version", "Python", platform.python_version()) ga.sendEventData("Version", "Python", platform.python_version())
except Exception: except Exception:
pass pass
"""
# Start up events # Start up events
self.warn_auth = True self.warn_auth = True

View file

@ -16,7 +16,7 @@ import playlist
import userclient import userclient
import playbackutils import playbackutils
from utils import window, settings, dialog, language as lang, JSONRPC from utils import window, settings, dialog, language as lang, JSONRPC
from ga_client import log_error #from ga_client import log_error
################################################################################################## ##################################################################################################
@ -45,7 +45,7 @@ class WebSocketClient(threading.Thread):
threading.Thread.__init__(self) threading.Thread.__init__(self)
@log_error() #@log_error()
def on_message(self, ws, message): def on_message(self, ws, message):
result = json.loads(message) result = json.loads(message)

View file

@ -21,7 +21,7 @@ sys.path.append(_BASE_LIB)
import loghandler import loghandler
from service_entry import Service from service_entry import Service
from utils import settings from utils import settings
from ga_client import GoogleAnalytics #from ga_client import GoogleAnalytics
################################################################################################# #################################################################################################
@ -46,10 +46,12 @@ if __name__ == "__main__":
service.service_entry_point() service.service_entry_point()
except Exception as error: except Exception as error:
"""
if not (hasattr(error, 'quiet') and error.quiet): if not (hasattr(error, 'quiet') and error.quiet):
ga = GoogleAnalytics() ga = GoogleAnalytics()
errStrings = ga.formatException() errStrings = ga.formatException()
ga.sendEventData("Exception", errStrings[0], errStrings[1]) ga.sendEventData("Exception", errStrings[0], errStrings[1])
"""
log.exception(error) log.exception(error)
log.info("Forcing shutdown") log.info("Forcing shutdown")
service.shutdown() service.shutdown()