fix(log): color log (part 3)
This commit is contained in:
@ -17,7 +17,7 @@ torrentClient.saveSession = (sessionFile) => {
|
||||
torrentClient.loadSession = (sessionFile) => {
|
||||
if(!fs.existsSync(sessionFile))
|
||||
{
|
||||
console.log('no download sessions - ignore')
|
||||
logT('downloader', 'no download sessions - ignore')
|
||||
return
|
||||
}
|
||||
|
||||
@ -25,26 +25,26 @@ torrentClient.loadSession = (sessionFile) => {
|
||||
const obj = JSON.parse(data);
|
||||
if(!obj.torrents)
|
||||
{
|
||||
console.log('no torrents list for loading session')
|
||||
logT('downloader', 'no torrents list for loading session')
|
||||
return
|
||||
}
|
||||
if(!torrentClient._add)
|
||||
{
|
||||
console.log('no overriden _add() method')
|
||||
logT('downloader', 'no overriden _add() method')
|
||||
return
|
||||
}
|
||||
const {torrents} = obj
|
||||
torrents.forEach(({torrent, infoHash, path, removeOnDone, paused}) => {
|
||||
if(!torrent || !infoHash || !path)
|
||||
{
|
||||
console.log('no info for starting download this torrent')
|
||||
logT('downloader', 'no info for starting download this torrent')
|
||||
return
|
||||
}
|
||||
console.log('restore download session:', torrent.name)
|
||||
logT('downloader', 'restore download session:', torrent.name)
|
||||
const download = torrentClient._add(torrent, path)
|
||||
if(download)
|
||||
{
|
||||
console.log('restore options')
|
||||
logT('downloader', 'restore options')
|
||||
// restore options
|
||||
download.removeOnDone = removeOnDone
|
||||
if(paused)
|
||||
|
Reference in New Issue
Block a user