return only streams property for moch meta

This commit is contained in:
TheBeastLT
2022-03-09 15:54:39 +01:00
parent 5100751c19
commit 29b232318e
5 changed files with 9 additions and 10 deletions

View File

@@ -67,7 +67,7 @@ async function getItemMeta(itemId, apiKey) {
id: `${KEY}:${torrent.id}:${index}`,
title: file.filename,
released: new Date(torrent.uploadDate * 1000 - index).toISOString(),
stream: { url: `${apiKey}/${torrent.hash.toLowerCase()}/${encodeURIComponent(file.filename)}/${index}` }
streams: [{ url: `${apiKey}/${torrent.hash.toLowerCase()}/${encodeURIComponent(file.filename)}/${index}` }]
}))
}))
}

View File

@@ -66,7 +66,7 @@ async function getItemMeta(itemId, apiKey, ip) {
id: `${KEY}:${torrent.id}:${index}`,
title: file.name,
released: new Date(torrent.created * 1000 - index).toISOString(),
stream: { url: file.downloadUrl }
streams: [{ url: file.downloadUrl }]
}))
}))
}

View File

@@ -118,12 +118,11 @@ async function getMochItemMeta(mochKey, itemId, config) {
return moch.instance.getItemMeta(itemId, config[moch.key], config.ip)
.then(meta => {
meta.videos.forEach(video => {
if (!video.stream.url.startsWith('http')) {
video.stream.url = `${RESOLVER_HOST}/${moch.key}/${video.stream.url}`
}
video.streams = [video.stream];
});
meta.videos
.map(video => video.streams)
.reduce((a, b) => a.concat(b), [])
.filter(stream => !stream.url.startsWith('http'))
.forEach(stream => stream.url = `${RESOLVER_HOST}/${moch.key}/${stream.url}`)
return meta;
});
}

View File

@@ -71,7 +71,7 @@ async function getItemMeta(itemId, apiKey, ip) {
id: `${KEY}:${file.id}:${index}`,
title: file.name,
released: new Date(file.created_at * 1000 - index).toISOString(),
stream: { url: file.link || file.stream_link }
streams: [{ url: file.link || file.stream_link }]
}))
}))
}

View File

@@ -137,7 +137,7 @@ async function getItemMeta(itemId, apiKey, ip) {
id: `${KEY}:${torrent.id}:${file.id}`,
title: file.path,
released: new Date(new Date(torrent.added).getTime() - index).toISOString(),
stream: { url: `${apiKey}/${torrent.hash.toLowerCase()}/null/${file.id - 1}` }
streams: [{ url: `${apiKey}/${torrent.hash.toLowerCase()}/null/${file.id - 1}` }]
}))
}))
}