add publish script, check its work

This commit is contained in:
Alex Bezdieniezhnykh
2025-02-14 23:08:50 +02:00
parent 961d2499de
commit 0d6ea4264f
11 changed files with 97 additions and 43 deletions
+9 -7
View File
@@ -123,7 +123,7 @@ public class AnnotatorEventHandler(
switch (controlEnum)
{
case PlaybackControlEnum.Play:
Play();
await Play(cancellationToken);
break;
case PlaybackControlEnum.Pause:
mediaPlayer.Pause();
@@ -170,10 +170,10 @@ public class AnnotatorEventHandler(
mediaPlayer.Volume = 0;
break;
case PlaybackControlEnum.Previous:
NextMedia(isPrevious: true);
await NextMedia(isPrevious: true, ct: cancellationToken);
break;
case PlaybackControlEnum.Next:
NextMedia();
await NextMedia(ct: cancellationToken);
break;
case PlaybackControlEnum.None:
break;
@@ -188,7 +188,7 @@ public class AnnotatorEventHandler(
}
}
private void NextMedia(bool isPrevious = false)
private async Task NextMedia(bool isPrevious = false, CancellationToken ct = default)
{
var increment = isPrevious ? -1 : 1;
var check = isPrevious ? -1 : mainWindow.LvFiles.Items.Count;
@@ -196,7 +196,7 @@ public class AnnotatorEventHandler(
return;
mainWindow.LvFiles.SelectedIndex += increment;
Play();
await Play(ct);
}
public async Task Handle(VolumeChangedEvent notification, CancellationToken cancellationToken)
@@ -211,7 +211,7 @@ public class AnnotatorEventHandler(
mediaPlayer.Volume = volume;
}
private void Play()
private async Task Play(CancellationToken ct = default)
{
if (mainWindow.LvFiles.SelectedItem == null)
return;
@@ -219,6 +219,8 @@ public class AnnotatorEventHandler(
mainWindow.Editor.ResetBackground();
formState.CurrentMedia = mediaInfo;
//need to wait a bit for correct VLC playback event handling
await Task.Delay(100, ct);
mediaPlayer.Stop();
mainWindow.Title = $"Azaion Annotator - {mediaInfo.Name}";
mainWindow.BlinkHelp(HelpTexts.HelpTextsDict[HelpTextEnum.PauseForAnnotations]);
@@ -269,7 +271,7 @@ public class AnnotatorEventHandler(
else
{
File.Copy(formState.CurrentMedia.Path, imgPath, overwrite: true);
NextMedia();
await NextMedia(ct: cancellationToken);
}
var annotation = await annotationService.SaveAnnotation(formState.VideoName, time, imageExtension, currentDetections, SourceEnum.Manual, token: cancellationToken);
mainWindow.AddAnnotation(annotation);