From 64b5990d8155b742a0c26f0504dbb5eff117cdb5 Mon Sep 17 00:00:00 2001 From: wukko Date: Tue, 28 May 2024 14:32:03 +0600 Subject: [PATCH] stream: move hls exceptions to servicesConfig (#527) --- src/modules/config.js | 1 + src/modules/processing/servicesConfig.json | 1 + src/modules/stream/manage.js | 6 ++---- src/modules/stream/types.js | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/modules/config.js b/src/modules/config.js index 67114b56..530c5f0b 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -53,6 +53,7 @@ const export const services = servicesConfigJson.config, + hlsExceptions = servicesConfigJson.hlsExceptions, audioIgnore = servicesConfigJson.audioIgnore, version = packageJson.version, genericUserAgent = config.genericUserAgent, diff --git a/src/modules/processing/servicesConfig.json b/src/modules/processing/servicesConfig.json index 9e8e8b66..2daa7b63 100644 --- a/src/modules/processing/servicesConfig.json +++ b/src/modules/processing/servicesConfig.json @@ -1,5 +1,6 @@ { "audioIgnore": ["vk", "ok"], + "hlsExceptions": ["dailymotion", "vimeo", "rutube"], "config": { "bilibili": { "alias": "bilibili.com & bilibili.tv", diff --git a/src/modules/stream/manage.js b/src/modules/stream/manage.js index bccf5c80..05008077 100644 --- a/src/modules/stream/manage.js +++ b/src/modules/stream/manage.js @@ -3,14 +3,12 @@ import { randomBytes } from "crypto"; import { nanoid } from "nanoid"; import { decryptStream, encryptStream, generateHmac } from "../sub/crypto.js"; -import { env } from "../config.js"; +import { env, hlsExceptions } from "../config.js"; import { strict as assert } from "assert"; // optional dependency const freebind = env.freebindCIDR && await import('freebind').catch(() => {}); -const M3U_SERVICES = ['dailymotion', 'vimeo', 'rutube']; - const streamCache = new NodeCache({ stdTTL: env.streamLifespan, checkperiod: 10, @@ -110,7 +108,7 @@ export function destroyInternalStream(url) { function wrapStream(streamInfo) { /* m3u8 links are currently not supported * for internal streams, skip them */ - if (M3U_SERVICES.includes(streamInfo.service)) { + if (hlsExceptions.includes(streamInfo.service)) { return streamInfo; } diff --git a/src/modules/stream/types.js b/src/modules/stream/types.js index a1db0c60..2036b360 100644 --- a/src/modules/stream/types.js +++ b/src/modules/stream/types.js @@ -5,7 +5,7 @@ import { create as contentDisposition } from "content-disposition-header"; import { metadataManager } from "../sub/utils.js"; import { destroyInternalStream } from "./manage.js"; -import { env, ffmpegArgs } from "../config.js"; +import { env, ffmpegArgs, hlsExceptions } from "../config.js"; import { getHeaders, closeResponse } from "./shared.js"; function toRawHeaders(headers) { @@ -215,7 +215,7 @@ export function streamVideoOnly(streamInfo, res) { args.push('-an') } - if (["vimeo", "rutube", "dailymotion"].includes(streamInfo.service)) { + if (hlsExceptions.includes(streamInfo.service)) { args.push('-bsf:a', 'aac_adtstoasc') }