Skip to content

Commit 9e84059

Browse files
committed
Changed to close the source video when deleting the source file, rather than stopping the source deletion from happening.
1 parent 48e28cf commit 9e84059

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

VidCoder/Services/ProcessingService.cs

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,6 @@ private List<string> GetRemovalCandidates(IEnumerable<EncodeResultViewModel> com
10961096
int notExistItems = 0;
10971097
int readOnlyItems = 0;
10981098
int itemsInEncodeQueue = 0;
1099-
int itemsCurrentlyScanned = 0;
11001099

11011100
foreach (var itemToClear in completedItems)
11021101
{
@@ -1118,14 +1117,7 @@ private List<string> GetRemovalCandidates(IEnumerable<EncodeResultViewModel> com
11181117
bool sourceInEncodeQueue = this.EncodeQueue.Items.Any(job => string.Compare(job.Job.SourcePath, sourcePath, StringComparison.OrdinalIgnoreCase) == 0);
11191118
if (!sourceInEncodeQueue)
11201119
{
1121-
if (!this.main.HasVideoSource || string.Compare(this.main.SourcePath, sourcePath, StringComparison.OrdinalIgnoreCase) != 0)
1122-
{
1123-
deletionCandidates.Add(sourcePath);
1124-
}
1125-
else
1126-
{
1127-
itemsCurrentlyScanned++;
1128-
}
1120+
deletionCandidates.Add(sourcePath);
11291121
}
11301122
else
11311123
{
@@ -1176,12 +1168,6 @@ private List<string> GetRemovalCandidates(IEnumerable<EncodeResultViewModel> com
11761168
builder.Append("Skipped due to file(s) existing in encode queue: " + itemsInEncodeQueue);
11771169
}
11781170

1179-
if (itemsCurrentlyScanned > 0)
1180-
{
1181-
builder.AppendLine();
1182-
builder.Append("Skipped due to file being currently scanned: " + itemsCurrentlyScanned);
1183-
}
1184-
11851171
encodeLogger.Log(builder.ToString());
11861172

11871173
return deletionCandidates;
@@ -1234,8 +1220,19 @@ private bool PromptAndRemoveSourceFiles(IList<string> deletionCandidates, bool c
12341220
/// <param name="removalMode">The removal mode to use.</param>
12351221
/// <param name="operationLogger">The logger to use for the operation.</param>
12361222
/// <returns>The number of files removed.</returns>
1237-
private static int RemoveSourceFiles(IList<string> filesToRemove, SourceFileRemoval removalMode, IAppLogger operationLogger)
1223+
private int RemoveSourceFiles(IList<string> filesToRemove, SourceFileRemoval removalMode, IAppLogger operationLogger)
12381224
{
1225+
// Close any currently scanned file
1226+
foreach (string file in filesToRemove)
1227+
{
1228+
if (this.main.HasVideoSource
1229+
&& string.Compare(this.main.SourcePath, file, StringComparison.OrdinalIgnoreCase) == 0
1230+
&& this.main.CloseVideoSource.CanExecute(null))
1231+
{
1232+
this.main.CloseVideoSource.Execute(null);
1233+
}
1234+
}
1235+
12391236
int filesRemoved = 0;
12401237
switch (removalMode)
12411238
{

0 commit comments

Comments
 (0)