From 4ebba2b2e87e33f083c095957a2294b6f8ae3828 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 15 Feb 2014 17:42:06 -0500 Subject: change usage reporting to a timer --- .../ScheduledTasks/Tasks/StatisticsTask.cs | 127 --------------------- 1 file changed, 127 deletions(-) delete mode 100644 MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/StatisticsTask.cs (limited to 'MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/StatisticsTask.cs') diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/StatisticsTask.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/StatisticsTask.cs deleted file mode 100644 index 9c0fe165d..000000000 --- a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/StatisticsTask.cs +++ /dev/null @@ -1,127 +0,0 @@ -using MediaBrowser.Common.Net; -using MediaBrowser.Common.ScheduledTasks; -using MediaBrowser.Model.Logging; -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks -{ - /// - /// Class ReloadLoggerFileTask - /// - public class StatisticsTask : IScheduledTask, IConfigurableScheduledTask - { - /// - /// Gets or sets the log manager. - /// - /// The log manager. - private ILogManager LogManager { get; set; } - /// - /// Gets or sets the app host - /// - /// The application host. - private IApplicationHost ApplicationHost { get; set; } - - /// - /// The network manager - /// - private INetworkManager NetworkManager { get; set; } - - /// - /// The http client - /// - private IHttpClient HttpClient { get; set; } - - /// - /// Initializes a new instance of the class. - /// - /// The logManager. - /// - /// - public StatisticsTask(ILogManager logManager, IApplicationHost appHost, INetworkManager networkManager, IHttpClient httpClient) - { - LogManager = logManager; - ApplicationHost = appHost; - NetworkManager = networkManager; - HttpClient = httpClient; - } - - /// - /// Gets the default triggers. - /// - /// IEnumerable{BaseTaskTrigger}. - public IEnumerable GetDefaultTriggers() - { - var trigger = new DailyTrigger { TimeOfDay = TimeSpan.FromHours(20) }; //8pm - when the system is most likely to be active - var trigger2 = new StartupTrigger(); //and also at system start - - return new ITaskTrigger[] { trigger, trigger2 }; - } - - /// - /// Executes the internal. - /// - /// The cancellation token. - /// The progress. - /// Task. - public async Task Execute(CancellationToken cancellationToken, IProgress progress) - { - cancellationToken.ThrowIfCancellationRequested(); - - progress.Report(0); - var mac = NetworkManager.GetMacAddress(); - - var data = new Dictionary - { - { "feature", ApplicationHost.Name }, - { "mac", mac }, - { "ver", ApplicationHost.ApplicationVersion.ToString() }, - { "platform", Environment.OSVersion.VersionString }, - { "isservice", ApplicationHost.IsRunningAsService.ToString().ToLower()} - }; - - await HttpClient.Post(Constants.Constants.MbAdminUrl + "service/registration/ping", data, CancellationToken.None).ConfigureAwait(false); - progress.Report(100); - - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get { return "Collect anonymous usage stats"; } - } - - /// - /// Gets the description. - /// - /// The description. - public string Description - { - get { return "Pings the admin site just so we know how many folks are out there and what version they are on."; } - } - - /// - /// Gets the category. - /// - /// The category. - public string Category - { - get { return "Application"; } - } - - public bool IsHidden - { - get { return true; } - } - - public bool IsEnabled - { - get { return true; } - } - } -} -- cgit v1.2.3