feat(downloading): torrent pause feature

This commit is contained in:
Alexey Kasyanchuk
2018-06-30 04:15:12 +03:00
parent c086cd2087
commit 070119c352
6 changed files with 107 additions and 14 deletions

View File

@ -10,6 +10,7 @@ torrentClient.saveSession = (sessionFile) => {
torrent: torrent.torrentObject,
removeOnDone: torrent.removeOnDone,
paused: torrent.paused || torrent._paused
}))
}, null, 4), 'utf8');
}
@ -33,7 +34,7 @@ torrentClient.loadSession = (sessionFile) => {
return
}
const {torrents} = obj
torrents.forEach(({torrent, infoHash, path, removeOnDone}) => {
torrents.forEach(({torrent, infoHash, path, removeOnDone, paused}) => {
if(!torrent || !infoHash || !path)
{
console.log('no info for starting download this torrent')
@ -46,6 +47,10 @@ torrentClient.loadSession = (sessionFile) => {
console.log('restore options')
// restore options
download.removeOnDone = removeOnDone
if(paused)
{
download._paused = true
}
}
})
}