Updated German translation
[banshee.git] / extras / metrics / Main.cs
blob0d4d1185050c39ae27dfb087c98fbb58b5a13a7b
1 //
2 // Main.cs
3 //
4 // Author:
5 // Gabriel Burt <gabriel.burt@gmail.com>
6 //
7 // Copyright (c) 2010 Novell, Inc.
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining a copy
10 // of this software and associated documentation files (the "Software"), to deal
11 // in the Software without restriction, including without limitation the rights
12 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 // copies of the Software, and to permit persons to whom the Software is
14 // furnished to do so, subject to the following conditions:
16 // The above copyright notice and this permission notice shall be included in
17 // all copies or substantial portions of the Software.
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 // THE SOFTWARE.
27 using System;
29 using Hyena;
30 using Hyena.CommandLine;
32 namespace metrics
34 public class MainEntry
36 const string db_path = "data/metrics.db";
38 public static void Main (string [] args)
40 try {
41 using (var db = new Database (db_path)) {
42 if (args != null && args.Length > 0 && args[0] == "--timeline") {
43 var metric = db.GetMetric ("Banshee/StartedAt");
44 var usage_samples = new SampleModel (String.Format ("WHERE MetricId = {0}", metric.Id), db, "1");
45 usage_samples.Reload ();
47 for (long i = 0; i < usage_samples.Cache.Count; i++) {
48 var sample = usage_samples.Cache.GetValue (i);
49 Console.WriteLine (
50 "{1} {0} {2} {0} {3} {0} {4}",
51 "<TUFTE>", DateTimeUtil.FromDateTime (sample.Stamp), sample.UserId, sample.CacheEntryId, sample.CacheEntryId
55 return;
58 db.Import ();
59 new MetaMetrics (db);
61 } catch (Exception e) {
62 Console.WriteLine ("Going down, got exception {0}", e);
63 throw;