mirror of
https://github.com/imputnet/cobalt.git
synced 2025-06-29 18:08:28 +00:00
api: refactor two static arrays to set
This commit is contained in:
parent
9d818300f4
commit
7298082bd5
@ -6,7 +6,7 @@ import { createStream } from "../stream/manage.js";
|
|||||||
import { splitFilenameExtension } from "../misc/utils.js";
|
import { splitFilenameExtension } from "../misc/utils.js";
|
||||||
import { convertLanguageCode } from "../misc/language-codes.js";
|
import { convertLanguageCode } from "../misc/language-codes.js";
|
||||||
|
|
||||||
const extraProcessingTypes = ["merge", "remux", "mute", "audio", "gif"];
|
const extraProcessingTypes = new Set(["merge", "remux", "mute", "audio", "gif"]);
|
||||||
|
|
||||||
export default function({
|
export default function({
|
||||||
r,
|
r,
|
||||||
@ -254,7 +254,7 @@ export default function({
|
|||||||
// (very painful)
|
// (very painful)
|
||||||
if (!params.isHLS && responseType !== "picker") {
|
if (!params.isHLS && responseType !== "picker") {
|
||||||
const isPreferredWithExtra =
|
const isPreferredWithExtra =
|
||||||
localProcessing === "preferred" && extraProcessingTypes.includes(params.type);
|
localProcessing === "preferred" && extraProcessingTypes.has(params.type);
|
||||||
|
|
||||||
if (localProcessing === "forced" || isPreferredWithExtra) {
|
if (localProcessing === "forced" || isPreferredWithExtra) {
|
||||||
responseType = "local-processing";
|
responseType = "local-processing";
|
||||||
|
@ -6,7 +6,7 @@ import { handleHlsPlaylist, isHlsResponse, probeInternalHLSTunnel } from "./inte
|
|||||||
const CHUNK_SIZE = BigInt(8e6); // 8 MB
|
const CHUNK_SIZE = BigInt(8e6); // 8 MB
|
||||||
const min = (a, b) => a < b ? a : b;
|
const min = (a, b) => a < b ? a : b;
|
||||||
|
|
||||||
const serviceNeedsChunks = ["youtube", "vk"];
|
const serviceNeedsChunks = new Set(["youtube", "vk"]);
|
||||||
|
|
||||||
async function* readChunks(streamInfo, size) {
|
async function* readChunks(streamInfo, size) {
|
||||||
let read = 0n, chunksSinceTransplant = 0;
|
let read = 0n, chunksSinceTransplant = 0;
|
||||||
@ -148,7 +148,7 @@ export function internalStream(streamInfo, res) {
|
|||||||
streamInfo.headers.delete('icy-metadata');
|
streamInfo.headers.delete('icy-metadata');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (serviceNeedsChunks.includes(streamInfo.service) && !streamInfo.isHLS) {
|
if (serviceNeedsChunks.has(streamInfo.service) && !streamInfo.isHLS) {
|
||||||
return handleChunkedStream(streamInfo, res);
|
return handleChunkedStream(streamInfo, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user