From dc1025381763448195adb6dedf5b3f1d099312e1 Mon Sep 17 00:00:00 2001 From: kirari04 Date: Tue, 23 Jan 2024 17:13:09 +0100 Subject: [PATCH] improoved ResetEncodingState --- services/Encoder.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/services/Encoder.go b/services/Encoder.go index cd42b32..330f156 100755 --- a/services/Encoder.go +++ b/services/Encoder.go @@ -60,7 +60,8 @@ func ResetEncodingState() { Where(&models.Quality{ Encoding: true, }, "Encoding"). - Updates(map[string]interface{}{"encoding": false}); res.Error != nil { + Or("progress > ?", 0). + Updates(map[string]interface{}{"encoding": false, "progress": 0}); res.Error != nil { log.Println("Failed to reset encoding status on Quality", res.Error) } @@ -69,7 +70,8 @@ func ResetEncodingState() { Where(&models.Audio{ Encoding: true, }, "Encoding"). - Updates(map[string]interface{}{"encoding": false}); res.Error != nil { + Or("progress > ?", 0). + Updates(map[string]interface{}{"encoding": false, "progress": 0}); res.Error != nil { log.Println("Failed to reset encoding status on Audio", res.Error) } @@ -78,7 +80,8 @@ func ResetEncodingState() { Where(&models.Subtitle{ Encoding: true, }, "Encoding"). - Updates(map[string]interface{}{"encoding": false}); res.Error != nil { + Or("progress > ?", 0). + Updates(map[string]interface{}{"encoding": false, "progress": 0}); res.Error != nil { log.Println("Failed to reset encoding status on Subtitle", res.Error) } }