From 1abd291d51510786ca41e203dba64a90011cf643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Tue, 3 Sep 2019 14:25:02 -0400 Subject: [PATCH 1/3] Better description of what is analytics and how we use it. --- views/settings_general.tpl | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/views/settings_general.tpl b/views/settings_general.tpl index 04a2183d8..75cfeeb76 100644 --- a/views/settings_general.tpl +++ b/views/settings_general.tpl @@ -679,12 +679,16 @@ - +
+
+ +
+
+ +
+
+ Send anonymous usage information, nothing that can identify you. This includes information on which providers you use, what languages you search for, Bazarr, Python, Sonarr, Radarr and OS version you are using. We will use this information to prioritize features and bug fixes. Please, keep this enabled as this is the only way we have to better understand how you use Bazarr.
From 0650e2a3801c947d153073e2748a2a98cf1860d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Wed, 4 Sep 2019 07:29:37 -0400 Subject: [PATCH 2/3] Fixes for analytics. --- bazarr/analytics.py | 7 ++++--- bazarr/get_subtitle.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bazarr/analytics.py b/bazarr/analytics.py index b533cfb60..5702ef3f5 100644 --- a/bazarr/analytics.py +++ b/bazarr/analytics.py @@ -19,7 +19,6 @@ radarr_version = get_radarr_version() def track_event(category=None, action=None, label=None): if not settings.analytics.getboolean('enabled'): - print "no analytics" return anonymousConfig = Config() @@ -41,8 +40,10 @@ def track_event(category=None, action=None, label=None): tracker.add_custom_variable(CustomVariable(index=1, name='BazarrVersion', value=os.environ["BAZARR_VERSION"], scope=1)) tracker.add_custom_variable(CustomVariable(index=2, name='PythonVersion', value=platform.python_version(), scope=1)) - tracker.add_custom_variable(CustomVariable(index=3, name='SonarrVersion', value=sonarr_version, scope=1)) - tracker.add_custom_variable(CustomVariable(index=4, name='RadarrVersion', value=radarr_version, scope=1)) + if settings.general.getboolean('use_sonarr'): + tracker.add_custom_variable(CustomVariable(index=3, name='SonarrVersion', value=sonarr_version, scope=1)) + if settings.general.getboolean('use_radarr'): + tracker.add_custom_variable(CustomVariable(index=4, name='RadarrVersion', value=radarr_version, scope=1)) tracker.add_custom_variable(CustomVariable(index=5, name='OSVersion', value=platform.platform(), scope=1)) tracker.track_event(event, session, visitor) tracker.track_pageview(page, session, visitor) diff --git a/bazarr/get_subtitle.py b/bazarr/get_subtitle.py index b5d70a9cb..035241c76 100644 --- a/bazarr/get_subtitle.py +++ b/bazarr/get_subtitle.py @@ -483,7 +483,7 @@ def manual_download_subtitle(path, language, hi, forced, subtitle, provider, pro else: reversed_path = path_replace_reverse_movie(path) - track_event(category=downloaded_provider, action="downloaded", label=downloaded_language) + track_event(category=downloaded_provider, action="manually_downloaded", label=downloaded_language) return message, reversed_path, downloaded_language_code2, downloaded_provider, subtitle.score, subtitle.language.forced else: From b0c68c151fc5d9c6eb29e4b7c9c9cc9333e72776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Wed, 4 Sep 2019 20:48:10 -0400 Subject: [PATCH 3/3] Fix to catch exception when calling Google Analytics. --- bazarr/analytics.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/bazarr/analytics.py b/bazarr/analytics.py index 5702ef3f5..a751dc477 100644 --- a/bazarr/analytics.py +++ b/bazarr/analytics.py @@ -45,9 +45,13 @@ def track_event(category=None, action=None, label=None): if settings.general.getboolean('use_radarr'): tracker.add_custom_variable(CustomVariable(index=4, name='RadarrVersion', value=radarr_version, scope=1)) tracker.add_custom_variable(CustomVariable(index=5, name='OSVersion', value=platform.platform(), scope=1)) - tracker.track_event(event, session, visitor) - tracker.track_pageview(page, session, visitor) - settings.analytics.visitor = base64.b64encode(pickle.dumps(visitor)) - with open(os.path.join(args.config_dir, 'config', 'config.ini'), 'w+') as handle: - settings.write(handle) + try: + tracker.track_event(event, session, visitor) + tracker.track_pageview(page, session, visitor) + except: + pass + else: + settings.analytics.visitor = base64.b64encode(pickle.dumps(visitor)) + with open(os.path.join(args.config_dir, 'config', 'config.ini'), 'w+') as handle: + settings.write(handle)