Show files even when torrent isn't torrenting

This commit is contained in:
DC
2016-03-20 21:55:54 -07:00
parent 041dd708ec
commit 720c9f4625
3 changed files with 30 additions and 10 deletions

View File

@@ -453,6 +453,7 @@ function addTorrentEvents (torrent) {
torrentSummary.ready = true
torrentSummary.name = torrentSummary.displayName || torrent.name
torrentSummary.infoHash = torrent.infoHash
torrentSummary.files = torrent.files.map(summarizeFileInTorrent)
saveTorrentFile(torrentSummary, torrent)
@@ -493,6 +494,15 @@ function generateTorrentPoster (torrent, torrentSummary) {
})
}
// Produces a JSON saveable summary of a file in a torrent
function summarizeFileInTorrent (file) {
return {
name: file.name,
length: file.length,
isDownloaded: false
}
}
// Every time we resolve a magnet URI, save the torrent file so that we never
// have to download it again. Never ask the DHT the same question twice.
function saveTorrentFile (torrentSummary, torrent) {