feat(download): torrent progress on torrent element

This commit is contained in:
Alexey Kasyanchuk
2018-02-08 15:12:37 +03:00
parent c035e880e9
commit 603798cbce
3 changed files with 195 additions and 92 deletions

View File

@ -584,11 +584,15 @@ setInterval(() => {
recive('download', (magnet) =>
{
console.log('download', magnet)
if(torrentClient.get(magnet))
return
torrentClient.add(magnet, {path: config.client.downloadPath}, (torrent) =>{
torrentClientHashMap[torrent.infoHash] = magnet
send('downloading', torrent.infoHash)
torrent.on('done', () => {
console.log('download done', torrent.infoHash)
delete torrentClientHashMap[torrent.infoHash]
send('downloadDone', torrent.infoHash)
})