Better view of stats
This commit is contained in:
parent
cef9f8d68c
commit
8c9e1cd91c
@ -611,6 +611,33 @@ namespace unison
|
||||
return _Playlist.ToArray().Count();
|
||||
}
|
||||
|
||||
private string FormatTime(TimeSpan time)
|
||||
{
|
||||
string FormattedTime = "";
|
||||
|
||||
if (time.Days == 1)
|
||||
FormattedTime += $"{time.Days} {Resources.Resources.Day}, ";
|
||||
else if (time.Days > 1)
|
||||
FormattedTime += $"{time.Days} {Resources.Resources.Days}, ";
|
||||
|
||||
if (time.Hours == 1)
|
||||
FormattedTime += $"{time.Hours} {Resources.Resources.Hour}, ";
|
||||
else
|
||||
FormattedTime += $"{time.Hours} {Resources.Resources.Hours}, ";
|
||||
|
||||
if (time.Minutes == 1)
|
||||
FormattedTime += $"{time.Minutes} {Resources.Resources.Minute}, ";
|
||||
else
|
||||
FormattedTime += $"{time.Minutes} {Resources.Resources.Minutes}, ";
|
||||
|
||||
if (time.Seconds == 1)
|
||||
FormattedTime += $"{time.Seconds} {Resources.Resources.Second}";
|
||||
else
|
||||
FormattedTime += $"{time.Seconds} {Resources.Resources.Seconds}";
|
||||
|
||||
return FormattedTime;
|
||||
}
|
||||
|
||||
public async void QueryStats()
|
||||
{
|
||||
Dictionary<string, string> Response = await SafelySendCommandAsync(new StatsCommand());
|
||||
@ -621,16 +648,13 @@ namespace unison
|
||||
_stats.Albums = int.Parse(Response["albums"]);
|
||||
_stats.Artists = int.Parse(Response["artists"]);
|
||||
|
||||
TimeSpan time;
|
||||
time = TimeSpan.FromSeconds(int.Parse(Response["uptime"]));
|
||||
_stats.Uptime = time.ToString(@"dd\:hh\:mm\:ss");
|
||||
time = TimeSpan.FromSeconds(int.Parse(Response["db_playtime"]));
|
||||
_stats.TotalPlaytime = time.ToString(@"dd\:hh\:mm\:ss");
|
||||
time = TimeSpan.FromSeconds(int.Parse(Response["playtime"]));
|
||||
_stats.TotalTimePlayed = time.ToString(@"dd\:hh\:mm\:ss");
|
||||
_stats.Uptime = FormatTime(TimeSpan.FromSeconds(int.Parse(Response["uptime"])));
|
||||
_stats.TotalPlaytime = FormatTime(TimeSpan.FromSeconds(int.Parse(Response["db_playtime"])));
|
||||
_stats.TotalTimePlayed = FormatTime(TimeSpan.FromSeconds(int.Parse(Response["playtime"])));
|
||||
|
||||
DateTime date = new DateTime(1970, 1, 1).AddSeconds(int.Parse(Response["db_update"])).ToLocalTime();
|
||||
_stats.DatabaseUpdate = date.ToString("dd/MM/yyyy @ HH:mm");
|
||||
string dayOfWeek = Resources.Resources.Culture.DateTimeFormat.GetDayName(date.DayOfWeek);
|
||||
_stats.DatabaseUpdate = dayOfWeek + " " + date.ToString("dd/MM/yyyy @ HH:mm");
|
||||
}
|
||||
}
|
||||
}
|
72
Resources/Resources.Designer.cs
generated
72
Resources/Resources.Designer.cs
generated
@ -60,6 +60,24 @@ namespace unison.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to day.
|
||||
/// </summary>
|
||||
public static string Day {
|
||||
get {
|
||||
return ResourceManager.GetString("Day", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to days.
|
||||
/// </summary>
|
||||
public static string Days {
|
||||
get {
|
||||
return ResourceManager.GetString("Days", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Exit.
|
||||
/// </summary>
|
||||
@ -123,6 +141,42 @@ namespace unison.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to hour.
|
||||
/// </summary>
|
||||
public static string Hour {
|
||||
get {
|
||||
return ResourceManager.GetString("Hour", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to hours.
|
||||
/// </summary>
|
||||
public static string Hours {
|
||||
get {
|
||||
return ResourceManager.GetString("Hours", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to minute.
|
||||
/// </summary>
|
||||
public static string Minute {
|
||||
get {
|
||||
return ResourceManager.GetString("Minute", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to minutes.
|
||||
/// </summary>
|
||||
public static string Minutes {
|
||||
get {
|
||||
return ResourceManager.GetString("Minutes", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to contains.
|
||||
/// </summary>
|
||||
@ -231,6 +285,24 @@ namespace unison.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to second.
|
||||
/// </summary>
|
||||
public static string Second {
|
||||
get {
|
||||
return ResourceManager.GetString("Second", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to seconds.
|
||||
/// </summary>
|
||||
public static string Seconds {
|
||||
get {
|
||||
return ResourceManager.GetString("Seconds", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Settings.
|
||||
/// </summary>
|
||||
|
@ -117,6 +117,12 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Day" xml:space="preserve">
|
||||
<value>día</value>
|
||||
</data>
|
||||
<data name="Days" xml:space="preserve">
|
||||
<value>días</value>
|
||||
</data>
|
||||
<data name="Exit" xml:space="preserve">
|
||||
<value>Salir</value>
|
||||
</data>
|
||||
@ -138,6 +144,18 @@
|
||||
<data name="FilterType_Year" xml:space="preserve">
|
||||
<value>Año</value>
|
||||
</data>
|
||||
<data name="Hour" xml:space="preserve">
|
||||
<value>hora</value>
|
||||
</data>
|
||||
<data name="Hours" xml:space="preserve">
|
||||
<value>horas</value>
|
||||
</data>
|
||||
<data name="Minute" xml:space="preserve">
|
||||
<value>minuto</value>
|
||||
</data>
|
||||
<data name="Minutes" xml:space="preserve">
|
||||
<value>minutos</value>
|
||||
</data>
|
||||
<data name="Operator_Contains" xml:space="preserve">
|
||||
<value>contiene</value>
|
||||
</data>
|
||||
@ -174,6 +192,12 @@
|
||||
<data name="Radio_Tags" xml:space="preserve">
|
||||
<value>Tags</value>
|
||||
</data>
|
||||
<data name="Second" xml:space="preserve">
|
||||
<value>segundo</value>
|
||||
</data>
|
||||
<data name="Seconds" xml:space="preserve">
|
||||
<value>segundos</value>
|
||||
</data>
|
||||
<data name="Settings" xml:space="preserve">
|
||||
<value>Ajustes</value>
|
||||
</data>
|
||||
|
@ -117,6 +117,12 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Day" xml:space="preserve">
|
||||
<value>jour</value>
|
||||
</data>
|
||||
<data name="Days" xml:space="preserve">
|
||||
<value>jours</value>
|
||||
</data>
|
||||
<data name="Exit" xml:space="preserve">
|
||||
<value>Quitter</value>
|
||||
</data>
|
||||
@ -138,6 +144,18 @@
|
||||
<data name="FilterType_Year" xml:space="preserve">
|
||||
<value>Année</value>
|
||||
</data>
|
||||
<data name="Hour" xml:space="preserve">
|
||||
<value>heure</value>
|
||||
</data>
|
||||
<data name="Hours" xml:space="preserve">
|
||||
<value>heures</value>
|
||||
</data>
|
||||
<data name="Minute" xml:space="preserve">
|
||||
<value>minute</value>
|
||||
</data>
|
||||
<data name="Minutes" xml:space="preserve">
|
||||
<value>minutes</value>
|
||||
</data>
|
||||
<data name="Operator_Contains" xml:space="preserve">
|
||||
<value>continent</value>
|
||||
</data>
|
||||
@ -174,6 +192,12 @@
|
||||
<data name="Radio_Tags" xml:space="preserve">
|
||||
<value>Tags</value>
|
||||
</data>
|
||||
<data name="Second" xml:space="preserve">
|
||||
<value>seconde</value>
|
||||
</data>
|
||||
<data name="Seconds" xml:space="preserve">
|
||||
<value>secondes</value>
|
||||
</data>
|
||||
<data name="Settings" xml:space="preserve">
|
||||
<value>Configuration</value>
|
||||
</data>
|
||||
|
@ -117,6 +117,12 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Day" xml:space="preserve">
|
||||
<value>day</value>
|
||||
</data>
|
||||
<data name="Days" xml:space="preserve">
|
||||
<value>days</value>
|
||||
</data>
|
||||
<data name="Exit" xml:space="preserve">
|
||||
<value>Exit</value>
|
||||
</data>
|
||||
@ -138,6 +144,18 @@
|
||||
<data name="FilterType_Year" xml:space="preserve">
|
||||
<value>Year</value>
|
||||
</data>
|
||||
<data name="Hour" xml:space="preserve">
|
||||
<value>hour</value>
|
||||
</data>
|
||||
<data name="Hours" xml:space="preserve">
|
||||
<value>hours</value>
|
||||
</data>
|
||||
<data name="Minute" xml:space="preserve">
|
||||
<value>minute</value>
|
||||
</data>
|
||||
<data name="Minutes" xml:space="preserve">
|
||||
<value>minutes</value>
|
||||
</data>
|
||||
<data name="Operator_Contains" xml:space="preserve">
|
||||
<value>contains</value>
|
||||
</data>
|
||||
@ -174,6 +192,12 @@
|
||||
<data name="Radio_Tags" xml:space="preserve">
|
||||
<value>Tags</value>
|
||||
</data>
|
||||
<data name="Second" xml:space="preserve">
|
||||
<value>second</value>
|
||||
</data>
|
||||
<data name="Seconds" xml:space="preserve">
|
||||
<value>seconds</value>
|
||||
</data>
|
||||
<data name="Settings" xml:space="preserve">
|
||||
<value>Settings</value>
|
||||
</data>
|
||||
|
Loading…
Reference in New Issue
Block a user