1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-29 16:07:40 +01:00

Update provider package

This commit is contained in:
mrjvs 2023-12-29 18:17:37 +01:00
parent 11ea61d80b
commit 378a1696b3
7 changed files with 23 additions and 24 deletions

View file

@ -28,7 +28,7 @@
"dependencies": { "dependencies": {
"@formkit/auto-animate": "^0.8.1", "@formkit/auto-animate": "^0.8.1",
"@headlessui/react": "^1.7.17", "@headlessui/react": "^1.7.17",
"@movie-web/providers": "^1.1.5", "@movie-web/providers": "^2.0.0",
"@noble/hashes": "^1.3.3", "@noble/hashes": "^1.3.3",
"@react-spring/web": "^9.7.3", "@react-spring/web": "^9.7.3",
"@scure/bip39": "^1.2.2", "@scure/bip39": "^1.2.2",

View file

@ -18,8 +18,8 @@ dependencies:
specifier: ^1.7.17 specifier: ^1.7.17
version: 1.7.17(react-dom@18.2.0)(react@18.2.0) version: 1.7.17(react-dom@18.2.0)(react@18.2.0)
'@movie-web/providers': '@movie-web/providers':
specifier: ^1.1.5 specifier: ^2.0.0
version: 1.1.5 version: 2.0.0
'@noble/hashes': '@noble/hashes':
specifier: ^1.3.3 specifier: ^1.3.3
version: 1.3.3 version: 1.3.3
@ -1912,14 +1912,14 @@ packages:
'@jridgewell/resolve-uri': 3.1.1 '@jridgewell/resolve-uri': 3.1.1
'@jridgewell/sourcemap-codec': 1.4.15 '@jridgewell/sourcemap-codec': 1.4.15
/@movie-web/providers@1.1.5: /@movie-web/providers@2.0.0:
resolution: {integrity: sha512-JnqU6nVsEZ83UVcsizqzcr/vtwvHHlZt9vYwGiJEAyaUgaXJPZz3C90qzaRZ8CVWydUTRAmjRP3daRFtC1nKHw==} resolution: {integrity: sha512-+LF7kTLhtpewLdQssnYojW/Dia0UtAkrK9ZvmFSnLIEQoVjVv1vsJUT2JqkjvEC/TM1SnM2N6H+eKLJU4yN2cQ==}
dependencies: dependencies:
cheerio: 1.0.0-rc.12 cheerio: 1.0.0-rc.12
crypto-js: 4.2.0 crypto-js: 4.2.0
form-data: 4.0.0 form-data: 4.0.0
iso-639-1: 3.1.0 iso-639-1: 3.1.0
nanoid: 3.3.6 nanoid: 3.3.7
node-fetch: 2.7.0 node-fetch: 2.7.0
unpacker: 1.0.1 unpacker: 1.0.1
transitivePeerDependencies: transitivePeerDependencies:
@ -5234,17 +5234,10 @@ packages:
stylis: 4.3.0 stylis: 4.3.0
dev: false dev: false
/nanoid@3.3.6:
resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==}
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
hasBin: true
dev: false
/nanoid@3.3.7: /nanoid@3.3.7:
resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==}
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
hasBin: true hasBin: true
dev: true
/nanoid@5.0.4: /nanoid@5.0.4:
resolution: {integrity: sha512-vAjmBf13gsmhXSgBrtIclinISzFFy22WwCYoyilZlsrRXNIHSwgFQ1bEdjRwMT3aoadeIF6HMuDRlOxzfXV8ig==} resolution: {integrity: sha512-vAjmBf13gsmhXSgBrtIclinISzFFy22WwCYoyilZlsrRXNIHSwgFQ1bEdjRwMT3aoadeIF6HMuDRlOxzfXV8ig==}

View file

