aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/src/pages/Settings/Sonarr/index.tsx
blob: ff4ac6ca27cb4da971d131cf959ce11e06892101 (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
import { FunctionComponent } from "react";
import { Code } from "@mantine/core";
import {
  Check,
  Chips,
  CollapseBox,
  Layout,
  Message,
  MultiSelector,
  Number,
  PathMappingTable,
  Section,
  Selector,
  Slider,
  Text,
  URLTestButton,
} from "@/pages/Settings/components";
import { seriesEnabledKey } from "@/pages/Settings/keys";
import { seriesTypeOptions } from "@/pages/Settings/options";
import { timeoutOptions } from "./options";

const SettingsSonarrView: FunctionComponent = () => {
  return (
    <Layout name="Sonarr">
      <Section header="Use Sonarr">
        <Check label="Enabled" settingKey={seriesEnabledKey}></Check>
      </Section>
      <CollapseBox settingKey={seriesEnabledKey}>
        <Section header="Host">
          <Text label="Address" settingKey="settings-sonarr-ip"></Text>
          <Message>Hostname or IPv4 Address</Message>
          <Number label="Port" settingKey="settings-sonarr-port"></Number>
          <Text
            label="Base URL"
            leftSection="/"
            settingKey="settings-sonarr-base_url"
            settingOptions={{
              onLoaded: (s) => s.sonarr.base_url?.slice(1) ?? "",
              onSubmit: (v) => "/" + v,
            }}
          ></Text>
          <Selector
            label="HTTP Timeout"
            options={timeoutOptions}
            settingKey="settings-sonarr-http_timeout"
          ></Selector>
          <Text label="API Key" settingKey="settings-sonarr-apikey"></Text>
          <Check label="SSL" settingKey="settings-sonarr-ssl"></Check>
          <URLTestButton category="sonarr"></URLTestButton>
        </Section>
        <Section header="Options">
          <Slider
            label="Minimum Score"
            settingKey="settings-general-minimum_score"
          ></Slider>
          <Chips
            label="Excluded Tags"
            settingKey="settings-sonarr-excluded_tags"
            sanitizeFn={(values: string[] | null) =>
              values?.map((item) =>
                item.replace(/[^a-z0-9_-]/gi, "").toLowerCase(),
              )
            }
          ></Chips>
          <Message>
            Episodes from series with those tags (case sensitive) in Sonarr will
            be excluded from automatic download of subtitles.
          </Message>
          <MultiSelector
            label="Excluded Series Types"
            placeholder="Select series types"
            settingKey="settings-sonarr-excluded_series_types"
            options={seriesTypeOptions}
          ></MultiSelector>
          <Message>
            Episodes from series with those types in Sonarr will be excluded
            from automatic download of subtitles.
          </Message>
          <Check
            label="Download Only Monitored"
            settingKey="settings-sonarr-only_monitored"
          ></Check>
          <Message>
            Automatic download of subtitles will only happen for monitored
            episodes in Sonarr.
          </Message>
          <Check
            label="Defer searching of subtitles until scheduled task execution"
            settingKey="settings-sonarr-defer_search_signalr"
          ></Check>
          <Message>
            If enabled, this option will prevent Bazarr from searching subtitles
            as soon as episodes are imported.
          </Message>
          <Message>
            Search can be triggered using this command
            <Code>
              curl -d "sonarr_episodefile_id=$sonarr_episodefile_id" -H
              "x-api-key: ###############################" -X POST
              http://localhost:6767/api/webhooks/sonarr
            </Code>
          </Message>
          <Check
            label="Exclude season zero (extras)"
            settingKey="settings-sonarr-exclude_season_zero"
          ></Check>
          <Message>
            Episodes from season zero (extras) from automatic download of
            subtitles.
          </Message>
        </Section>
        <Section header="Path Mappings">
          <PathMappingTable type="sonarr"></PathMappingTable>
        </Section>
      </CollapseBox>
    </Layout>
  );
};

export default SettingsSonarrView;