mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
[addon] use single stream property for debrid catalogs
This commit is contained in:
@@ -62,10 +62,8 @@ async function getItemMeta(itemId, apiKey) {
|
|||||||
.map((file, index) => ({
|
.map((file, index) => ({
|
||||||
id: `${KEY}:${torrent.id}:${index}`,
|
id: `${KEY}:${torrent.id}:${index}`,
|
||||||
title: file.filename,
|
title: file.filename,
|
||||||
released: new Date(torrent.uploadDate * 1000 + index).toISOString(),
|
released: new Date(torrent.uploadDate * 1000 - index).toISOString(),
|
||||||
streams: [
|
stream: { url: `${apiKey}/${torrent.hash.toLowerCase()}/${encodeURIComponent(file.filename)}/${index}` }
|
||||||
{ url: `${apiKey}/${torrent.hash.toLowerCase()}/${encodeURIComponent(file.filename)}/${index}` }
|
|
||||||
]
|
|
||||||
}))
|
}))
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,8 +110,9 @@ async function getMochItemMeta(mochKey, itemId, config) {
|
|||||||
return moch.instance.getItemMeta(itemId, config[moch.key], config.ip)
|
return moch.instance.getItemMeta(itemId, config[moch.key], config.ip)
|
||||||
.then(meta => {
|
.then(meta => {
|
||||||
meta.videos
|
meta.videos
|
||||||
.map(video => video.streams)
|
// .map(video => video.streams)
|
||||||
.reduce((a, b) => a.concat(b), [])
|
// .reduce((a, b) => a.concat(b), [])
|
||||||
|
.map(video => video.stream)
|
||||||
.filter(stream => !stream.url.startsWith('http'))
|
.filter(stream => !stream.url.startsWith('http'))
|
||||||
.forEach(stream => stream.url = `${RESOLVER_HOST}/${moch.key}/${stream.url}`)
|
.forEach(stream => stream.url = `${RESOLVER_HOST}/${moch.key}/${stream.url}`)
|
||||||
return meta;
|
return meta;
|
||||||
|
|||||||
@@ -61,9 +61,7 @@ async function getItemMeta(itemId, apiKey, ip) {
|
|||||||
id: `${KEY}:${file.id}:${index}`,
|
id: `${KEY}:${file.id}:${index}`,
|
||||||
title: file.name,
|
title: file.name,
|
||||||
released: new Date(file.created_at * 1000 - index).toISOString(),
|
released: new Date(file.created_at * 1000 - index).toISOString(),
|
||||||
streams: [
|
stream: { url: file.stream_link || file.link }
|
||||||
{ url: file.stream_link || file.link }
|
|
||||||
]
|
|
||||||
}))
|
}))
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,10 +111,8 @@ async function getItemMeta(itemId, apiKey, ip) {
|
|||||||
.map((file, index) => ({
|
.map((file, index) => ({
|
||||||
id: `${KEY}:${torrent.id}:${file.id}`,
|
id: `${KEY}:${torrent.id}:${file.id}`,
|
||||||
title: file.path,
|
title: file.path,
|
||||||
released: new Date(new Date(torrent.added).getTime() + index).toISOString(),
|
released: new Date(new Date(torrent.added).getTime() - index).toISOString(),
|
||||||
streams: [
|
stream: { url: `${apiKey}/${torrent.hash.toLowerCase()}/null/${file.id - 1}` }
|
||||||
{ url: `${apiKey}/${torrent.hash.toLowerCase()}/null/${file.id - 1}` }
|
|
||||||
]
|
|
||||||
}))
|
}))
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user