diff --git a/TVRename/Forms/Tools/YTSRecomendations/YtsRecommendationView.cs b/TVRename/Forms/Tools/YTSRecomendations/YtsRecommendationView.cs index 459d8b17..fc54b4e2 100644 --- a/TVRename/Forms/Tools/YTSRecomendations/YtsRecommendationView.cs +++ b/TVRename/Forms/Tools/YTSRecomendations/YtsRecommendationView.cs @@ -186,7 +186,7 @@ private void BwScan_ProgressChanged(object sender, ProgressChangedEventArgs e) { pbProgress.Value = e.ProgressPercentage.Between(0, 100); DateTime completionDateTime = scanStartTime.Add((DateTime.Now - scanStartTime) / (pbProgress.Value+1) * 100) ; - lblStatus.Text = $"{e.UserState?.ToString()?.ToUiVersion()} ETC={completionDateTime}"; + lblStatus.Text = $"ETC={completionDateTime} {e.UserState?.ToString()?.ToUiVersion()}"; } private void BwScan_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) diff --git a/TVRename/Forms/Tools/YTSRecomendations/YtsViewerView.cs b/TVRename/Forms/Tools/YTSRecomendations/YtsViewerView.cs index 0900849e..ddd4de34 100644 --- a/TVRename/Forms/Tools/YTSRecomendations/YtsViewerView.cs +++ b/TVRename/Forms/Tools/YTSRecomendations/YtsViewerView.cs @@ -16,6 +16,7 @@ public partial class YtsViewerView : Form private readonly List addedMovies; string quality; int minRating; + private DateTime scanStartTime; public YtsViewerView(TVDoc doc, UI main) { @@ -121,6 +122,7 @@ private void rightClickMenu_ItemClicked(object sender, ToolStripItemClickedEvent private void BwScan_DoWork(object sender, DoWorkEventArgs e) { System.Threading.Thread.CurrentThread.Name ??= "Recommendations Scan Thread"; // Can only set it once + scanStartTime = DateTime.Now; try { recs = YTS.API @@ -137,7 +139,8 @@ private void BwScan_DoWork(object sender, DoWorkEventArgs e) private void BwScan_ProgressChanged(object sender, ProgressChangedEventArgs e) { pbProgress.Value = e.ProgressPercentage.Between(0, 100); - lblStatus.Text = e.UserState?.ToString()?.ToUiVersion(); + DateTime completionDateTime = scanStartTime.Add((DateTime.Now - scanStartTime) / (pbProgress.Value + 1) * 100); + lblStatus.Text = $"ETC={completionDateTime} {e.UserState?.ToString()?.ToUiVersion()}"; } private void BwScan_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) diff --git a/TVRename/Sources/YTS/API.cs b/TVRename/Sources/YTS/API.cs index dd80dcde..a4f7835c 100644 --- a/TVRename/Sources/YTS/API.cs +++ b/TVRename/Sources/YTS/API.cs @@ -62,14 +62,12 @@ private static T HandleErrorsFrom(string message, Func handler) } } - public static string GetMandatoryString(this JToken r, string key) - { - return (string?)r[key] ?? throw new Exception($"Could not get data element '{key}' from {r}"); - } - public static string? GetString(this JToken r, string key) - { - return (string?)r[key]; - } + private static string GetMandatoryString(this JToken r, string key) + => (string?)r[key] ?? throw new Exception($"Could not get data element '{key}' from {r}"); + + private static string? GetString(this JToken r, string key) + => (string?)r[key]; + public class YtsMovie { private readonly JObject result; @@ -148,7 +146,7 @@ private static IEnumerable GetMoviesInternal(BackgroundWorker sender, page++; int totalEntries = updatesJson["data"]?["movie_count"]?.ToObject() ?? throw new Exception(); - sender.ReportProgress(100 * page / (totalEntries / 50)); + sender.ReportProgress(100 * page / (totalEntries / 50),$"Page {page}"); } else {