mirror of
https://github.com/anidl/multi-downloader-nx.git
synced 2026-03-11 17:45:30 +00:00
Make sync options configurable
This commit is contained in:
parent
1d3822d307
commit
40cfebb904
6 changed files with 79 additions and 10 deletions
8
@types/crunchyTypes.d.ts
vendored
8
@types/crunchyTypes.d.ts
vendored
|
|
@ -31,6 +31,10 @@ export type CrunchyDownloadOptions = {
|
||||||
dlVideoOnce: boolean,
|
dlVideoOnce: boolean,
|
||||||
skipmux?: boolean,
|
skipmux?: boolean,
|
||||||
syncTiming: boolean,
|
syncTiming: boolean,
|
||||||
|
maxSecurityFrames: number,
|
||||||
|
maxOffsetSeconds: number,
|
||||||
|
targetLikeness: number,
|
||||||
|
syncMethod: number,
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CurnchyMultiDownload = {
|
export type CurnchyMultiDownload = {
|
||||||
|
|
@ -55,6 +59,10 @@ export type CrunchyMuxOptions = {
|
||||||
defaultAudio: LanguageItem,
|
defaultAudio: LanguageItem,
|
||||||
ccTag: string,
|
ccTag: string,
|
||||||
syncTiming: boolean,
|
syncTiming: boolean,
|
||||||
|
maxSecurityFrames: number;
|
||||||
|
maxOffsetSeconds: number;
|
||||||
|
targetLikeness: number;
|
||||||
|
syncMethod: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CrunchyEpMeta = {
|
export type CrunchyEpMeta = {
|
||||||
|
|
|
||||||
|
|
@ -1507,7 +1507,7 @@ export default class Crunchy implements ServiceClass {
|
||||||
// mergers
|
// mergers
|
||||||
let isMuxed = false;
|
let isMuxed = false;
|
||||||
if (options.syncTiming) {
|
if (options.syncTiming) {
|
||||||
await merger.createDelays();
|
await merger.createDelays(options.syncMethod, options.targetLikeness, options.maxOffsetSeconds, options.maxSecurityFrames);
|
||||||
}
|
}
|
||||||
if (bin.MKVmerge) {
|
if (bin.MKVmerge) {
|
||||||
await merger.merge('mkvmerge', bin.MKVmerge);
|
await merger.merge('mkvmerge', bin.MKVmerge);
|
||||||
|
|
|
||||||
|
|
@ -841,7 +841,7 @@ export default class Hidive implements ServiceClass {
|
||||||
// mergers
|
// mergers
|
||||||
let isMuxed = false;
|
let isMuxed = false;
|
||||||
if (options.syncTiming) {
|
if (options.syncTiming) {
|
||||||
await merger.createDelays();
|
await merger.createDelays(options.syncMethod, options.targetLikeness, options.maxOffsetSeconds, options.maxSecurityFrames);
|
||||||
}
|
}
|
||||||
if (bin.MKVmerge) {
|
if (bin.MKVmerge) {
|
||||||
await merger.merge('mkvmerge', bin.MKVmerge);
|
await merger.merge('mkvmerge', bin.MKVmerge);
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,10 @@ let argvC: {
|
||||||
originalFontSize: boolean;
|
originalFontSize: boolean;
|
||||||
keepAllVideos: boolean;
|
keepAllVideos: boolean;
|
||||||
syncTiming: boolean;
|
syncTiming: boolean;
|
||||||
|
maxSecurityFrames: number;
|
||||||
|
maxOffsetSeconds: number;
|
||||||
|
targetLikeness: number;
|
||||||
|
syncMethod: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ArgvType = typeof argvC;
|
export type ArgvType = typeof argvC;
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ const groups = {
|
||||||
'search': 'Search:',
|
'search': 'Search:',
|
||||||
'dl': 'Downloading:',
|
'dl': 'Downloading:',
|
||||||
'mux': 'Muxing:',
|
'mux': 'Muxing:',
|
||||||
|
'timing': 'Timing Sync Options:',
|
||||||
'fileName': 'Filename Template:',
|
'fileName': 'Filename Template:',
|
||||||
'debug': 'Debug:',
|
'debug': 'Debug:',
|
||||||
'util': 'Utilities:',
|
'util': 'Utilities:',
|
||||||
|
|
@ -420,8 +421,17 @@ const args: TAppArg<boolean|number|string|unknown[]>[] = [
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'syncTiming',
|
name: 'skipmux',
|
||||||
|
describe: 'Skip muxing video, audio and subtitles',
|
||||||
|
docDescribe: true,
|
||||||
group: 'mux',
|
group: 'mux',
|
||||||
|
service: ['all'],
|
||||||
|
type: 'boolean',
|
||||||
|
usage: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'syncTiming',
|
||||||
|
group: 'timing',
|
||||||
describe: 'Attempts to sync timing for multi-dub downloads EXPERIMENTAL',
|
describe: 'Attempts to sync timing for multi-dub downloads EXPERIMENTAL',
|
||||||
docDescribe: 'If enabled attempts to sync timing for multi-dub downloads.'
|
docDescribe: 'If enabled attempts to sync timing for multi-dub downloads.'
|
||||||
+ '\nNOTE: This is currently experimental and syncs audio and subtitles, though subtitles has a lot of guesswork'
|
+ '\nNOTE: This is currently experimental and syncs audio and subtitles, though subtitles has a lot of guesswork'
|
||||||
|
|
@ -434,13 +444,59 @@ const args: TAppArg<boolean|number|string|unknown[]>[] = [
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'skipmux',
|
name: 'maxSecurityFrames',
|
||||||
describe: 'Skip muxing video, audio and subtitles',
|
group: 'timing',
|
||||||
docDescribe: true,
|
describe: 'Sets the maximum consecutive frames to check when syncing timing',
|
||||||
group: 'mux',
|
docDescribe: 'Sets the maximum consecutive frames to check when syncing timing'
|
||||||
service: ['all'],
|
+ '\nNOTE: The higher this is set, the longer it will take to process the timing differences.',
|
||||||
|
service: ['crunchy','hidive'],
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
usage: ''
|
usage: '',
|
||||||
|
default: {
|
||||||
|
default: 10
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'maxOffsetSeconds',
|
||||||
|
group: 'timing',
|
||||||
|
describe: 'The maximum amount of time that should be scanned for sync timing before failing.',
|
||||||
|
docDescribe: 'The maximum amount of time that should be scanned for sync timing before failing.'
|
||||||
|
+ '\nNOTE: The higher this is set, the more temporary images will be stored in the temp folder.',
|
||||||
|
service: ['crunchy','hidive'],
|
||||||
|
type: 'boolean',
|
||||||
|
usage: '',
|
||||||
|
default: {
|
||||||
|
default: 20
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'targetLikeness',
|
||||||
|
group: 'timing',
|
||||||
|
describe: 'The target for how like a frame should be to be considered a match.',
|
||||||
|
docDescribe: 'The target for how like a frame should be to be considered a match.'
|
||||||
|
+ '\nNOTE: Setting this too high or too low could lead to issues.',
|
||||||
|
service: ['crunchy','hidive'],
|
||||||
|
type: 'boolean',
|
||||||
|
usage: '',
|
||||||
|
default: {
|
||||||
|
default: 0.95
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'syncMethod',
|
||||||
|
choices: [1,2,3],
|
||||||
|
group: 'timing',
|
||||||
|
describe: 'Method for Syncing. Options: (1) Difference, (2) Frame Analysis, (3) Frame Analysis Slow',
|
||||||
|
docDescribe: 'Method for Syncing, Options:'
|
||||||
|
+ '\nDifference: Calculates the length difference and uses that (Fastest)'
|
||||||
|
+ '\nFrame Analysis: Analyzes frames to find a match and uses that (Medium) [Default]'
|
||||||
|
+ '\nFrame Analysis Slow: Analyzes frames using the netflix library (may not be available on every platform) for accuracy to find a match and uses that (Very Slow)',
|
||||||
|
service: ['crunchy','hidive'],
|
||||||
|
type: 'boolean',
|
||||||
|
usage: '',
|
||||||
|
default: {
|
||||||
|
default: 2
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'fileName',
|
name: 'fileName',
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ export type MergerOptions = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Defaults */
|
||||||
const SECURITY_FRAMES = 10;
|
const SECURITY_FRAMES = 10;
|
||||||
const MAX_OFFSET_SEC = 20;
|
const MAX_OFFSET_SEC = 20;
|
||||||
const LIKENESS_TARGET = 0.95;
|
const LIKENESS_TARGET = 0.95;
|
||||||
|
|
@ -78,7 +79,7 @@ class Merger {
|
||||||
this.options.videoTitle = this.options.videoTitle.replace(/"/g, '\'');
|
this.options.videoTitle = this.options.videoTitle.replace(/"/g, '\'');
|
||||||
}
|
}
|
||||||
|
|
||||||
public async createDelays() {
|
public async createDelays(syncMethod: number, LIKENESS_TARGET: number, MAX_OFFSET_SEC: number, SECURITY_FRAMES: number) {
|
||||||
if (this.options.videoAndAudio.length > 1) {
|
if (this.options.videoAndAudio.length > 1) {
|
||||||
const bin = await yamlCfg.loadBinCfg();
|
const bin = await yamlCfg.loadBinCfg();
|
||||||
const vnas = this.options.videoAndAudio;
|
const vnas = this.options.videoAndAudio;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue