add results pane

differentiate videos which already has annotations
This commit is contained in:
Oleksandr Bezdieniezhnykh
2024-07-20 13:50:10 +03:00
parent 288a34e992
commit 83e3532de2
11 changed files with 189 additions and 87 deletions
+2 -8
View File
@@ -4,7 +4,6 @@ using System.Windows.Input;
using Azaion.Annotator.DTO;
using LibVLCSharp.Shared;
using MediatR;
using Newtonsoft.Json;
namespace Azaion.Annotator;
@@ -179,7 +178,7 @@ public class PlayerControlHandler(LibVLC libVLC, MediaPlayer mediaPlayer, MainWi
var fileInfo = (VideoFileInfo)mainWindow.LvFiles.SelectedItem;
formState.CurrentFile = fileInfo.Name;
mainWindow.LoadExistingAnnotations();
mainWindow.ReloadAnnotations();
mediaPlayer.Stop();
mediaPlayer.Play(new Media(libVLC, fileInfo.Path));
@@ -206,15 +205,10 @@ public class PlayerControlHandler(LibVLC libVLC, MediaPlayer mediaPlayer, MainWi
Directory.CreateDirectory(config.ResultsDirectory);
await File.WriteAllTextAsync($"{config.LabelsDirectory}/{fName}.txt", labels);
formState.AnnotationResults.Add(new AnnotationResult(time, fName, currentAnns));
await File.WriteAllTextAsync($"{config.ResultsDirectory}/{fName}.json", JsonConvert.SerializeObject(formState.AnnotationResults));
var resultHeight = (uint)Math.Round(RESULT_WIDTH / formState.CurrentVideoSize.Width * formState.CurrentVideoSize.Height);
mediaPlayer.TakeSnapshot(0, $"{config.ImagesDirectory}/{fName}.jpg", RESULT_WIDTH, resultHeight);
mainWindow.Annotations[time] = currentAnns;
await mainWindow.AddAnnotation(time, currentAnns);
mainWindow.Editor.RemoveAllAnns();
mediaPlayer.Play();
}