mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-29 23:32:04 +02:00
Save resume info of last unfinished video
This commit is contained in:
@@ -32,6 +32,14 @@
|
||||
<default>"second"</default>
|
||||
<summary>Unit to use with seeking value</summary>
|
||||
</key>
|
||||
<key name="resume-enabled" type="b">
|
||||
<default>true</default>
|
||||
<summary>Ask to resume unfinished video</summary>
|
||||
</key>
|
||||
<key name="resume-database" type="s">
|
||||
<default>'[]'</default>
|
||||
<summary>Data storing unfinished videos resume info</summary>
|
||||
</key>
|
||||
|
||||
<!-- Audio -->
|
||||
<key name="audio-offset" type="d">
|
||||
|
@@ -372,6 +372,18 @@ class ClapperPlayer extends PlayerBase
|
||||
if(size[0] > 0 && size[1] > 0)
|
||||
clapperWidget._saveWindowSize(size);
|
||||
}
|
||||
if(this.state !== GstClapper.ClapperState.STOPPED) {
|
||||
let resumeInfo = {};
|
||||
if(settings.get_boolean('resume-enabled')) {
|
||||
resumeInfo.title = this.playlistWidget.getActiveFilename();
|
||||
resumeInfo.time = Math.floor(this.position / 1000000000);
|
||||
resumeInfo.duration = this.duration / 1000000000;
|
||||
|
||||
debug(`saving resume info for: ${resumeInfo.title}`);
|
||||
debug(`resume time: ${resumeInfo.time}, duration: ${resumeInfo.duration}`);
|
||||
}
|
||||
settings.set_string('resume-database', JSON.stringify([resumeInfo]));
|
||||
}
|
||||
settings.set_double('volume-last', this.volume);
|
||||
|
||||
clapperWidget.controls._onCloseRequest();
|
||||
|
Reference in New Issue
Block a user