aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/src/pages/Settings/Subtitles/index.tsx
blob: a2e05a5c5ae79db071ee2054fcc005e4aa772323 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
import React, { FunctionComponent } from "react";
import { Code, Space, Table, Text as MantineText } from "@mantine/core";
import {
  Check,
  CollapseBox,
  Layout,
  Message,
  MultiSelector,
  Section,
  Selector,
  Slider,
  Text,
} from "@/pages/Settings/components";
import {
  SubzeroColorModification,
  SubzeroModification,
} from "@/pages/Settings/utilities/modifications";
import {
  adaptiveSearchingDelayOption,
  adaptiveSearchingDeltaOption,
  colorOptions,
  embeddedSubtitlesParserOption,
  folderOptions,
  hiExtensionOptions,
  providerOptions,
  syncMaxOffsetSecondsOptions,
} from "./options";

interface CommandOption {
  option: string;
  description: string;
}

const commandOptions: CommandOption[] = [
  {
    option: "directory",
    description: "Full path of the episode file parent directory",
  },
  {
    option: "episode",
    description: "Full path of the episode file",
  },
  {
    option: "episode_name",
    description:
      "Filename of the episode without parent directory or extension",
  },
  {
    option: "subtitles",
    description: "Full path of the subtitles file",
  },
  {
    option: "subtitles_language",
    description: "Language of the subtitles file (may include HI or forced)",
  },
  {
    option: "subtitles_language_code2",
    description:
      "2-letter ISO-639 language code of the subtitles language (may include :hi or :forced)",
  },
  {
    option: "subtitles_language_code2_dot",
    description:
      "2-letter ISO-639 language code of the subtitles language (same as previous but with dot separator instead of colon)",
  },
  {
    option: "subtitles_language_code3",
    description:
      "3-letter ISO-639 language code of the subtitles language (may include :hi or :forced)",
  },
  {
    option: "subtitles_language_code3_dot",
    description:
      "3-letter ISO-639 language code of the subtitles language (same as previous but with dot separator instead of colon)",
  },
  {
    option: "episode_language",
    description: "Audio language of the episode file",
  },
  {
    option: "episode_language_code2",
    description: "2-letter ISO-639 language code of the episode audio language",
  },
  {
    option: "episode_language_code3",
    description: "3-letter ISO-639 language code of the episode audio language",
  },
  {
    option: "score",
    description: "Score of the subtitle file",
  },
  {
    option: "subtitle_id",
    description: "Provider ID of the subtitle file",
  },
  {
    option: "provider",
    description: "Provider of the subtitle file",
  },
  {
    option: "uploader",
    description: "Uploader of the subtitle file",
  },
  {
    option: "release_info",
    description: "Release info for the subtitle file",
  },
  {
    option: "series_id",
    description: "Sonarr series ID (Empty if movie)",
  },
  {
    option: "episode_id",
    description: "Sonarr episode ID or Radarr movie ID",
  },
];

const commandOptionElements: React.JSX.Element[] = commandOptions.map(
  (op, idx) => (
    <tr key={idx}>
      <td>
        <Code>{op.option}</Code>
      </td>
      <td>{op.description}</td>
    </tr>
  ),
);

