aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/src
diff options
context:
space:
mode:
authorAnderson Shindy Oki <[email protected]>2024-06-25 11:11:08 +0900
committerGitHub <[email protected]>2024-06-24 22:11:08 -0400
commit26ce9d73e6b6c4cc1e219deba722c0eaab4b3187 (patch)
tree58b815dcc1e39ab166461008d404cbf33a5c5515 /frontend/src
parent41541775e959909b002b095a77536b6c8b33640a (diff)
downloadbazarr-26ce9d73e6b6c4cc1e219deba722c0eaab4b3187.tar.gz
bazarr-26ce9d73e6b6c4cc1e219deba722c0eaab4b3187.zip
Fixed frontend sync and translate missing hi and forced informationv1.4.4-beta.11
Diffstat (limited to 'frontend/src')
-rw-r--r--frontend/src/components/SubtitleToolsMenu.tsx2
-rw-r--r--frontend/src/components/forms/SyncSubtitleForm.tsx14
-rw-r--r--frontend/src/pages/Episodes/components.tsx5
-rw-r--r--frontend/src/pages/Movies/Details/table.tsx6
-rw-r--r--frontend/src/utilities/index.test.ts25
-rw-r--r--frontend/src/utilities/index.ts4
6 files changed, 49 insertions, 7 deletions
diff --git a/frontend/src/components/SubtitleToolsMenu.tsx b/frontend/src/components/SubtitleToolsMenu.tsx
index ce7770e16..545c87478 100644
--- a/frontend/src/components/SubtitleToolsMenu.tsx
+++ b/frontend/src/components/SubtitleToolsMenu.tsx
@@ -127,6 +127,8 @@ const SubtitleToolsMenu: FunctionComponent<Props> = ({
type: s.type,
language: s.language,
path: s.path,
+ hi: s.hi,
+ forced: s.forced,
};
task.create(s.path, name, mutateAsync, { action, form });
});
diff --git a/frontend/src/components/forms/SyncSubtitleForm.tsx b/frontend/src/components/forms/SyncSubtitleForm.tsx
index f55b3ddb8..63953fb2d 100644
--- a/frontend/src/components/forms/SyncSubtitleForm.tsx
+++ b/frontend/src/components/forms/SyncSubtitleForm.tsx
@@ -17,7 +17,7 @@ import {
import { useModals, withModal } from "@/modules/modals";
import { task } from "@/modules/task";
import { syncMaxOffsetSecondsOptions } from "@/pages/Settings/Subtitles/options";
-import { toPython } from "@/utilities";
+import { fromPython, toPython } from "@/utilities";
const TaskName = "Syncing Subtitle";
@@ -109,6 +109,8 @@ interface FormValues {
maxOffsetSeconds?: string;
noFixFramerate: boolean;
gss: boolean;
+ hi?: boolean;
+ forced?: boolean;
}
const SyncSubtitleForm: FunctionComponent<Props> = ({
@@ -122,9 +124,11 @@ const SyncSubtitleForm: FunctionComponent<Props> = ({
const { mutateAsync } = useSubtitleAction();
const modals = useModals();
- const mediaType = selections[0].type;
- const mediaId = selections[0].id;
- const subtitlesPath = selections[0].path;
+ const subtitle = selections[0];
+
+ const mediaType = subtitle.type;
+ const mediaId = subtitle.id;
+ const subtitlesPath = subtitle.path;
const subtitles = useReferencedSubtitles(mediaType, mediaId, subtitlesPath);
@@ -132,6 +136,8 @@ const SyncSubtitleForm: FunctionComponent<Props> = ({
initialValues: {
noFixFramerate: false,
gss: false,
+ hi: fromPython(subtitle.hi),
+ forced: fromPython(subtitle.forced),
},
});
diff --git a/frontend/src/pages/Episodes/components.tsx b/frontend/src/pages/Episodes/components.tsx
index 98bf15ecd..7b21393fa 100644
--- a/frontend/src/pages/Episodes/components.tsx
+++ b/frontend/src/pages/Episodes/components.tsx
@@ -4,6 +4,7 @@ import { useEpisodeSubtitleModification } from "@/apis/hooks";
import Language from "@/components/bazarr/Language";
import SubtitleToolsMenu from "@/components/SubtitleToolsMenu";
import { task, TaskGroup } from "@/modules/task";
+import { toPython } from "@/utilities";
interface Props {
seriesId: number;
@@ -43,11 +44,13 @@ export const Subtitle: FunctionComponent<Props> = ({
type: "episode",
language: subtitle.code2,
path: subtitle.path,
+ forced: toPython(subtitle.forced),
+ hi: toPython(subtitle.hi),
});
}
return list;
- }, [episodeId, subtitle.code2, subtitle.path]);
+ }, [episodeId, subtitle.code2, subtitle.path, subtitle.forced, subtitle.hi]);
const ctx = (
<Badge variant={variant}>
diff --git a/frontend/src/pages/Movies/Details/table.tsx b/frontend/src/pages/Movies/Details/table.tsx
index eef5a52f6..03593102c 100644
--- a/frontend/src/pages/Movies/Details/table.tsx
+++ b/frontend/src/pages/Movies/Details/table.tsx
@@ -9,7 +9,7 @@ import { Action, SimpleTable } from "@/components";
import Language from "@/components/bazarr/Language";
import SubtitleToolsMenu from "@/components/SubtitleToolsMenu";
import { task, TaskGroup } from "@/modules/task";
-import { filterSubtitleBy } from "@/utilities";
+import { filterSubtitleBy, toPython } from "@/utilities";
import { useProfileItemsToLanguages } from "@/utilities/languages";
const missingText = "Missing Subtitles";
@@ -95,11 +95,13 @@ const Table: FunctionComponent<Props> = ({ movie, profile, disabled }) => {
path,
id: movie.radarrId,
language: code2,
+ forced: toPython(forced),
+ hi: toPython(hi),
});
}
return list;
- }, [code2, path]);
+ }, [code2, path, forced, hi]);
if (movie === null) {
return null;
diff --git a/frontend/src/utilities/index.test.ts b/frontend/src/utilities/index.test.ts
new file mode 100644
index 000000000..b2596a005
--- /dev/null
+++ b/frontend/src/utilities/index.test.ts
@@ -0,0 +1,25 @@
+import { fromPython, toPython } from "@/utilities/index";
+
+describe("fromPythonConversion", () => {
+ it("should convert a true value", () => {
+ expect(fromPython("True")).toBe(true);
+ });
+
+ it("should convert a false value", () => {
+ expect(fromPython("False")).toBe(false);
+ });
+
+ it("should convert an undefined value", () => {
+ expect(fromPython(undefined)).toBe(false);
+ });
+});
+
+describe("toPythonConversion", () => {
+ it("should convert a true value", () => {
+ expect(toPython(true)).toBe("True");
+ });
+
+ it("should convert a false value", () => {
+ expect(toPython(false)).toBe("False");
+ });
+});
diff --git a/frontend/src/utilities/index.ts b/frontend/src/utilities/index.ts
index f8b9d1961..cde66d894 100644
--- a/frontend/src/utilities/index.ts
+++ b/frontend/src/utilities/index.ts
@@ -59,6 +59,10 @@ export function filterSubtitleBy(
}
}
+export function fromPython(value: PythonBoolean | undefined): boolean {
+ return value === "True";
+}
+
export function toPython(value: boolean): PythonBoolean {
return value ? "True" : "False";
}