1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-20 14:37:43 +01:00

feat(netfilm): add captions

This commit is contained in:
cloud 2023-03-09 15:35:39 -07:00
parent 139a760be0
commit 25e32a14b7

View file

@ -44,20 +44,27 @@ registerProvider({
baseURL: netfilmBase,
});
const { qualities } = watchInfo.data;
const data = watchInfo.data;
// get best quality source
const source = qualities.reduce((p: any, c: any) =>
const source = data.qualities.reduce((p: any, c: any) =>
c.quality > p.quality ? c : p
);
const mappedCaptions = data.subtitles.map((sub: Record<string, any>) => ({
needsProxy: false,
url: sub.url.replace("https://convert-srt-to-vtt.vercel.app/?url=", ""),
type: MWCaptionType.SRT,
langIso: sub.language,
}))
return {
embeds: [],
stream: {
streamUrl: source.url.replace("akm-cdn", "aws-cdn").replace("gg-cdn", "aws-cdn"),
quality: qualityMap[source.quality as QualityInMap],
type: MWStreamType.HLS,
captions: [],
captions: mappedCaptions,
},
};
}
@ -112,13 +119,20 @@ registerProvider({
c.quality > p.quality ? c : p
);
const mappedCaptions = data.subtitles.map((sub: Record<string, any>) => ({
needsProxy: false,
url: sub.url.replace("https://convert-srt-to-vtt.vercel.app/?url=", ""),
type: MWCaptionType.SRT,
langIso: sub.language,
}))
return {
embeds: [],
stream: {
streamUrl: source.url.replace("akm-cdn", "aws-cdn").replace("gg-cdn", "aws-cdn"),
quality: qualityMap[source.quality as QualityInMap],
type: MWStreamType.HLS,
captions: [],
captions: mappedCaptions,
},
};
},