Skip to content

Commit f11ed94

Browse files
committed
More av1an resume ui improvs (sort by last run date)
1 parent b6b3955 commit f11ed94

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

ff-utils-winforms/Data/Ui/Av1anFolderEntry.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ public class Av1anFolderEntry
2222
public string Args { get; } = "";
2323
public DateTime CreationDate { get; }
2424
public DateTime LastRunDate { get; }
25+
public TimeSpan TimeSinceCreation { get; }
26+
public TimeSpan TimeSinceLastRun { get; }
2527

2628
public Av1anFolderEntry(string path)
2729
{
@@ -49,25 +51,22 @@ public Av1anFolderEntry(string path)
4951

5052
if (jsonInfo.ContainsKey("args"))
5153
Args = jsonInfo["args"];
54+
55+
TimeSinceCreation = DateTime.Now - CreationDate;
56+
TimeSinceLastRun = DateTime.Now - LastRunDate;
5257
}
5358

5459
public override string ToString()
5560
{
5661
string created = "???";
5762

5863
if (CreationDate != new DateTime(1970, 1, 1, 0, 0, 0, 0))
59-
{
60-
TimeSpan delta = DateTime.Now - CreationDate;
61-
created = $"{(delta.TotalMinutes >= 120 ? $"{delta.TotalHours.RoundToInt()}h" : $"{delta.TotalMinutes.RoundToInt()}m")} ago";
62-
}
64+
created = $"{(TimeSinceCreation.TotalMinutes >= 120 ? $"{TimeSinceCreation.TotalHours.RoundToInt()}h" : $"{TimeSinceCreation.TotalMinutes.RoundToInt()}m")} ago";
6365

6466
string lastRun = "???";
6567

6668
if (LastRunDate != new DateTime(1970, 1, 1, 0, 0, 0, 0))
67-
{
68-
TimeSpan delta = DateTime.Now - LastRunDate;
69-
lastRun = $"{(delta.TotalMinutes >= 120 ? $"{delta.TotalHours.RoundToInt()}h" : $"{delta.TotalMinutes.RoundToInt()}m")} ago";
70-
}
69+
lastRun = $"{(TimeSinceLastRun.TotalMinutes >= 120 ? $"{TimeSinceLastRun.TotalHours.RoundToInt()}h" : $"{TimeSinceLastRun.TotalMinutes.RoundToInt()}m")} ago";
7170

7271
string chunks = $"{ChunkFiles.Length} Chunks - {FormatUtils.Bytes(ChunkFiles.Sum(x => x.Length))}";
7372
return $"{InputFilename} - {chunks} - Created: {created} - Last Run: {lastRun}";

ff-utils-winforms/Forms/Av1anResumeForm.Designer.cs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ff-utils-winforms/Forms/Av1anResumeForm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ private void ReloadList ()
4040
{
4141
folderList.Items.Clear();
4242
string av1anDir = Paths.GetAv1anTempPath();
43-
folderList.Items.AddRange(new DirectoryInfo(av1anDir).GetDirectories().Select(x => new Av1anFolderEntry(x.FullName)).ToArray());
43+
folderList.Items.AddRange(new DirectoryInfo(av1anDir).GetDirectories().Select(x => new Av1anFolderEntry(x.FullName)).OrderBy(x => x.TimeSinceLastRun.TotalMilliseconds).ToArray());
4444

4545
if(folderList.Items.Count > 0)
4646
folderList.SelectedIndex = 0;

0 commit comments

Comments
 (0)