Also do not save resume info for very long titles (random URIs)

This commit is contained in:
Rafał Dzięgiel
2021-02-09 17:19:42 +01:00
parent 1f0979d217
commit 1ee0db1cbc

View File

@@ -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;