|
@ -147,16 +147,16 @@ export default class TorrentManager extends TorrentClientIpc |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Invoked when a torrent |
|
|
|
|
|
|
|
|
* Invoked when a torrent has finished downloading |
|
|
*/ |
|
|
*/ |
|
|
protected async onTorrentFinished(infoHash: string) { |
|
|
protected async onTorrentFinished(infoHash: string) { |
|
|
let torrent = await MovieTorrent.findOne({ |
|
|
let torrent = await MovieTorrent.findOne({ |
|
|
where: { infoHash }, relations: ["movieTicket"] |
|
|
where: { infoHash }, relations: ["movieTicket"] |
|
|
}); |
|
|
}); |
|
|
if (torrent !== undefined) { |
|
|
|
|
|
let details = (await this.details(infoHash))[0]; |
|
|
|
|
|
this.app.service<Supervisor>("Supervisor").onMovieTorrentFinished(torrent, details); |
|
|
|
|
|
|
|
|
if (torrent === undefined || torrent.movieTicket.isFulfilled || torrent.movieTicket.isCanceled) { |
|
|
|
|
|
return; |
|
|
} |
|
|
} |
|
|
// this.app.service<Supervisor>();
|
|
|
|
|
|
|
|
|
let details = (await this.details(infoHash))[0]; |
|
|
|
|
|
this.app.service<Supervisor>("Supervisor").onMovieTorrentFinished(torrent, details); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |