From 1c6447add6e6ab44bd6483b4552ccd75fb45b905 Mon Sep 17 00:00:00 2001 From: TheBeastLT Date: Wed, 10 Mar 2021 16:33:14 +0100 Subject: [PATCH] [addon] return both stream and streams property in moch meta response --- addon/moch/moch.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addon/moch/moch.js b/addon/moch/moch.js index 60d4325..d42b4f8 100644 --- a/addon/moch/moch.js +++ b/addon/moch/moch.js @@ -117,12 +117,12 @@ async function getMochItemMeta(mochKey, itemId, config) { return moch.instance.getItemMeta(itemId, config[moch.key], config.ip) .then(meta => { - meta.videos - // .map(video => video.streams) - // .reduce((a, b) => a.concat(b), []) - .map(video => video.stream) - .filter(stream => !stream.url.startsWith('http')) - .forEach(stream => stream.url = `${RESOLVER_HOST}/${moch.key}/${stream.url}`) + meta.videos.forEach(video => { + if (!video.stream.url.startsWith('http')) { + video.stream.url = `${RESOLVER_HOST}/${moch.key}/${video.stream.url}` + } + video.streams = [video.stream]; + }); return meta; }); }