[addon] sort debrid meta videos by index

This commit is contained in:
TheBeastLT
2020-12-13 17:08:56 +01:00
parent f84a219726
commit 48df5efd2e
3 changed files with 6 additions and 6 deletions

View File

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

View File

@@ -99,10 +99,10 @@ async function getItemMeta(itemId, apiKey) {
videos: torrent.files
.filter(file => file.selected)
.filter(file => isVideo(file.path))
.map(file => ({
.map((file, index) => ({
id: `${KEY}:${torrent.id}:${file.id}`,
title: file.path,
released: torrent.added,
released: new Date(new Date(torrent.added).getTime() + index).toISOString(),
streams: [
{ url: `${apiKey}/${torrent.hash.toLowerCase()}/null/${file.id - 1}` }
]