From 321ab0487012ad24e8aea6b71939e196467b7a23 Mon Sep 17 00:00:00 2001 From: Rafael Araujo Lehmkuhl Date: Wed, 6 Mar 2024 15:36:58 -0300 Subject: [PATCH] video: Wan users when videos are being processed in background --- src/stores/video.ts | 12 ++++++++++++ src/views/ConfigurationVideoView.vue | 20 +++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/stores/video.ts b/src/stores/video.ts index 760a3ff91..d7f58cf94 100644 --- a/src/stores/video.ts +++ b/src/stores/video.ts @@ -425,6 +425,17 @@ export const useVideoStore = defineStore('video', () => { }) }) + const areThereVideosProcessing = computed(() => { + const dateNow = new Date(timeNow.value) + + return keysAllUnprocessedVideos.value.some((recordingHash) => { + const info = unprocessedVideos.value[recordingHash] + const dateLastProcessingUpdate = new Date(info.dateLastProcessignUpdate ?? 0) + const secondsSinceLastProcessingUpdate = differenceInSeconds(dateNow, dateLastProcessingUpdate) + return info.dateFinish !== undefined && secondsSinceLastProcessingUpdate < 10 + }) + }) + // Process videos that were being recorded when the app was closed const processUnprocessedVideos = async (): Promise => { if (keysFailedUnprocessedVideos.value.isEmpty()) return @@ -595,6 +606,7 @@ export const useVideoStore = defineStore('video', () => { downloadTempVideoDB, keysAllUnprocessedVideos, keysFailedUnprocessedVideos, + areThereVideosProcessing, processUnprocessedVideos, discardUnprocessedVideos, temporaryVideoDBSize, diff --git a/src/views/ConfigurationVideoView.vue b/src/views/ConfigurationVideoView.vue index 2a8b059ca..61c7803f3 100644 --- a/src/views/ConfigurationVideoView.vue +++ b/src/views/ConfigurationVideoView.vue @@ -50,6 +50,16 @@ +
+
+ Processing videos + +
+

+ There are videos being processed in background. Please wait until they are finished to download or discard. +

+
+

No videos available.

@@ -122,7 +132,7 @@