Skip to content

Commit 806fcf5

Browse files
committed
Added "Pause time" and "Video duration" optional columns to the Completed tab.
1 parent 3944f5c commit 806fcf5

File tree

8 files changed

+60
-2
lines changed

8 files changed

+60
-2
lines changed

VidCoder/Model/EncodeResult.cs

+5
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@ public class EncodeResult
1616
/// The name of the failed file, if KeepFailedFiles is enabled.
1717
/// </summary>
1818
public string FailedFilePath { get; set; }
19+
1920
public EncodeResultStatus Status { get; set; }
21+
2022
public TimeSpan EncodeTime { get; set; }
23+
24+
public TimeSpan PauseTime { get; set; }
25+
2126
public string LogPath { get; set; }
2227
public long SizeBytes { get; set; }
2328

VidCoder/Resources/CommonRes.Designer.cs

+19-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

VidCoder/Resources/CommonRes.resx

+7-1
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ A full copy of the GNU General Public License has been included along with this
357357
<comment>The header for the status column for completed jobs (succeeded/failed)</comment>
358358
</data>
359359
<data name="CompletedColumnNameElapsedTime" xml:space="preserve">
360-
<value>Elapsed time</value>
360+
<value>Encode time</value>
361361
</data>
362362
<data name="CompletedColumnNameSize" xml:space="preserve">
363363
<value>Size</value>
@@ -368,4 +368,10 @@ A full copy of the GNU General Public License has been included along with this
368368
<data name="CompletedColumnNameSourceSize" xml:space="preserve">
369369
<value>Source size</value>
370370
</data>
371+
<data name="CompletedColumnNameVideoDuration" xml:space="preserve">
372+
<value>Video duration</value>
373+
</data>
374+
<data name="CompletedColumnNamePauseTime" xml:space="preserve">
375+
<value>Pause time</value>
376+
</data>
371377
</root>

VidCoder/Services/ProcessingService.cs

+1
Original file line numberDiff line numberDiff line change
@@ -2375,6 +2375,7 @@ private void OnEncodeCompleted(EncodeJobViewModel finishedJobViewModel, VCEncode
23752375
Destination = finalOutputPath,
23762376
Status = status,
23772377
EncodeTime = finishedJobViewModel.EncodeTime,
2378+
PauseTime = finishedJobViewModel.PauseTime,
23782379
LogPath = encodeLogger.LogPath,
23792380
SizeBytes = outputFileLength,
23802381
},

VidCoder/Utilities/Utilities.cs

+2
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,11 @@ public static string ImageCacheFolder
309309
{"Destination", 290},
310310
{"Status", 120},
311311
{"ElapsedTime", 90},
312+
{"PauseTime", 90},
312313
{"SourceSize", 80},
313314
{"Size", 80},
314315
{"PercentOfSource", 90},
316+
{"VideoDuration", 90},
315317
};
316318

317319
public static IEncodeProxy CreateEncodeProxy()

VidCoder/View/Main.xaml

+6
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,9 @@
259259
<DataTemplate x:Key="CompletedTemplateElapsedTime" DataType="viewmodel:EncodeResultViewModel">
260260
<TextBlock Style="{DynamicResource TextBlockBaseStyle}" Text="{Binding TimeDisplay}" />
261261
</DataTemplate>
262+
<DataTemplate x:Key="CompletedTemplatePauseTime" DataType="viewmodel:EncodeResultViewModel">
263+
<TextBlock Style="{DynamicResource TextBlockBaseStyle}" Text="{Binding PauseTimeDisplay}" />
264+
</DataTemplate>
262265
<DataTemplate x:Key="CompletedTemplateSize" DataType="viewmodel:EncodeResultViewModel">
263266
<TextBlock Style="{DynamicResource TextBlockBaseStyle}" Text="{Binding OutputFileSize}" />
264267
</DataTemplate>
@@ -268,6 +271,9 @@
268271
<DataTemplate x:Key="CompletedTemplatePercentOfSource" DataType="viewmodel:EncodeResultViewModel">
269272
<TextBlock Style="{DynamicResource TextBlockBaseStyle}" Text="{Binding PercentOfSourceDisplay}" />
270273
</DataTemplate>
274+
<DataTemplate x:Key="CompletedTemplateVideoDuration" DataType="viewmodel:EncodeResultViewModel">
275+
<TextBlock Style="{DynamicResource TextBlockBaseStyle}" Text="{Binding Job.DurationDisplay}" />
276+
</DataTemplate>
271277
<ContextMenu x:Key="CompletedItemContextMenu" d:DataContext="{d:DesignInstance viewmodel:EncodeResultViewModel}">
272278
<MenuItem Command="{Binding Play}" Header="{x:Static res:MainRes.Play}">
273279
<MenuItem.Icon>

VidCoder/ViewModel/DataModels/EncodeJobViewModel.cs

+18
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public class EncodeJobViewModel : ReactiveObject, IDragItem, IListItemViewModel
3030
public const double SubtitleScanCostFactor = 5.0;
3131
private ProcessingService processingService;
3232
private Stopwatch encodeTimeStopwatch;
33+
private Stopwatch pauseTimeStopwatch;
3334

3435
public EncodeJobViewModel(
3536
VCJob job,
@@ -354,6 +355,19 @@ public TimeSpan EncodeTime
354355
}
355356
}
356357

358+
public TimeSpan PauseTime
359+
{
360+
get
361+
{
362+
if (this.pauseTimeStopwatch == null)
363+
{
364+
return TimeSpan.Zero;
365+
}
366+
367+
return this.pauseTimeStopwatch.Elapsed;
368+
}
369+
}
370+
357371
private readonly ObservableAsPropertyHelper<string> encodeTimeDisplay;
358372
public string EncodeTimeDisplay => this.encodeTimeDisplay.Value;
359373

@@ -854,24 +868,28 @@ public void ReportEncodeStart()
854868
this.InitializeForEncoding();
855869
this.Encoding = true;
856870
this.encodeTimeStopwatch = Stopwatch.StartNew();
871+
this.pauseTimeStopwatch = new Stopwatch();
857872
}
858873

859874
public void ReportEncodePause()
860875
{
861876
this.IsPaused = true;
862877
this.encodeTimeStopwatch.Stop();
878+
this.pauseTimeStopwatch.Start();
863879
}
864880

865881
public void ReportEncodeResume()
866882
{
867883
this.IsPaused = false;
868884
this.encodeTimeStopwatch.Start();
885+
this.pauseTimeStopwatch.Stop();
869886
}
870887

871888
public void ReportEncodeEnd()
872889
{
873890
this.Encoding = false;
874891
this.encodeTimeStopwatch?.Stop();
892+
this.pauseTimeStopwatch?.Stop();
875893
}
876894

877895
public override string ToString()

VidCoder/ViewModel/DataModels/EncodeResultViewModel.cs

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ public string StatusText
5858

5959
public string TimeDisplay => this.encodeResult.EncodeTime.FormatShort();
6060

61+
public string PauseTimeDisplay => this.encodeResult.PauseTime > TimeSpan.Zero ? this.encodeResult.PauseTime.FormatShort() : string.Empty;
62+
6163
public string StatusImage
6264
{
6365
get

0 commit comments

Comments
 (0)