From 1ee0db1cbcff3cb7045f5ebb4e4ea83fa6fee6a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Tue, 9 Feb 2021 17:19:42 +0100 Subject: [PATCH] Also do not save resume info for very long titles (random URIs) --- src/player.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/player.js b/src/player.js index c57597ac..86a95c02 100644 --- a/src/player.js +++ b/src/player.js @@ -376,12 +376,19 @@ class ClapperPlayer extends PlayerBase if(this.state !== GstClapper.ClapperState.STOPPED && !this.quitOnStop) { let resumeInfo = {}; if(settings.get_boolean('resume-enabled')) { + const resumeTitle = this.playlistWidget.getActiveFilename(); const resumeTime = Math.floor(this.position / 1000000000); const resumeDuration = this.duration / 1000000000; - /* Do not save resume info when video is short, just started or almost finished */ - if(resumeDuration > 60 && resumeTime > 15 && resumeDuration - resumeTime > 20) { - resumeInfo.title = this.playlistWidget.getActiveFilename(); + /* Do not save resume info when title is too long (random URI), + * video is very short, just started or almost finished */ + if( + resumeTitle.length < 300 + && resumeDuration > 60 + && resumeTime > 15 + && resumeDuration - resumeTime > 20 + ) { + resumeInfo.title = resumeTitle; resumeInfo.time = resumeTime; resumeInfo.duration = resumeDuration;