potentially resolve RD downloads items metadata

This commit is contained in:
TheBeastLT
2023-04-25 22:09:26 +02:00
parent 4eb167ccc3
commit def60844b2
3 changed files with 18 additions and 12 deletions

View File

@@ -127,10 +127,14 @@ async function getItemMeta(itemId, apiKey, ip) {
const options = await getDefaultOptions(ip);
const RD = new RealDebridClient(apiKey, options);
if (itemId === DEBRID_DOWNLOADS) {
// const allTorrents = await _getAllTorrents(RD).catch(() => []);
const videos = await _getAllDownloads(RD)
.then(downloads => downloads
.map(download => ({
id: `${KEY}:${DEBRID_DOWNLOADS}:${download.id}`,
// infoHash: allTorrents
// .filter(torrent => (torrent.links || []).find(link => link === download.link))
// .map(torrent => torrent.hash.toLowerCase())[0],
title: download.filename,
released: new Date(download.generated).toISOString(),
streams: [{ url: download.download }]