Add more metadata

This commit is contained in:
Ben Sarmiento
2023-10-17 12:36:33 +02:00
parent c5f365c8b4
commit 44216343e2
9 changed files with 139 additions and 39 deletions

View File

@@ -60,14 +60,14 @@ func createSingleTorrentResponse(torrent realdebrid.Torrent, db *repo.Database)
path := filepath.Join(currentPath, filenameV2)
response := dav.File(
path,
int(unrestrict.Filesize),
torrent.Added, // Assuming you want to use the torrent added time here
unrestrict.Filesize,
convertDate(torrent.Added),
link,
)
responses = append(responses, response)
} else {
// This link is not cached yet
unrestrictFn := func() (realdebrid.UnrestrictResponse, error) {
unrestrictFn := func() (*realdebrid.UnrestrictResponse, error) {
return realdebrid.UnrestrictCheck(os.Getenv("RD_TOKEN"), link)
}
unrestrict := realdebrid.RetryUntilOk(unrestrictFn)
@@ -79,15 +79,14 @@ func createSingleTorrentResponse(torrent realdebrid.Torrent, db *repo.Database)
Host: "",
})
continue
} else {
db.Insert(torrent.Hash, torrent.Filename, *unrestrict)
}
db.Insert(torrent.Hash, torrent.Filename, *unrestrict)
filenameV2 := davextra.InsertLinkFragment(unrestrict.Filename, davextra.GetLinkFragment(unrestrict.Link))
path := filepath.Join(currentPath, filenameV2)
response := dav.File(
path,
int(unrestrict.Filesize),
torrent.Added,
unrestrict.Filesize,
convertDate(torrent.Added),
link,
)
responses = append(responses, response)