mirror of
https://github.com/mifi/lossless-cut.git
synced 2024-11-26 04:02:51 +01:00
81eb66faa2
- Add config option for asking about file open #467 - Implement text/youtube segments import #458 - Implement CUE sheet import #458 - Implement XMEML import (Final Cut Pro / Davinci Resolve) - Allow import embedded chapters as segments #300
55 lines
1.1 KiB
JavaScript
55 lines
1.1 KiB
JavaScript
const Store = require('electron-store');
|
|
|
|
const defaults = {
|
|
defaults: {
|
|
captureFormat: 'jpeg',
|
|
customOutDir: undefined,
|
|
keyframeCut: true,
|
|
autoMerge: false,
|
|
timecodeShowFrames: false,
|
|
invertCutSegments: false,
|
|
autoExportExtraStreams: true,
|
|
askBeforeClose: false,
|
|
enableAskForImportChapters: true,
|
|
enableAskForFileOpenAction: true,
|
|
muted: false,
|
|
autoSaveProjectFile: true,
|
|
wheelSensitivity: 0.2,
|
|
language: undefined,
|
|
ffmpegExperimental: false,
|
|
},
|
|
};
|
|
|
|
|
|
let store;
|
|
|
|
async function init() {
|
|
for (let i = 0; i < 5; i += 1) {
|
|
try {
|
|
store = new Store(defaults);
|
|
return;
|
|
} catch (err) {
|
|
// eslint-disable-next-line no-await-in-loop
|
|
await new Promise(r => setTimeout(r, 2000));
|
|
console.error('Failed to create config store, retrying', err);
|
|
}
|
|
}
|
|
|
|
throw new Error('Timed out while creating config store');
|
|
}
|
|
|
|
function get(key) {
|
|
return store.get(key);
|
|
}
|
|
|
|
function set(key, val) {
|
|
if (val === undefined) store.delete(key);
|
|
else store.set(key, val);
|
|
}
|
|
|
|
module.exports = {
|
|
init,
|
|
get,
|
|
set,
|
|
};
|