Skip to content

Commit d5d34a5

Browse files
fix: dropdowns work now, + summarize what settings are left in a TODO
1 parent ca44c1e commit d5d34a5

File tree

4 files changed

+56
-33
lines changed

4 files changed

+56
-33
lines changed

lib/models/settings_model.dart

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/// TODO:
2+
/// streamType
3+
/// dvblang
4+
/// ocrlang
5+
/// mkvlang
6+
/// quant in UI
7+
/// oem in UI
8+
/// -ru1/ru2/ru3
9+
/// codec/nocodec
10+
/// start/end credit stuff
11+
/// teletextstuff in UI
12+
/// hardsubx settings
13+
114
class SettingsModel {
215
//DROPDOWN
316
String out;
@@ -72,7 +85,7 @@ class SettingsModel {
7285
bool xmltvonlycurrent;
7386
bool sem;
7487
//DROPDOWN
75-
String quantmode;
88+
String quant;
7689
String oem;
7790

7891
// Options that affect how ccextractor reads and writes (buffering):
@@ -88,7 +101,7 @@ class SettingsModel {
88101
String startat;
89102
String endat;
90103

91-
// Teletext related options: TODO
104+
// Teletext related options:
92105
String tpage;
93106
bool teletext;
94107
bool noteletext;
@@ -149,7 +162,7 @@ class SettingsModel {
149162
this.xmltvoutputinterval = '',
150163
this.xmltvonlycurrent = false,
151164
this.sem = false,
152-
this.quantmode = 'auto/default',
165+
this.quant = 'auto/default',
153166
this.oem = '',
154167
this.bufferinput = false,
155168
this.nobufferinput = false,
@@ -222,7 +235,7 @@ class SettingsModel {
222235
String? xmltvoutputinterval,
223236
bool? xmltvonlycurrent,
224237
bool? sem,
225-
String? quantmode,
238+
String? quant,
226239
String? oem,
227240
bool? bufferinput,
228241
bool? nobufferinput,
@@ -294,7 +307,7 @@ class SettingsModel {
294307
xmltvoutputinterval: xmltvoutputinterval ?? this.xmltvoutputinterval,
295308
xmltvonlycurrent: xmltvonlycurrent ?? this.xmltvonlycurrent,
296309
sem: sem ?? this.sem,
297-
quantmode: quantmode ?? this.quantmode,
310+
quant: quant ?? this.quant,
298311
oem: oem ?? this.oem,
299312
bufferinput: bufferinput ?? this.bufferinput,
300313
nobufferinput: nobufferinput ?? this.nobufferinput,
@@ -368,7 +381,7 @@ class SettingsModel {
368381
'xmltvoutputinterval': '-xmltvoutputinterval',
369382
'xmltvonlycurrent': '-xmltvonlycurrent',
370383
'sem': '-sem',
371-
'quantmode': '-quant',
384+
'quant': '-quant',
372385
'oem': '-oem',
373386
'bufferinput': '--bufferinput',
374387
'nobufferinput': '-nobufferinput',
@@ -443,7 +456,7 @@ class SettingsModel {
443456
'xmltvoutputinterval': xmltvoutputinterval,
444457
'xmltvonlycurrent': xmltvonlycurrent,
445458
'sem': sem,
446-
'quantmode': quantmode,
459+
'quant': quant,
447460
'oem': oem,
448461
'bufferinput': bufferinput,
449462
'nobufferinput': nobufferinput,
@@ -518,7 +531,7 @@ class SettingsModel {
518531
xmltvoutputinterval: map['xmltvoutputinterval'],
519532
xmltvonlycurrent: map['xmltvonlycurrent'],
520533
sem: map['sem'],
521-
quantmode: map['quantmode'],
534+
quant: map['quant'],
522535
oem: map['oem'],
523536
bufferinput: map['bufferinput'],
524537
nobufferinput: map['nobufferinput'],
@@ -537,7 +550,7 @@ class SettingsModel {
537550

538551
@override
539552
String toString() {
540-
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, datapid: $datapid, 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, kf: $kf, 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, quantmode: $quantmode, oem: $oem, bufferinput: $bufferinput, nobufferinput: $nobufferinput, buffersize: $buffersize, koc: $koc, dru: $dru, norollup: $norollup, delay: $delay, startat: $startat, endat: $endat, tpage: $tpage, teletext: $teletext, noteletext: $noteletext)';
553+
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, datapid: $datapid, 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, kf: $kf, 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, quant: $quant, oem: $oem, bufferinput: $bufferinput, nobufferinput: $nobufferinput, buffersize: $buffersize, koc: $koc, dru: $dru, norollup: $norollup, delay: $delay, startat: $startat, endat: $endat, tpage: $tpage, teletext: $teletext, noteletext: $noteletext)';
541554
}
542555

543556
/// returns all toggeles which are enabled (excluding textfields)
@@ -627,7 +640,7 @@ class SettingsModel {
627640
other.xmltvoutputinterval == xmltvoutputinterval &&
628641
other.xmltvonlycurrent == xmltvonlycurrent &&
629642
other.sem == sem &&
630-
other.quantmode == quantmode &&
643+
other.quant == quant &&
631644
other.oem == oem &&
632645
other.bufferinput == bufferinput &&
633646
other.nobufferinput == nobufferinput &&
@@ -701,7 +714,7 @@ class SettingsModel {
701714
xmltvoutputinterval.hashCode ^
702715
xmltvonlycurrent.hashCode ^
703716
sem.hashCode ^
704-
quantmode.hashCode ^
717+
quant.hashCode ^
705718
oem.hashCode ^
706719
bufferinput.hashCode ^
707720
nobufferinput.hashCode ^

lib/repositories/settings_repository.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,16 @@ class SettingsRepository {
7575
paramsList.add('-' + param.values.first);
7676
} else if (param.keys.first == 'out' || param.keys.first == 'inp') {
7777
paramsList.add('-' + param.keys.first + '=' + param.values.first);
78+
} else if (dropdownListMap.keys.contains(param.keys.first)) {
79+
/// this part handles the dropdown menus, ccx takes in arg xmltv 3 ,
80+
/// which is the same as "Both" option in the GUI, if the enabled setting
81+
/// is in dropdownListMap we search for the particular setting, xmltv in
82+
/// this case, then we get a map with the corresponding settings and the
83+
/// int ccx takes for eg: "Both": 3, then we pass this value to paramsList
84+
/// auto/default can take in anyvalue because that is filtered out during
85+
/// [settings.enabledtextfields]
86+
paramsList.add(
87+
dropdownListMap[param.keys.first]![param.values.first].toString());
7888
} else {
7989
paramsList.add(param.values.first);
8090
}

lib/screens/settings/output_settings.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ class OutputSettingsScreen extends StatelessWidget {
355355
subtitle:
356356
'Produce an XMLTV file containing the EPG data from the source TS file',
357357
value: state.settingsModel.xmltv,
358-
items: xmltv,
358+
items: dropdownListMap['xmltv']!.keys.toList(),
359359
onChanged: (value) => context.read<SettingsBloc>().add(
360360
SettingsUpdatedEvent(
361361
state.settingsModel.copyWith(

lib/utils/constants.dart

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,34 @@ const kBgLightColor = Color(0xFF303030);
44
const kBgDarkColor = Color(0xFF181818);
55
const kDefaultPadding = 20.0;
66

7+
Map<String, Map<String, int>> dropdownListMap = {
8+
'xmltv': {
9+
'auto/default': 69, // this wont happen so any random value for now.
10+
'Full output': 1,
11+
'Live output': 2,
12+
'Both': 3,
13+
},
14+
'quant': {
15+
'auto/default': 69,
16+
'Don\'t quantize at all.': 0,
17+
'Use CCExtractor\'s internal function (default).': 1,
18+
'Reduce distinct color count in image for faster results.': 2,
19+
},
20+
'oem': {
21+
'auto/default': 69,
22+
'OEM_TESSERACT_ONLY - the fastest mode.': 0,
23+
'OEM_LSTM_ONLY - use LSTM algorithm for recognition.': 1,
24+
'OEM_TESSERACT_LSTM_COMBINED - both algorithms.': 2,
25+
},
26+
};
27+
728
List<String> encoder = [
829
'auto/default',
930
'utf8',
1031
'unicode',
1132
'latin1',
1233
];
1334

14-
List<String> xmltv = [
15-
'auto/default',
16-
'Full output',
17-
'Live output',
18-
'Both',
19-
];
20-
2135
/// Input formats
2236
List<String> inputFormats = [
2337
'auto/default',
@@ -31,20 +45,6 @@ List<String> inputFormats = [
3145
'mp4'
3246
];
3347

34-
List<String> quantMode = [
35-
'auto/default',
36-
'Don\'t quantize at all.',
37-
'Use CCExtractor\'s internal function (default).',
38-
'Reduce distinct color count in image for faster results.',
39-
];
40-
41-
List<String> oem = [
42-
'auto/default',
43-
'OEM_TESSERACT_ONLY - the fastest mode.',
44-
'OEM_LSTM_ONLY - use LSTM algorithm for recognition.',
45-
'OEM_TESSERACT_LSTM_COMBINED - both algorithms.',
46-
];
47-
4848
/// Output formats
4949
List<String> outputFormats = [
5050
'auto/default',

0 commit comments

Comments
 (0)