@ -22,6 +22,7 @@ const alwaysVisibleQualities: Record<SourceQuality, boolean> = {
"480": true, "480": true,
"720": true, "720": true,
"1080": true, "1080": true,
"4k": false,
}; };
function useIsIosHls() { function useIsIosHls() {

View file

@ -73,8 +73,8 @@ export function useEmbedScraping(
setSourceId(sourceId); setSourceId(sourceId);
setCaption(null); setCaption(null);
setSource( setSource(
convertRunoutputToSource({ stream: result.stream }), convertRunoutputToSource({ stream: result.stream[0] }),
convertProviderCaption(result.stream.captions), convertProviderCaption(result.stream[0].captions),
progress, progress,
); );
router.close(); router.close();
@ -132,8 +132,8 @@ export function useSourceScraping(sourceId: string | null, routerId: string) {
if (result.stream) { if (result.stream) {
setCaption(null); setCaption(null);
setSource( setSource(
convertRunoutputToSource({ stream: result.stream }), convertRunoutputToSource({ stream: result.stream[0] }),
convertProviderCaption(result.stream.captions), convertProviderCaption(result.stream[0].captions),
progress, progress,
); );
setSourceId(sourceId); setSourceId(sourceId);
@ -187,8 +187,8 @@ export function useSourceScraping(sourceId: string | null, routerId: string) {
setSourceId(sourceId); setSourceId(sourceId);
setCaption(null); setCaption(null);
setSource( setSource(
convertRunoutputToSource({ stream: embedResult.stream }), convertRunoutputToSource({ stream: embedResult.stream[0] }),
convertProviderCaption(embedResult.stream.captions), convertProviderCaption(embedResult.stream[0].captions),
progress, progress,
); );
router.close(); router.close();

View file

@ -1,4 +1,4 @@
import { RunOutput } from "@movie-web/providers"; import { Stream } from "@movie-web/providers";
import { import {
SourceFileStream, SourceFileStream,
@ -7,6 +7,7 @@ import {
} from "@/stores/player/utils/qualities"; } from "@/stores/player/utils/qualities";
const allowedQualitiesMap: Record<SourceQuality, SourceQuality> = { const allowedQualitiesMap: Record<SourceQuality, SourceQuality> = {
"4k": "4k",
"1080": "1080", "1080": "1080",
"480": "480", "480": "480",
"360": "360", "360": "360",
@ -21,7 +22,7 @@ function isAllowedQuality(inp: string): inp is SourceQuality {
} }
export function convertRunoutputToSource(out: { export function convertRunoutputToSource(out: {
stream: RunOutput["stream"]; stream: Stream;
}): SourceSliceSource { }): SourceSliceSource {
if (out.stream.type === "hls") { if (out.stream.type === "hls") {
return { return {

View file

@ -1,6 +1,8 @@
import { Qualities } from "@movie-web/providers";
import { QualityStore } from "@/stores/quality"; import { QualityStore } from "@/stores/quality";
export type SourceQuality = "unknown" | "360" | "480" | "720" | "1080"; export type SourceQuality = Qualities;
export type StreamType = "hls" | "mp4"; export type StreamType = "hls" | "mp4";
@ -30,6 +32,7 @@ const qualitySorting: Record<SourceQuality, number> = {
"480": 20, "480": 20,
"720": 30, "720": 30,
"1080": 40, "1080": 40,
"4k": 50,
}; };
const sortedQualities: SourceQuality[] = Object.entries(qualitySorting) const sortedQualities: SourceQuality[] = Object.entries(qualitySorting)
.sort((a, b) => b[1] - a[1]) .sort((a, b) => b[1] - a[1])
@ -99,6 +102,7 @@ export function selectQuality(
} }
const qualityMap: Record<SourceQuality, string> = { const qualityMap: Record<SourceQuality, string> = {
"4k": "4k",
"1080": "1080p", "1080": "1080p",
"360": "360p", "360": "360p",
"480": "480p", "480": "480p",

View file

@ -1,5 +1,5 @@
import { import {
ProviderBuilderOptions, Fetcher,
ProviderControls, ProviderControls,
makeProviders, makeProviders,
makeSimpleProxyFetcher, makeSimpleProxyFetcher,
@ -49,7 +49,7 @@ async function fetchButWithApiTokens(
} }
function makeLoadBalancedSimpleProxyFetcher() { function makeLoadBalancedSimpleProxyFetcher() {
const fetcher: ProviderBuilderOptions["fetcher"] = async (a, b) => { const fetcher: Fetcher = async (a, b) => {
const currentFetcher = makeSimpleProxyFetcher( const currentFetcher = makeSimpleProxyFetcher(
getLoadbalancedProxyUrl(), getLoadbalancedProxyUrl(),
fetchButWithApiTokens, fetchButWithApiTokens,