2022-06-02 05:51:25 +00:00
|
|
|
import { Anchor, Code, Table } from "@mantine/core";
|
2022-03-16 06:26:15 +00:00
|
|
|
import { FunctionComponent } from "react";
|
2021-03-25 14:22:43 +00:00
|
|
|
import {
|
|
|
|
Check,
|
|
|
|
CollapseBox,
|
2022-03-16 06:26:15 +00:00
|
|
|
Layout,
|
2021-03-25 14:22:43 +00:00
|
|
|
Message,
|
2022-05-31 15:49:04 +00:00
|
|
|
Password,
|
|
|
|
Section,
|
2021-03-25 14:22:43 +00:00
|
|
|
Selector,
|
|
|
|
Slider,
|
|
|
|
Text,
|
|
|
|
} from "../components";
|
2022-06-30 15:35:23 +00:00
|
|
|
import {
|
|
|
|
SubzeroColorModification,
|
|
|
|
SubzeroModification,
|
|
|
|
} from "../utilities/modifications";
|
2021-12-24 15:00:47 +00:00
|
|
|
import {
|
|
|
|
adaptiveSearchingDelayOption,
|
|
|
|
adaptiveSearchingDeltaOption,
|
|
|
|
antiCaptchaOption,
|
|
|
|
colorOptions,
|
2022-12-21 04:37:52 +00:00
|
|
|
embeddedSubtitlesParserOption,
|
2021-12-24 15:00:47 +00:00
|
|
|
folderOptions,
|
2022-01-08 19:26:40 +00:00
|
|
|
hiExtensionOptions,
|
2021-12-24 15:00:47 +00:00
|
|
|
} from "./options";
|
2021-03-25 14:22:43 +00:00
|
|
|
|
2022-06-02 05:51:25 +00:00
|
|
|
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: "series_id",
|
|
|
|
description: "Sonarr series ID (Empty if movie)",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
option: "episode_id",
|
|
|
|
description: "Sonarr episode ID or Radarr movie ID",
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const commandOptionElements: JSX.Element[] = commandOptions.map((op, idx) => (
|
|
|
|
<tr key={idx}>
|
|
|
|
<td>
|
|
|
|
<Code>{op.option}</Code>
|
|
|
|
</td>
|
|
|
|
<td>{op.description}</td>
|
|
|
|
</tr>
|
|
|
|
));
|
|
|
|
|
2021-03-25 14:22:43 +00:00
|
|
|
const SettingsSubtitlesView: FunctionComponent = () => {
|
|
|
|
return (
|
2022-03-16 06:26:15 +00:00
|
|
|
<Layout name="Subtitles">
|
2022-05-31 15:49:04 +00:00
|
|
|
<Section header="Subtitles Options">
|
2022-06-01 03:24:54 +00:00
|
|
|
<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>
|
2021-03-25 14:22:43 +00:00
|
|
|
</CollapseBox>
|
2022-06-01 03:24:54 +00:00
|
|
|
<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>
|
2021-03-25 14:22:43 +00:00
|
|
|
</CollapseBox>
|
2022-05-31 15:49:04 +00:00
|
|
|
<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="Anti-Captcha Options">
|
2022-06-01 03:24:54 +00:00
|
|
|
<Selector
|
|
|
|
clearable
|
|
|
|
placeholder="Select a provider"
|
|
|
|
settingKey="settings-general-anti_captcha_provider"
|
2022-06-30 15:35:23 +00:00
|
|
|
settingOptions={{ onSubmit: (v) => (v === undefined ? "None" : v) }}
|
2022-06-01 03:24:54 +00:00
|
|
|
options={antiCaptchaOption}
|
|
|
|
></Selector>
|
|
|
|
<Message>Choose the anti-captcha provider you want to use</Message>
|
|
|
|
<CollapseBox
|
|
|
|
settingKey="settings-general-anti_captcha_provider"
|
|
|
|
on={(value) => value === "anti-captcha"}
|
|
|
|
>
|
|
|
|
<Anchor href="http://getcaptchasolution.com/eixxo1rsnw">
|
|
|
|
Anti-Captcha.com
|
|
|
|
</Anchor>
|
|
|
|
<Text
|
|
|
|
label="Account Key"
|
|
|
|
settingKey="settings-anticaptcha-anti_captcha_key"
|
|
|
|
></Text>
|
|
|
|
</CollapseBox>
|
|
|
|
<CollapseBox
|
|
|
|
settingKey="settings-general-anti_captcha_provider"
|
|
|
|
on={(value) => value === "death-by-captcha"}
|
|
|
|
>
|
|
|
|
<Anchor href="https://www.deathbycaptcha.com">
|
|
|
|
DeathByCaptcha.com
|
|
|
|
</Anchor>
|
|
|
|
<Text
|
|
|
|
label="Username"
|
|
|
|
settingKey="settings-deathbycaptcha-username"
|
|
|
|
></Text>
|
|
|
|
<Password
|
|
|
|
label="Password"
|
|
|
|
settingKey="settings-deathbycaptcha-password"
|
|
|
|
></Password>
|
2021-03-25 14:22:43 +00:00
|
|
|
</CollapseBox>
|
2022-05-31 15:49:04 +00:00
|
|
|
</Section>
|
|
|
|
<Section header="Performance / Optimization">
|
2022-06-01 03:24:54 +00:00
|
|
|
<Check
|
|
|
|
label="Adaptive Searching"
|
|
|
|
settingKey="settings-general-adaptive_searching"
|
|
|
|
></Check>
|
|
|
|
<Message>
|
|
|
|
When searching for subtitles, Bazarr will reduce search frequency to
|
|
|
|
limit call to providers.
|
|
|
|
</Message>
|
|
|
|
<CollapseBox settingKey="settings-general-adaptive_searching">
|
|
|
|
<Selector
|
|
|
|
settingKey="settings-general-adaptive_searching_delay"
|
2022-06-30 15:35:23 +00:00
|
|
|
settingOptions={{ onSaved: (v) => (v === undefined ? "3w" : v) }}
|
2022-06-01 03:24:54 +00:00
|
|
|
options={adaptiveSearchingDelayOption}
|
|
|
|
></Selector>
|
|
|
|
<Message>
|
|
|
|
In order to reduce search frequency, how many weeks must Bazarr wait
|
|
|
|
after initial search.
|
|
|
|
</Message>
|
|
|
|
<Selector
|
|
|
|
settingKey="settings-general-adaptive_searching_delta"
|
2022-06-30 15:35:23 +00:00
|
|
|
settingOptions={{ onSaved: (v) => (v === undefined ? "1w" : v) }}
|
2022-06-01 03:24:54 +00:00
|
|
|
options={adaptiveSearchingDeltaOption}
|
|
|
|
></Selector>
|
|
|
|
<Message>
|
|
|
|
How often should Bazarr search for subtitles when in adaptive search
|
|
|
|
mode.
|
|
|
|
</Message>
|
2021-12-24 15:00:47 +00:00
|
|
|
</CollapseBox>
|
2022-05-31 15:49:04 +00:00
|
|
|
<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>
|
2022-06-01 03:24:54 +00:00
|
|
|
<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 settingKey="settings-general-use_embedded_subs">
|
|
|
|
<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>
|
2022-12-21 04:37:52 +00:00
|
|
|
<Selector
|
|
|
|
settingKey="settings-general-embedded_subtitles_parser"
|
|
|
|
settingOptions={{
|
|
|
|
onSaved: (v) => (v === undefined ? "ffprobe" : v),
|
|
|
|
}}
|
|
|
|
options={embeddedSubtitlesParserOption}
|
|
|
|
></Selector>
|
|
|
|
<Message>Embedded subtitles video parser</Message>
|
2021-03-25 14:22:43 +00:00
|
|
|
</CollapseBox>
|
2022-05-31 15:49:04 +00:00
|
|
|
</Section>
|
|
|
|
<Section header="Post-Processing">
|
|
|
|
<Check
|
|
|
|
label="Encode Subtitles To UTF8"
|
|
|
|
settingKey="settings-general-utf8_encode"
|
|
|
|
></Check>
|
|
|
|
<Message>
|
|
|
|
Re-encode downloaded Subtitles to UTF8. Should be left enabled in most
|
|
|
|
case.
|
|
|
|
</Message>
|
|
|
|
<Check
|
|
|
|
label="Hearing Impaired"
|
2022-06-30 15:35:23 +00:00
|
|
|
settingOptions={{ onLoaded: SubzeroModification("remove_HI") }}
|
2022-05-31 15:49:04 +00:00
|
|
|
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"
|
2022-06-30 15:35:23 +00:00
|
|
|
settingOptions={{ onLoaded: SubzeroModification("remove_tags") }}
|
2022-05-31 15:49:04 +00:00
|
|
|
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"
|
2022-06-30 15:35:23 +00:00
|
|
|
settingOptions={{ onLoaded: SubzeroModification("OCR_fixes") }}
|
2022-05-31 15:49:04 +00:00
|
|
|
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"
|
2022-06-30 15:35:23 +00:00
|
|
|
settingOptions={{ onLoaded: SubzeroModification("common") }}
|
2022-05-31 15:49:04 +00:00
|
|
|
settingKey="subzero-common"
|
|
|
|
></Check>
|
|
|
|
<Message>
|
|
|
|
Fix common and whitespace/punctuation issues in subtitles.
|
|
|
|
</Message>
|
|
|
|
<Check
|
|
|
|
label="Fix Uppercase"
|
2022-06-30 15:35:23 +00:00
|
|
|
settingOptions={{
|
|
|
|
onLoaded: SubzeroModification("fix_uppercase"),
|
|
|
|
}}
|
2022-05-31 15:49:04 +00:00
|
|
|
settingKey="subzero-fix_uppercase"
|
|
|
|
></Check>
|
|
|
|
<Message>
|
|
|
|
Tries to make subtitles that are completely uppercase readable.
|
|
|
|
</Message>
|
|
|
|
<Selector
|
2022-06-02 05:51:25 +00:00
|
|
|
placeholder="Select a color..."
|
2022-05-31 15:49:04 +00:00
|
|
|
label="Color"
|
|
|
|
clearable
|
|
|
|
options={colorOptions}
|
2022-06-30 15:35:23 +00:00
|
|
|
settingOptions={{ onLoaded: SubzeroColorModification }}
|
2022-05-31 15:49:04 +00:00
|
|
|
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"
|
2022-06-30 15:35:23 +00:00
|
|
|
settingOptions={{ onLoaded: SubzeroModification("reverse_rtl") }}
|
2022-05-31 15:49:04 +00:00
|
|
|
settingKey="subzero-reverse_rtl"
|
|
|
|
></Check>
|
|
|
|
<Message>
|
|
|
|
Reverses the punctuation in right-to-left subtitles for problematic
|
|
|
|
playback devices.
|
|
|
|
</Message>
|
2022-06-01 03:24:54 +00:00
|
|
|
<Check
|
|
|
|
label="Permission (chmod)"
|
|
|
|
settingKey="settings-general-chmod_enabled"
|
|
|
|
></Check>
|
|
|
|
<CollapseBox settingKey="settings-general-chmod_enabled">
|
|
|
|
<Text placeholder="0777" settingKey="settings-general-chmod"></Text>
|
|
|
|
<Message>Must be 4 digit octal</Message>
|
2021-03-25 14:22:43 +00:00
|
|
|
</CollapseBox>
|
2022-07-06 17:05:10 +00:00
|
|
|
<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 using the
|
|
|
|
embedded subtitle.
|
|
|
|
</Message>
|
2022-06-01 03:24:54 +00:00
|
|
|
<Check
|
|
|
|
label="Automatic Subtitles Synchronization"
|
|
|
|
settingKey="settings-subsync-use_subsync"
|
|
|
|
></Check>
|
|
|
|
<Message>
|
|
|
|
Enable the automatic subtitles synchronization after downloading a
|
|
|
|
subtitles.
|
|
|
|
</Message>
|
|
|
|
<CollapseBox settingKey="settings-subsync-use_subsync">
|
|
|
|
<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 settingKey="settings-subsync-use_subsync_threshold">
|
|
|
|
<Slider settingKey="settings-subsync-subsync_threshold"></Slider>
|
|
|
|
</CollapseBox>
|
|
|
|
<Check
|
|
|
|
label="Movies Score Threshold"
|
|
|
|
settingKey="settings-subsync-use_subsync_movie_threshold"
|
|
|
|
></Check>
|
|
|
|
<CollapseBox settingKey="settings-subsync-use_subsync_movie_threshold">
|
|
|
|
<Slider settingKey="settings-subsync-subsync_movie_threshold"></Slider>
|
|
|
|
</CollapseBox>
|
2021-03-25 14:22:43 +00:00
|
|
|
</CollapseBox>
|
2022-06-01 03:24:54 +00:00
|
|
|
<Check
|
|
|
|
settingKey="settings-general-use_postprocessing"
|
|
|
|
label="Custom Post-Processing"
|
|
|
|
></Check>
|
|
|
|
<Message>
|
|
|
|
Enable the post-processing execution after downloading a subtitles.
|
|
|
|
</Message>
|
|
|
|
<CollapseBox settingKey="settings-general-use_postprocessing">
|
|
|
|
<Check
|
|
|
|
settingKey="settings-general-use_postprocessing_threshold"
|
|
|
|
label="Series Score Threshold"
|
|
|
|
></Check>
|
2022-06-02 05:51:25 +00:00
|
|
|
<CollapseBox settingKey="settings-general-use_postprocessing_threshold">
|
2022-06-01 03:24:54 +00:00
|
|
|
<Slider settingKey="settings-general-postprocessing_threshold"></Slider>
|
|
|
|
</CollapseBox>
|
|
|
|
<Check
|
|
|
|
settingKey="settings-general-use_postprocessing_threshold_movie"
|
|
|
|
label="Movies Score Threshold"
|
|
|
|
></Check>
|
|
|
|
<CollapseBox settingKey="settings-general-use_postprocessing_threshold_movie">
|
|
|
|
<Slider settingKey="settings-general-postprocessing_threshold_movie"></Slider>
|
|
|
|
</CollapseBox>
|
|
|
|
<Text
|
|
|
|
label="Command"
|
|
|
|
settingKey="settings-general-postprocessing_cmd"
|
|
|
|
></Text>
|
2022-06-02 05:51:25 +00:00
|
|
|
<Table highlightOnHover fontSize="sm">
|
|
|
|
<tbody>{commandOptionElements}</tbody>
|
|
|
|
</Table>
|
2021-03-25 14:22:43 +00:00
|
|
|
</CollapseBox>
|
2022-05-31 15:49:04 +00:00
|
|
|
</Section>
|
2022-03-16 06:26:15 +00:00
|
|
|
</Layout>
|
2021-03-25 14:22:43 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default SettingsSubtitlesView;
|