mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
[addon] sort debrid meta videos by index
This commit is contained in:
@@ -41,7 +41,7 @@ builder.defineStreamHandler((args) => {
|
|||||||
}))
|
}))
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.log(`Failed request ${args.id}: ${error}`);
|
console.log(`Failed request ${args.id}: ${error}`);
|
||||||
throw Promise.reject(error);
|
return Promise.reject(error);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ builder.defineCatalogHandler((args) => {
|
|||||||
}))
|
}))
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.log(`Failed retrieving catalog ${args.id}: `, error);
|
console.log(`Failed retrieving catalog ${args.id}: `, error);
|
||||||
throw Promise.reject(error);
|
return Promise.reject(error);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ builder.defineMetaHandler((args) => {
|
|||||||
}))
|
}))
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.log(`Failed retrieving catalog meta ${args.id}: `, error);
|
console.log(`Failed retrieving catalog meta ${args.id}: `, error);
|
||||||
throw Promise.reject(error);
|
return Promise.reject(error);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ 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).toISOString(),
|
released: new Date(torrent.uploadDate * 1000 + index).toISOString(),
|
||||||
streams: [
|
streams: [
|
||||||
{ url: `${apiKey}/${torrent.hash.toLowerCase()}/${encodeURIComponent(file.filename)}/${index}` }
|
{ url: `${apiKey}/${torrent.hash.toLowerCase()}/${encodeURIComponent(file.filename)}/${index}` }
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -99,10 +99,10 @@ async function getItemMeta(itemId, apiKey) {
|
|||||||
videos: torrent.files
|
videos: torrent.files
|
||||||
.filter(file => file.selected)
|
.filter(file => file.selected)
|
||||||
.filter(file => isVideo(file.path))
|
.filter(file => isVideo(file.path))
|
||||||
.map(file => ({
|
.map((file, index) => ({
|
||||||
id: `${KEY}:${torrent.id}:${file.id}`,
|
id: `${KEY}:${torrent.id}:${file.id}`,
|
||||||
title: file.path,
|
title: file.path,
|
||||||
released: torrent.added,
|
released: new Date(new Date(torrent.added).getTime() + index).toISOString(),
|
||||||
streams: [
|
streams: [
|
||||||
{ 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