Skip to content

Commit

Permalink
torrent_cache.js: revert PR from aurismus
Browse files Browse the repository at this point in the history
Lots of bugs since I merged PR from aurismus. 
Bugs with watch button: #114
  • Loading branch information
YIFYtorrents authored Dec 23, 2016
1 parent b9ffeae commit 66f2a2e
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/app/lib/providers/torrent_cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@

var deferred = Q.defer(),
error = false,
parseTorrent = require('parse-torrent'),
engine = peerflix(torrent, {
list: true
}); // just list files, this won't start the torrent server
Expand Down Expand Up @@ -244,14 +243,14 @@
var resolvedTorrentPath = engine.path;
clearTimeout(currentTID);
if (resolvedTorrentPath) {

var torrentInfo = engine.torrent;
torrentInfo.announce = _.union(engine.torrent.announce, parseTorrent(torrent).announce);

fs.writeFileSync(filePath, parseTorrent.toTorrentFile(torrentInfo)); // save torrent

resolve();
destroyEngine();
// copy resolved path to cache so it will be awailable next time
Common.copyFile(resolvedTorrentPath + '.torrent', filePath, function (err) {
if (err) {
error = err;
}
resolve();
destroyEngine();
});
} else {
error = 'TorrentCache.handlemagnet() engine returned no file';
destroyEngine();
Expand Down

0 comments on commit 66f2a2e

Please sign in to comment.