|
|
@ -112,12 +112,18 @@ export function filterSubtitleBy(
|
|
|
|
subtitles: Subtitle[],
|
|
|
|
subtitles: Subtitle[],
|
|
|
|
languages: Language[]
|
|
|
|
languages: Language[]
|
|
|
|
): Subtitle[] {
|
|
|
|
): Subtitle[] {
|
|
|
|
|
|
|
|
if (languages.length === 0) {
|
|
|
|
|
|
|
|
return subtitles.filter((subtitle) => {
|
|
|
|
|
|
|
|
return subtitle.path !== null;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
const result = differenceWith(
|
|
|
|
const result = differenceWith(
|
|
|
|
subtitles,
|
|
|
|
subtitles,
|
|
|
|
languages,
|
|
|
|
languages,
|
|
|
|
(a, b) => a.code2 === b.code2 || a.path !== null
|
|
|
|
(a, b) => a.code2 === b.code2 || a.path !== null || a.code2 === undefined
|
|
|
|
);
|
|
|
|
);
|
|
|
|
return difference(subtitles, result);
|
|
|
|
return difference(subtitles, result);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export * from "./hooks";
|
|
|
|
export * from "./hooks";
|
|
|
|