Skip to content

Commit 111ab7c

Browse files
finish adding all settings, including hardsubx
1 parent 3948f17 commit 111ab7c

File tree

7 files changed

+566
-139
lines changed

7 files changed

+566
-139
lines changed

lib/models/settings_model.dart

Lines changed: 194 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
/// TODO:
2-
/// quant , oem, dvb/mkv/ocrlang, teletextstuff in UI this is also in hardsubx
3-
/// hardsubx settings
4-
51
class SettingsModel {
62
//DROPDOWN
73
String out;
@@ -114,6 +110,17 @@ class SettingsModel {
114110
String tpage;
115111
bool teletext;
116112
bool noteletext;
113+
114+
// Hardsubx
115+
bool hardsubx;
116+
bool tickertext;
117+
String ocrMode;
118+
String subcolor;
119+
String minSubDuration;
120+
bool detectItalics;
121+
String confThresh;
122+
String whiteThresh;
123+
117124
SettingsModel({
118125
this.out = 'auto/default',
119126
this.inp = 'auto/default',
@@ -177,7 +184,7 @@ class SettingsModel {
177184
this.mkvlang = '',
178185
this.ocrlang = '',
179186
this.quant = 'auto/default',
180-
this.oem = '',
187+
this.oem = 'auto/default',
181188
this.bufferinput = false,
182189
this.nobufferinput = false,
183190
this.buffersize = '',
@@ -201,8 +208,139 @@ class SettingsModel {
201208
this.tpage = '',
202209
this.teletext = false,
203210
this.noteletext = false,
211+
this.hardsubx = false,
212+
this.tickertext = false,
213+
this.ocrMode = 'auto/default',
214+
this.subcolor = '',
215+
this.minSubDuration = '',
216+
this.detectItalics = false,
217+
this.confThresh = '',
218+
this.whiteThresh = '',
204219
});
205220

221+
static Map<String, String> get paramsLookUpMap {
222+
return {
223+
'out': '-out=',
224+
'in': '-in=',
225+
'outputfilename': '-o',
226+
'fixptsjumps': '-fixptsjumps',
227+
'append': '--append',
228+
'outInterval': '--outinterval',
229+
'segmentonkeyonly': '--segmentonkeyonly',
230+
'goptime': '--goptime',
231+
'nogoptime': '--nogoptime',
232+
'fixpadding': '--fixpadding',
233+
'freqEs15': '-90090',
234+
'stream': '--stream',
235+
'videoedited': '--videoedited',
236+
'usepicorder': '--usepicorder',
237+
'myth': '-myth',
238+
'nomyth': '-nomyth',
239+
'wtvconvertfix': '-wtvconvertfix',
240+
'wtvmpeg2': '-wtvmpeg2',
241+
'program_number': '--program-number',
242+
'autoprogram': '-autoprogram',
243+
'multiprogram': '-multiprogram',
244+
'streamtype': '-streamtype',
245+
'hauppauge': '--hauppauge',
246+
'mp4vidtrack': '-mp4vidtrack',
247+
'noautotimeref': '-noautotimeref',
248+
'noscte20': '--noscte20',
249+
'webvttcss': '--webvtt-create-css',
250+
'analyzevideo': '--analyzevideo',
251+
'notimestamp': '--no-timestamp-map',
252+
'nolevdist': '-nolevdist',
253+
'minlevdist': '-levdistmincnt',
254+
'maxlevdist': '-levdistmaxpct',
255+
'chapters': '-chapters',
256+
'bom': '-bom',
257+
'nobom': '-nobom',
258+
'nofontcolor': '--nofontcolor',
259+
'nohtmlescape': '--nohtmlescape',
260+
'notypesetting': '--notypesetting',
261+
'trim': '-trim',
262+
'defaultcolor': '--defaultcolor',
263+
'sentencecap': '--sentencecap',
264+
'capFile': '--capfile',
265+
'kf': '--kf',
266+
'profanityFile': '--profanity-file',
267+
'splitbysentence': '--splitbysentence',
268+
'datets': '-datets',
269+
'sects': '-sects',
270+
'latrusmap': '-latrusmap',
271+
'xds': '=xds',
272+
'lf': '-lf',
273+
'df': '-df',
274+
'autodash': '- autodash',
275+
'xmltv': '-xmltv',
276+
'xmltvliveinterval': '-xmltvliveinterval',
277+
'xmltvoutputinterval': '-xmltvoutputinterval',
278+
'xmltvonlycurrent': '-xmltvonlycurrent',
279+
'sem': '-sem',
280+
'dvblang': '-dvblang',
281+
'ocrlang': '-ocrlang',
282+
'mkvlang': '-mkvlang',
283+
'quant': '-quant',
284+
'oem': '-oem',
285+
'bufferinput': '--bufferinput',
286+
'nobufferinput': '-nobufferinput',
287+
'buffersize': '--buffersize',
288+
'koc': '-koc',
289+
'dru': '-dru',
290+
'norollup': '--norollup',
291+
'delay': '-delay',
292+
'startat': '-startat',
293+
'endat': '-endat',
294+
'codec': '-codec',
295+
'nocodec': 'nocodec',
296+
'startcreditstext': '--startcreditstext',
297+
'startcreditsnotbefore': '--startcreditsnotbefore',
298+
'startcreditsnotafter': '--startcreditsnotafter',
299+
'startcreditsforatleast': '--startcreditsforatleast',
300+
'startcreditsforatmost': '--startcreditsforatmost',
301+
'endcreditstext': '--endcreditstext',
302+
'endcreditsforatleast': '--endcreditsforatleast',
303+
'endcreditsforatmost': '--endcreditsforatmost',
304+
'tpage': '-tpage',
305+
'teletext': '-teletext',
306+
'noteletext': '-noteletext',
307+
'hardsubx': '-hardsubx',
308+
'tickertext': '-tickertext',
309+
'ocrMode': '-ocr_mode',
310+
'subcolor': '-subcolor',
311+
'minSubDuration': '-min_sub_duration',
312+
'detectItalics': '-detect_italics',
313+
'confThresh': '-conf_thresh',
314+
'whiteThresh': '-whiteness_thresh',
315+
};
316+
}
317+
318+
/// returns all toggeles which are enabled (excluding textfields)
319+
List<String> get enabledSettings {
320+
List<String> enabledSettings = [];
321+
toJson().forEach((key, value) {
322+
if (value == true) {
323+
enabledSettings.add(key);
324+
}
325+
});
326+
return enabledSettings;
327+
}
328+
329+
/// return all textfields and dropdowns which are not empty or not set to default
330+
List<Map<String, String>> get enabledtextfields {
331+
List<Map<String, String>> enabledtextfields = [];
332+
toJson().forEach(
333+
(key, value) {
334+
Map<String, String> textfield = {};
335+
if (value is String && value.isNotEmpty && value != 'auto/default') {
336+
textfield[key] = value;
337+
enabledtextfields.add(textfield);
338+
}
339+
},
340+
);
341+
return enabledtextfields;
342+
}
343+
206344
SettingsModel copyWith({
207345
String? out,
208346
String? inp,
@@ -290,6 +428,14 @@ class SettingsModel {
290428
String? tpage,
291429
bool? teletext,
292430
bool? noteletext,
431+
bool? hardsubx,
432+
bool? tickertext,
433+
String? ocrMode,
434+
String? subcolor,
435+
String? minSubDuration,
436+
bool? detectItalics,
437+
String? confThresh,
438+
String? whiteThresh,
293439
}) {
294440
return SettingsModel(
295441
out: out ?? this.out,
@@ -381,124 +527,17 @@ class SettingsModel {
381527
tpage: tpage ?? this.tpage,
382528
teletext: teletext ?? this.teletext,
383529
noteletext: noteletext ?? this.noteletext,
530+
hardsubx: hardsubx ?? this.hardsubx,
531+
tickertext: tickertext ?? this.tickertext,
532+
ocrMode: ocrMode ?? this.ocrMode,
533+
subcolor: subcolor ?? this.subcolor,
534+
minSubDuration: minSubDuration ?? this.minSubDuration,
535+
detectItalics: detectItalics ?? this.detectItalics,
536+
confThresh: confThresh ?? this.confThresh,
537+
whiteThresh: whiteThresh ?? this.whiteThresh,
384538
);
385539
}
386540

387-
static Map<String, String> get paramsLookUpMap {
388-
return {
389-
'out': '-out=',
390-
'in': '-in=',
391-
'outputfilename': '-o',
392-
'fixptsjumps': '-fixptsjumps',
393-
'append': '--append',
394-
'outInterval': '--outinterval',
395-
'segmentonkeyonly': '--segmentonkeyonly',
396-
'goptime': '--goptime',
397-
'nogoptime': '--nogoptime',
398-
'fixpadding': '--fixpadding',
399-
'freqEs15': '-90090',
400-
'stream': '--stream',
401-
'videoedited': '--videoedited',
402-
'usepicorder': '--usepicorder',
403-
'myth': '-myth',
404-
'nomyth': '-nomyth',
405-
'wtvconvertfix': '-wtvconvertfix',
406-
'wtvmpeg2': '-wtvmpeg2',
407-
'program_number': '--program-number',
408-
'autoprogram': '-autoprogram',
409-
'multiprogram': '-multiprogram',
410-
'streamtype': '-streamtype',
411-
'hauppauge': '--hauppauge',
412-
'mp4vidtrack': '-mp4vidtrack',
413-
'noautotimeref': '-noautotimeref',
414-
'noscte20': '--noscte20',
415-
'webvttcss': '--webvtt-create-css',
416-
'analyzevideo': '--analyzevideo',
417-
'notimestamp': '--no-timestamp-map',
418-
'nolevdist': '-nolevdist',
419-
'minlevdist': '-levdistmincnt',
420-
'maxlevdist': '-levdistmaxpct',
421-
'chapters': '-chapters',
422-
'bom': '-bom',
423-
'nobom': '-nobom',
424-
'nofontcolor': '--nofontcolor',
425-
'nohtmlescape': '--nohtmlescape',
426-
'notypesetting': '--notypesetting',
427-
'trim': '-trim',
428-
'defaultcolor': '--defaultcolor',
429-
'sentencecap': '--sentencecap',
430-
'capFile': '--capfile',
431-
'kf': '--kf',
432-
'profanityFile': '--profanity-file',
433-
'splitbysentence': '--splitbysentence',
434-
'datets': '-datets',
435-
'sects': '-sects',
436-
'latrusmap': '-latrusmap',
437-
'xds': '=xds',
438-
'lf': '-lf',
439-
'df': '-df',
440-
'autodash': '- autodash',
441-
'xmltv': '-xmltv',
442-
'xmltvliveinterval': '-xmltvliveinterval',
443-
'xmltvoutputinterval': '-xmltvoutputinterval',
444-
'xmltvonlycurrent': '-xmltvonlycurrent',
445-
'sem': '-sem',
446-
'dvblang': '-dvblang',
447-
'ocrlang': '-ocrlang',
448-
'mkvlang': '-mkvlang',
449-
'quant': '-quant',
450-
'oem': '-oem',
451-
'bufferinput': '--bufferinput',
452-
'nobufferinput': '-nobufferinput',
453-
'buffersize': '--buffersize',
454-
'koc': '-koc',
455-
'dru': '-dru',
456-
'norollup': '--norollup',
457-
'delay': '-delay',
458-
'startat': '-startat',
459-
'endat': '-endat',
460-
'codec': '-codec',
461-
'nocodec': 'nocodec',
462-
'startcreditstext': '--startcreditstext',
463-
'startcreditsnotbefore': '--startcreditsnotbefore',
464-
'startcreditsnotafter': '--startcreditsnotafter',
465-
'startcreditsforatleast': '--startcreditsforatleast',
466-
'startcreditsforatmost': '--startcreditsforatmost',
467-
'endcreditstext': '--endcreditstext',
468-
'endcreditsforatleast': '--endcreditsforatleast',
469-
'endcreditsforatmost': '--endcreditsforatmost',
470-
'tpage': '-tpage',
471-
'teletext': '-teletext',
472-
'noteletext': '-noteletext',
473-
};
474-
}
475-
476-
/// returns all toggeles which are enabled (excluding textfields)
477-
List<String> get enabledSettings {
478-
List<String> enabledSettings = [];
479-
toJson().forEach((key, value) {
480-
if (value == true) {
481-
enabledSettings.add(key);
482-
}
483-
});
484-
return enabledSettings;
485-
}
486-
487-
/// return all textfields and dropdowns which are not empty or not set to default
488-
List<Map<String, String>> get enabledtextfields {
489-
List<Map<String, String>> enabledtextfields = [];
490-
toJson().forEach(
491-
(key, value) {
492-
Map<String, String> textfield = {};
493-
if (value is String && value.isNotEmpty && value != 'auto/default') {
494-
textfield[key] = value;
495-
enabledtextfields.add(textfield);
496-
}
497-
},
498-
);
499-
return enabledtextfields;
500-
}
501-
502541
Map<String, dynamic> toJson() {
503542
return {
504543
'out': out,
@@ -587,6 +626,14 @@ class SettingsModel {
587626
'tpage': tpage,
588627
'teletext': teletext,
589628
'noteletext': noteletext,
629+
'hardsubx': hardsubx,
630+
'tickertext': tickertext,
631+
'ocrMode': ocrMode,
632+
'subcolor': subcolor,
633+
'minSubDuration': minSubDuration,
634+
'detectItalics': detectItalics,
635+
'confThresh': confThresh,
636+
'whiteThresh': whiteThresh,
590637
};
591638
}
592639

@@ -678,12 +725,20 @@ class SettingsModel {
678725
tpage: map['tpage'],
679726
teletext: map['teletext'],
680727
noteletext: map['noteletext'],
728+
hardsubx: map['hardsubx'],
729+
tickertext: map['tickertext'],
730+
ocrMode: map['ocrMode'],
731+
subcolor: map['subcolor'],
732+
minSubDuration: map['minSubDuration'],
733+
detectItalics: map['detectItalics'],
734+
confThresh: map['confThresh'],
735+
whiteThresh: map['whiteThresh'],
681736
);
682737
}
683738

684739
@override
685740
String toString() {
686-
return 'SettingsModel(out: $out, inp: $inp, outputfilename: $outputfilename, fixptsjumps: $fixptsjumps, append: $append, outInterval: $outInterval, segmentonkeyonly: $segmentonkeyonly, goptime: $goptime, nogoptime: $nogoptime, fixpadding: $fixpadding, freqEs15: $freqEs15, stream: $stream, videoedited: $videoedited, usepicorder: $usepicorder, myth: $myth, nomyth: $nomyth, wtvconvertfix: $wtvconvertfix, wtvmpeg2: $wtvmpeg2, program_number: $program_number, autoprogram: $autoprogram, multiprogram: $multiprogram, streamtype: $streamtype, hauppauge: $hauppauge, mp4vidtrack: $mp4vidtrack, noautotimeref: $noautotimeref, noscte20: $noscte20, webvttcss: $webvttcss, analyzevideo: $analyzevideo, notimestamp: $notimestamp, nolevdist: $nolevdist, minlevdist: $minlevdist, maxlevdist: $maxlevdist, chapters: $chapters, bom: $bom, nobom: $nobom, encoder: $encoder, nofontcolor: $nofontcolor, nohtmlescape: $nohtmlescape, notypesetting: $notypesetting, trim: $trim, defaultcolor: $defaultcolor, sentencecap: $sentencecap, capFile: $capFile, kf: $kf, profanityFile: $profanityFile, splitbysentence: $splitbysentence, datets: $datets, sects: $sects, latrusmap: $latrusmap, xds: $xds, lf: $lf, df: $df, autodash: $autodash, xmltv: $xmltv, xmltvliveinterval: $xmltvliveinterval, xmltvoutputinterval: $xmltvoutputinterval, xmltvonlycurrent: $xmltvonlycurrent, sem: $sem, dvblang: $dvblang, mkvlang: $mkvlang, ocrlang: $ocrlang, quant: $quant, oem: $oem, bufferinput: $bufferinput, nobufferinput: $nobufferinput, buffersize: $buffersize, koc: $koc, dru: $dru, norollup: $norollup, rollUp: $rollUp, delay: $delay, startat: $startat, endat: $endat, codec: $codec, nocodec: $nocodec, startcreditstext: $startcreditstext, startcreditsnotbefore: $startcreditsnotbefore, startcreditsnotafter: $startcreditsnotafter, startcreditsforatleast: $startcreditsforatleast, startcreditsforatmost: $startcreditsforatmost, endcreditstext: $endcreditstext, endcreditsforatleast: $endcreditsforatleast, endcreditsforatmost: $endcreditsforatmost, tpage: $tpage, teletext: $teletext, noteletext: $noteletext)';
741+
return 'SettingsModel(out: $out, inp: $inp, outputfilename: $outputfilename, fixptsjumps: $fixptsjumps, append: $append, outInterval: $outInterval, segmentonkeyonly: $segmentonkeyonly, goptime: $goptime, nogoptime: $nogoptime, fixpadding: $fixpadding, freqEs15: $freqEs15, stream: $stream, videoedited: $videoedited, usepicorder: $usepicorder, myth: $myth, nomyth: $nomyth, wtvconvertfix: $wtvconvertfix, wtvmpeg2: $wtvmpeg2, program_number: $program_number, autoprogram: $autoprogram, multiprogram: $multiprogram, streamtype: $streamtype, hauppauge: $hauppauge, mp4vidtrack: $mp4vidtrack, noautotimeref: $noautotimeref, noscte20: $noscte20, webvttcss: $webvttcss, analyzevideo: $analyzevideo, notimestamp: $notimestamp, nolevdist: $nolevdist, minlevdist: $minlevdist, maxlevdist: $maxlevdist, chapters: $chapters, bom: $bom, nobom: $nobom, encoder: $encoder, nofontcolor: $nofontcolor, nohtmlescape: $nohtmlescape, notypesetting: $notypesetting, trim: $trim, defaultcolor: $defaultcolor, sentencecap: $sentencecap, capFile: $capFile, kf: $kf, profanityFile: $profanityFile, splitbysentence: $splitbysentence, datets: $datets, sects: $sects, latrusmap: $latrusmap, xds: $xds, lf: $lf, df: $df, autodash: $autodash, xmltv: $xmltv, xmltvliveinterval: $xmltvliveinterval, xmltvoutputinterval: $xmltvoutputinterval, xmltvonlycurrent: $xmltvonlycurrent, sem: $sem, dvblang: $dvblang, mkvlang: $mkvlang, ocrlang: $ocrlang, quant: $quant, oem: $oem, bufferinput: $bufferinput, nobufferinput: $nobufferinput, buffersize: $buffersize, koc: $koc, dru: $dru, norollup: $norollup, rollUp: $rollUp, delay: $delay, startat: $startat, endat: $endat, codec: $codec, nocodec: $nocodec, startcreditstext: $startcreditstext, startcreditsnotbefore: $startcreditsnotbefore, startcreditsnotafter: $startcreditsnotafter, startcreditsforatleast: $startcreditsforatleast, startcreditsforatmost: $startcreditsforatmost, endcreditstext: $endcreditstext, endcreditsforatleast: $endcreditsforatleast, endcreditsforatmost: $endcreditsforatmost, tpage: $tpage, teletext: $teletext, noteletext: $noteletext, hardsubx: $hardsubx, tickertext: $tickertext, ocrMode: $ocrMode, subcolor: $subcolor, minSubDuration: $minSubDuration, detectItalics: $detectItalics, confThresh: $confThresh, whiteThresh: $whiteThresh)';
687742
}
688743

689744
@override
@@ -776,7 +831,15 @@ class SettingsModel {
776831
other.endcreditsforatmost == endcreditsforatmost &&
777832
other.tpage == tpage &&
778833
other.teletext == teletext &&
779-
other.noteletext == noteletext;
834+
other.noteletext == noteletext &&
835+
other.hardsubx == hardsubx &&
836+
other.tickertext == tickertext &&
837+
other.ocrMode == ocrMode &&
838+
other.subcolor == subcolor &&
839+
other.minSubDuration == minSubDuration &&
840+
other.detectItalics == detectItalics &&
841+
other.confThresh == confThresh &&
842+
other.whiteThresh == whiteThresh;
780843
}
781844

782845
@override
@@ -866,6 +929,14 @@ class SettingsModel {
866929
endcreditsforatmost.hashCode ^
867930
tpage.hashCode ^
868931
teletext.hashCode ^
869-
noteletext.hashCode;
932+
noteletext.hashCode ^
933+
hardsubx.hashCode ^
934+
tickertext.hashCode ^
935+
ocrMode.hashCode ^
936+
subcolor.hashCode ^
937+
minSubDuration.hashCode ^
938+
detectItalics.hashCode ^
939+
confThresh.hashCode ^
940+
whiteThresh.hashCode;
870941
}
871942
}

0 commit comments

Comments
 (0)