コード例 #1
0
ファイル: JobScheduler.cs プロジェクト: haugjan/banshee-hacks
 private void OnClientStarted(Client client)
 {
     Application.ClientStarted -= OnClientStarted;
     Application.RunTimeout (1000, delegate {
         startup_job.Finish ();
         return false;
     });
 }
コード例 #2
0
 private void ReloadAllSources (Client client)
 {
     Application.ClientStarted -= ReloadAllSources;
     foreach (Source source in ServiceManager.SourceManager.Sources) {
         if (source is ITrackModelSource) {
             ((ITrackModelSource)source).Reload ();
         }
     }
 }
コード例 #3
0
        private void Initialize (Client client)
        {
            Application.ClientStarted -= Initialize;

            var handler = Started;
            if (handler != null) {
                handler ();
            }

            Application.RunTimeout (5*1000, delegate {
                if (BansheeMetrics.Instance == null) {
                    return false;
                }

                metrics.AddDefaults ();
                AddMetrics ();

                ThreadAssist.SpawnFromMain (delegate {
                    if (ApplicationContext.CommandLine.Contains ("debug-metrics")) {
                        Log.InformationFormat ("Anonymous usage data collected:\n{0}", metrics.ToJsonString ());
                        System.IO.File.WriteAllText ("usage-data.json", metrics.ToJsonString ());
                    }

                    // Don't post to server more than every 48 hours
                    var last_post_time = DatabaseConfigurationClient.Client.Get<DateTime> (last_post_key, DateTime.MinValue);
                    var last_post_rel = (DateTime.Now - last_post_time).TotalHours;
                    if (last_post_rel < 0 || last_post_rel > 48.0) {
                        var poster = new HttpPoster ("http://metrics.banshee.fm/submit/", metrics);
                        bool posted = poster.Post ();
                        Log.InformationFormat ("Posted usage data? {0}", posted);
                        if (posted) {
                            metrics.Store.Clear ();
                            DatabaseConfigurationClient.Client.Set<DateTime> (last_post_key, DateTime.Now);
                        }
                    }
                });
                return false;
            });
        }
コード例 #4
0
ファイル: Application.cs プロジェクト: knocte/banshee
 private static void OnClientStarted (Client client)
 {
     client.Started -= OnClientStarted;
     Action<Client> handler = client_started;
     if (handler != null) {
         handler (client);
     }
 }
コード例 #5
0
ファイル: Application.cs プロジェクト: knocte/banshee
        public static void PushClient (Client client)
        {
            lock (running_clients) {
                running_clients.Push (client);
                client.Started += OnClientStarted;
            }

            Action<Client> handler = ClientAdded;
            if (handler != null) {
                handler (client);
            }
        }
コード例 #6
0
ファイル: BansheeMetrics.cs プロジェクト: gclark916/banshee
        private void Initialize (Client client)
        {
            Application.ClientStarted -= Initialize;

            var handler = Started;
            if (handler != null) {
                handler ();
            }

            Application.RunTimeout (5*1000, delegate {
                if (BansheeMetrics.Instance == null) {
                    return false;
                }

                ThreadAssist.SpawnFromMain (delegate {
                    metrics.AddDefaults ();
                    AddMetrics ();

                    if (ApplicationContext.CommandLine.Contains ("debug-metrics")) {
                        Log.InformationFormat ("Anonymous usage data collected:\n{0}", metrics.ToJsonString ());
                        System.IO.File.WriteAllText ("usage-data.json", metrics.ToJsonString ());
                    }

                    if (!ServiceManager.Get<Network> ().Connected) {
                        return;
                    }

                    // Don't post to server more than every 48 hours
                    var last_post_time = DatabaseConfigurationClient.Client.Get<DateTime> (last_post_key, DateTime.MinValue);
                    var last_post_rel = (DateTime.Now - last_post_time).TotalDays;
                    if (last_post_rel < 0 || last_post_rel > 4.0) {
                        var poster = new HttpPoster ("http://metrics.banshee.fm/submit/", metrics);
                        bool posted = poster.Post ();
                        Log.InformationFormat ("Posted usage data? {0}", posted);

                        // Clear the old metrics, even if we failed to post them; it might be a server-side
                        // problem w/ the data we want to send (eg too big, out of space) and we don't want
                        // to keep retrying to send the same data.
                        metrics.Store.Clear ();
                        DatabaseConfigurationClient.Client.Set<DateTime> (last_post_key, DateTime.Now);
                    }
                });

                return false;
            });
        }