const SettingsSubtitlesView: FunctionComponent = () => {
  return (
    <Layout name="Subtitles">
      <Section header="Basic Options">
        <Selector
          label="Subtitle Folder"
          options={folderOptions}
          settingKey="settings-general-subfolder"
        ></Selector>
        <Message>
          Choose the folder you wish to store/read the subtitles.
        </Message>
        <CollapseBox
          settingKey="settings-general-subfolder"
          on={(k) => k !== "" && k !== "current"}
        >
          <Text
            label="Custom Subtitles Folder"
            settingKey="settings-general-subfolder_custom"
          ></Text>
        </CollapseBox>
        <Selector
          label="Hearing-impaired subtitles extension"
          options={hiExtensionOptions}
          settingKey="settings-general-hi_extension"
        ></Selector>
        <Message>
          What file extension to use when saving hearing-impaired subtitles to
          disk (e.g., video.en.sdh.srt).
        </Message>
      </Section>
      <Section header="Embedded Subtitles">
        <Check
          label="Use Embedded Subtitles"
          settingKey="settings-general-use_embedded_subs"
        ></Check>
        <Message>
          Use embedded subtitles in media files when determining missing ones.
        </Message>
        <CollapseBox indent settingKey="settings-general-use_embedded_subs">
          <Selector
            settingKey="settings-general-embedded_subtitles_parser"
            settingOptions={{
              onSaved: (v) => (v === undefined ? "ffprobe" : v),
            }}
            options={embeddedSubtitlesParserOption}
          ></Selector>
          <Message>Embedded Subtitles video parser.</Message>
          <Check
            label="Ignore Embedded PGS Subtitles"
            settingKey="settings-general-ignore_pgs_subs"
          ></Check>
          <Message>
            Ignores PGS Subtitles in Embedded Subtitles detection.
          </Message>
          <Check
            label="Ignore Embedded VobSub Subtitles"
            settingKey="settings-general-ignore_vobsub_subs"
          ></Check>
          <Message>
            Ignores VobSub Subtitles in Embedded Subtitles detection.
          </Message>
          <Check
            label="Ignore Embedded ASS Subtitles"
            settingKey="settings-general-ignore_ass_subs"
          ></Check>
          <Message>
            Ignores ASS Subtitles in Embedded Subtitles detection.
          </Message>
          <Check
            label="Show Only Desired Languages"
            settingKey="settings-general-embedded_subs_show_desired"
          ></Check>
          <Message>
            Hide Embedded Subtitles for languages that are not currently
            desired.
          </Message>
        </CollapseBox>
      </Section>
      <Section header="Upgrading Subtitles">
        <Check
          label="Upgrade Previously Downloaded Subtitles"
          settingKey="settings-general-upgrade_subs"
        ></Check>
        <Message>
          Schedule a task to upgrade subtitles previously downloaded by Bazarr.
        </Message>
        <CollapseBox settingKey="settings-general-upgrade_subs">
          <Slider
            settingKey="settings-general-days_to_upgrade_subs"
            max={30}
            mb="lg"
          ></Slider>
          <Message>
            Number of days to go back in history to upgrade subtitles.
          </Message>
          <Check
            label="Upgrade Manually Downloaded or Translated Subtitles"
            settingKey="settings-general-upgrade_manual"
          ></Check>
          <Message>
            Enable or disable upgrade of manually downloaded or translated
            subtitles.
          </Message>
        </CollapseBox>
      </Section>
      <Section header="Encoding">
        <Check
          label="Encode Subtitles To UTF-8"
          settingKey="settings-general-utf8_encode"
        ></Check>
        <Message>
          Re-encode downloaded subtitles to UTF-8. Should be left enabled in
          most cases.
        </Message>
      </Section>
      <Section header="Permissions">
        <Check
          label="Change Subtitle File Permission (chmod)"
          settingKey="settings-general-chmod_enabled"
        ></Check>
        <CollapseBox indent settingKey="settings-general-chmod_enabled">
          <Text placeholder="0777" settingKey="settings-general-chmod"></Text>
          <Message>
            Must be a 4 digit octal number. Only for non-Windows systems.
          </Message>
        </CollapseBox>
      </Section>
      <Section header="Performance / Optimization">
        <Check
          label="Adaptive Searching"
          settingKey="settings-general-adaptive_searching"
        ></Check>
        <Message>
          When enabled, Bazarr will skip searching providers for subtitles which
          have been searched recently.
        </Message>
        <CollapseBox settingKey="settings-general-adaptive_searching">
          <Selector
            settingKey="settings-general-adaptive_searching_delay"
            settingOptions={{ onSaved: (v) => (v === undefined ? "3w" : v) }}
            options={adaptiveSearchingDelayOption}
          ></Selector>
          <Message>
            The delay from the first search to adaptive searching taking effect.
            During this time window Bazarr will continue to search for
            subtitles, even if they have been searched for recently.
          </Message>
          <Selector
            settingKey="settings-general-adaptive_searching_delta"
            settingOptions={{ onSaved: (v) => (v === undefined ? "1w" : v) }}
            options={adaptiveSearchingDeltaOption}
          ></Selector>
          <Message>
            The delay between Bazarr searching for subtitles in adaptive search
            mode. If the media has been searched for more recently than this
            value, Bazarr will skip searching for subtitles.
          </Message>
        </CollapseBox>
        <Check
          label="Search Enabled Providers Simultaneously"
          settingKey="settings-general-multithreading"
        ></Check>
        <Message>
          Search multiple providers at once. (Don't choose this on low powered
          devices).
        </Message>
        <Check
          label="Skip video file hash calculation"
          settingKey="settings-general-skip_hashing"
        ></Check>
        <Message>
          Skip video file hashing during search process to prevent a sleeping
          hard disk drive from waking up. However, this may decrease your search
          results scores.
        </Message>
      </Section>
      <Section header="Sub-Zero Modifications">
        <Check
          label="Hearing Impaired"
          settingOptions={{ onLoaded: SubzeroModification("remove_HI") }}
          settingKey="subzero-remove_HI"
        ></Check>
        <Message>
          Removes tags, text and characters from subtitles that are meant for
          hearing impaired people.
        </Message>
        <Check
          label="Remove Tags"
          settingOptions={{ onLoaded: SubzeroModification("remove_tags") }}
          settingKey="subzero-remove_tags"
        ></Check>
        <Message>
          Removes all possible style tags from the subtitle, such as font, bold,
          color etc.
        </Message>
        <Check
          label="OCR Fixes"
          settingOptions={{ onLoaded: SubzeroModification("OCR_fixes") }}
          settingKey="subzero-OCR_fixes"
        ></Check>
        <Message>
          Fix issues that happen when a subtitle gets converted from bitmap to
          text through OCR.
        </Message>
        <Check
          label="Common Fixes"
          settingOptions={{ onLoaded: SubzeroModification("common") }}
          settingKey="subzero-common"
        ></Check>
        <Message>
          Fix common and whitespace/punctuation issues in subtitles.
        </Message>
        <Check
          label="Fix Uppercase"
          settingOptions={{
            onLoaded: SubzeroModification("fix_uppercase"),
          }}
          settingKey="subzero-fix_uppercase"
        ></Check>
        <Message>
          Tries to make subtitles that are completely uppercase readable.
        </Message>
        <Selector
          placeholder="Select a color..."
          label="Color"
          clearable
          options={colorOptions}
          settingOptions={{ onLoaded: SubzeroColorModification }}
          settingKey="subzero-color"
        ></Selector>
        <Message>
          Adds color to your subtitles (for playback devices/software that don't
          ship their own color modes; only works for players that support color
          tags).
        </Message>
        <Check
          label="Reverse RTL"
          settingOptions={{ onLoaded: SubzeroModification("reverse_rtl") }}
          settingKey="subzero-reverse_rtl"
        ></Check>
        <Message>
          Reverses the punctuation in right-to-left subtitles for problematic
          playback devices.
        </Message>
      </Section>
      <Section header="Synchronization / Alignment">
        <Check
          label="Always use Audio Track as Reference for Syncing"
          settingKey="settings-subsync-force_audio"
        ></Check>
        <Message>
          Use the audio track as reference for syncing, instead of the embedded
          subtitle.
        </Message>
        <Check
          label="No Fix Framerate"
          settingKey="settings-subsync-no_fix_framerate"
        ></Check>
        <Message>
          If specified, subsync will not attempt to correct a framerate mismatch
          between reference and subtitles.
        </Message>
        <Check
          label="Golden-Section Search"
          settingKey="settings-subsync-gss"
        ></Check>
        <Message>
          If specified, use golden-section search to try to find the optimal
          framerate ratio between video and subtitles.
        </Message>
        <Selector
          label="Max Offset Seconds"
          options={syncMaxOffsetSecondsOptions}
          settingKey="settings-subsync-max_offset_seconds"
          defaultValue={60}
        ></Selector>
        <Message>
          The max allowed offset seconds for any subtitle segment.
        </Message>
        <Check
          label="Automatic Subtitles Synchronization"
          settingKey="settings-subsync-use_subsync"
        ></Check>
        <Message>
          Enable automatic synchronization after downloading subtitles.
        </Message>
        <CollapseBox indent settingKey="settings-subsync-use_subsync">
          <MultiSelector
            placeholder="Select providers..."
            label="Do not sync subtitles downloaded from those providers"
            clearable
            options={providerOptions}
            settingKey="settings-subsync-checker-blacklisted_providers"
          ></MultiSelector>
          <Check label="Debug" settingKey="settings-subsync-debug"></Check>
          <Message>
            Do not actually sync the subtitles but generate a .tar.gz file to be
            able to open an issue for ffsubsync. This file will reside alongside
            the media file.
          </Message>
          <Check
            label="Series Score Threshold"
            settingKey="settings-subsync-use_subsync_threshold"
          ></Check>
          <CollapseBox
            indent
            settingKey="settings-subsync-use_subsync_threshold"
          >
            <Slider settingKey="settings-subsync-subsync_threshold"></Slider>
            <Space />
            <Message>
              Only series subtitles with scores{" "}
              <MantineText fw={700} span>
                below
              </MantineText>{" "}
              this value will be automatically synchronized.
            </Message>
          </CollapseBox>
          <Check
            label="Movies Score Threshold"
            settingKey="settings-subsync-use_subsync_movie_threshold"
          ></Check>
          <CollapseBox
            indent
            settingKey="settings-subsync-use_subsync_movie_threshold"
          >
            <Slider settingKey="settings-subsync-subsync_movie_threshold"></Slider>
            <Space />
            <Message>
              Only movie subtitles with scores{" "}
              <MantineText fw={700} span>
                below
              </MantineText>{" "}
              this value will be automatically synchronized.
            </Message>
          </CollapseBox>
        </CollapseBox>
      </Section>
      <Section header="Custom Post-Processing">
        <Check
          settingKey="settings-general-use_postprocessing"
          label="Custom Post-Processing"
        ></Check>
        <Message>
          Enable automatic execution of the post-processing command specified
          below after downloading a subtitle.
        </Message>
        <CollapseBox indent settingKey="settings-general-use_postprocessing">
          <Check
            settingKey="settings-general-use_postprocessing_threshold"
            label="Series Score Threshold"
          ></Check>
          <CollapseBox
            indent
            settingKey="settings-general-use_postprocessing_threshold"
          >
            <Slider settingKey="settings-general-postprocessing_threshold"></Slider>
            <Space />
            <Message>
              Only series subtitles with scores{" "}
              <MantineText fw={700} span>
                below
              </MantineText>{" "}
              this value will be automatically post-processed.
            </Message>
          </CollapseBox>
          <Check
            settingKey="settings-general-use_postprocessing_threshold_movie"
            label="Movies Score Threshold"
          ></Check>
          <CollapseBox
            indent
            settingKey="settings-general-use_postprocessing_threshold_movie"
          >
            <Slider settingKey="settings-general-postprocessing_threshold_movie"></Slider>
            <Space />
            <Message>
              Only movie subtitles with scores{" "}
              <MantineText fw={700} span>
                below
              </MantineText>{" "}
              this value will be automatically post-processed.
            </Message>
          </CollapseBox>
          <Text
            label="Command"
            settingKey="settings-general-postprocessing_cmd"
          ></Text>
          <Table highlightOnHover fs="sm">
            <tbody>{commandOptionElements}</tbody>
          </Table>
        </CollapseBox>
      </Section>
    </Layout>
  );
};

export default SettingsSubtitlesView;