diff --git a/bazarr/analytics.py b/bazarr/analytics.py index b533cfb60..a751dc477 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,12 +40,18 @@ 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) - 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) diff --git a/bazarr/get_subtitle.py b/bazarr/get_subtitle.py index d3560c9e7..a12fadd92 100644 --- a/bazarr/get_subtitle.py +++ b/bazarr/get_subtitle.py @@ -485,8 +485,8 @@ 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: logging.error( 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.