Skip to content

Commit

Permalink
- Add banner in finished statictics
Browse files Browse the repository at this point in the history
- Fixes #41
  • Loading branch information
KoalaBear84 committed Nov 2, 2020
1 parent c2fce69 commit 1826533
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion OpenDirectoryDownloader/OpenDirectoryIndexer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ public async void StartIndexingAsync()
Logger.Info("Logging sessions stats...");
try
{
string sessionStats = Statistics.GetSessionStats(Session, includeExtensions: true);
string sessionStats = Statistics.GetSessionStats(Session, includeExtensions: true, includeBanner: true);
Logger.Info(sessionStats);
HistoryLogger.Info(sessionStats);
Logger.Info("Logged sessions stats");
Expand Down
4 changes: 2 additions & 2 deletions OpenDirectoryDownloader/Statistics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static Dictionary<string, ExtensionStats> GetExtensions(WebDirectory webD
return extensionCount;
}

public static string GetSessionStats(Session session, bool includeExtensions = false, bool includeFullExtensions = false, bool onlyRedditStats = false)
public static string GetSessionStats(Session session, bool includeExtensions = false, bool includeFullExtensions = false, bool onlyRedditStats = false, bool includeBanner = false)
{
Dictionary<string, ExtensionStats> extensionsStats = new Dictionary<string, ExtensionStats>();

Expand Down Expand Up @@ -101,7 +101,7 @@ public static string GetSessionStats(Session session, bool includeExtensions = f

stringBuilder.AppendLine($"|**Date (UTC):** {session.Started.ToString(Constants.DateTimeFormat)}|**Time:** {TimeSpan.FromSeconds((int)((session.Finished == DateTimeOffset.MinValue ? DateTimeOffset.UtcNow : session.Finished) - session.Started).TotalSeconds)}|{(session.SpeedtestResult != null ? $"**Speed:** {(session.SpeedtestResult.DownloadedBytes > 0 ? $"{session.SpeedtestResult.MaxMBsPerSecond:F1} MB/s ({session.SpeedtestResult.MaxMBsPerSecond * 8:F0} mbit)" : "Failed")}" : string.Empty)}|");

if (onlyRedditStats)
if (onlyRedditStats || includeBanner)
{
stringBuilder.AppendLine();
stringBuilder.AppendLine($"^(Created by [KoalaBear84's OpenDirectory Indexer](https://github.com/KoalaBear84/OpenDirectoryDownloader/))");
Expand Down

1 comment on commit 1826533

@KoalaBear84
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, meant Fixes #42

Please sign in to comment.