mirror of
https://github.com/movie-web/movie-web.git
synced 2024-12-27 09:31:50 +01:00
filter out non subtitle files
This commit is contained in:
parent
156b693460
commit
661d995e3b
@ -225,15 +225,23 @@ registerProvider({
|
|||||||
|
|
||||||
const subtitleRes = (await get(subtitleApiQuery)).data;
|
const subtitleRes = (await get(subtitleApiQuery)).data;
|
||||||
|
|
||||||
const mappedCaptions = subtitleRes.list.map((subtitle: any): MWCaption => {
|
const mappedCaptions = subtitleRes.list.map(
|
||||||
return {
|
(subtitle: any): MWCaption | null => {
|
||||||
needsProxy: true,
|
const sub = subtitle;
|
||||||
langIso: subtitle.language,
|
sub.subtitles = subtitle.subtitles.filter((subFile: any) => {
|
||||||
url: subtitle.subtitles[0].file_path,
|
const extension = subFile.file_path.substring(
|
||||||
type: MWCaptionType.SRT,
|
sub.file_path.length - 3
|
||||||
};
|
);
|
||||||
});
|
return [MWCaptionType.SRT, MWCaptionType.VTT].includes(extension);
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
needsProxy: true,
|
||||||
|
langIso: subtitle.language,
|
||||||
|
url: sub.subtitles[0].file_path,
|
||||||
|
type: MWCaptionType.SRT,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
return {
|
return {
|
||||||
embeds: [],
|
embeds: [],
|
||||||
stream: {
|
stream: {
|
||||||
|
Loading…
Reference in New Issue
Block a user