Show files even when torrent isn't torrenting
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user