From 522aecfbc1a97f2f50c8290bcd48ca817f4f8331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toni=20F=C3=B6rster?= Date: Tue, 20 Aug 2024 22:10:35 +0200 Subject: [PATCH] only updateWatch status while video is playing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This should circumvent edge cases where videos are marked as watch when they failed to play back. Fixes #660 Signed-off-by: Toni Förster --- Model/HistoryModel.swift | 2 +- Model/Player/Backends/MPVBackend.swift | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Model/HistoryModel.swift b/Model/HistoryModel.swift index 9568ba09..b3ea0544 100644 --- a/Model/HistoryModel.swift +++ b/Model/HistoryModel.swift @@ -47,7 +47,7 @@ extension PlayerModel { } func updateWatch(finished: Bool = false, time: CMTime? = nil) { - guard let currentVideo, saveHistory else { return } + guard let currentVideo, saveHistory, isPlaying else { return } let id = currentVideo.videoID let time = time ?? backend.currentTime diff --git a/Model/Player/Backends/MPVBackend.swift b/Model/Player/Backends/MPVBackend.swift index 3fd47092..49cfb2f7 100644 --- a/Model/Player/Backends/MPVBackend.swift +++ b/Model/Player/Backends/MPVBackend.swift @@ -464,8 +464,6 @@ final class MPVBackend: PlayerBackend { timeObserverThrottle.execute { self.model.updateWatch(time: self.currentTime) } - - self.model.updateTime(self.currentTime!) } private func stopClientUpdates() {