diff --git a/renderer/index.js b/renderer/index.js index c860dea0..6a8cfd3d 100644 --- a/renderer/index.js +++ b/renderer/index.js @@ -466,8 +466,8 @@ function addTorrentToList (torrent) { state.saved.torrents.push({ status: 'new', name: torrent.name, - magnetURI: torrent.magnetURI, - infoHash: torrent.infoHash + infoHash: torrent.infoHash, + magnetURI: torrent.magnetURI }) saveState() playInterfaceSound('ADD') @@ -528,7 +528,6 @@ function addTorrentEvents (torrent) { torrentSummary.status = 'downloading' torrentSummary.ready = true torrentSummary.name = torrentSummary.displayName || torrent.name - torrentSummary.infoHash = torrent.infoHash torrentSummary.path = torrent.path // Summarize torrent files @@ -869,16 +868,18 @@ function saveTorrentFileAs (torrentSummary) { var opts = { title: 'Save Torrent File', defaultPath: path.join(state.saved.downloadPath, newFileName), - filters: [{ name: 'Torrents', extensions: ['torrent'] }] + filters: [ + { name: 'Torrent Files', extensions: ['torrent'] }, + { name: 'All Files', extensions: ['*'] } + ] } dialog.showSaveDialog(remote.getCurrentWindow(), opts, (savePath) => { - var torrentFile = fs.createReadStream(torrentSummary.torrentPath) - var savedTorrentFile = fs.createWriteStream(savePath) - torrentFile.on('error', (err) => console.error('Error reading torrent file', err)) - savedTorrentFile.on('error', (err) => console.error('Error saving torrent file', err)) - savedTorrentFile.on('close', () => console.log('Torrent saved', savePath)) - - torrentFile.pipe(savedTorrentFile) + fs.readFile(torrentSummary.torrentPath, function (err, torrentFile) { + if (err) return onError(err) + fs.writeFile(savePath, torrentFile, function (err) { + if (err) return onError(err) + }) + }) }) } diff --git a/renderer/state.js b/renderer/state.js index 42c66475..0e7e890e 100644 --- a/renderer/state.js +++ b/renderer/state.js @@ -64,6 +64,7 @@ module.exports = { { status: 'paused', infoHash: '88594aaacbde40ef3e2510c47374ec0aa396c08e', + magnetURI: 'magnet:?xt=urn:btih:88594aaacbde40ef3e2510c47374ec0aa396c08e&dn=bbb_sunflower_1080p_30fps_normal.mp4&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80%2Fannounce&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&tr=wss%3A%2F%2Ftracker.webtorrent.io&ws=http%3A%2F%2Fdistribution.bbb3d.renderfarming.net%2Fvideo%2Fmp4%2Fbbb_sunflower_1080p_30fps_normal.mp4', displayName: 'Big Buck Bunny', posterURL: path.join('..', 'static', 'bigBuckBunny.jpg'), torrentPath: path.join('.', 'static', 'bigBuckBunny.torrent'), @@ -79,6 +80,7 @@ module.exports = { { status: 'paused', infoHash: '6a9759bffd5c0af65319979fb7832189f4f3c35d', + magnetURI: 'magnet:?xt=urn:btih:6a9759bffd5c0af65319979fb7832189f4f3c35d&dn=sintel.mp4&tr=udp%3A%2F%2Fexodus.desync.com%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.internetwarriors.net%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&tr=wss%3A%2F%2Ftracker.webtorrent.io&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel-1024-surround.mp4', displayName: 'Sintel', posterURL: path.join('..', 'static', 'sintel.jpg'), torrentPath: path.join('.', 'static', 'sintel.torrent'), @@ -94,6 +96,7 @@ module.exports = { { status: 'paused', infoHash: '02767050e0be2fd4db9a2ad6c12416ac806ed6ed', + magnetURI: 'magnet:?xt=urn:btih:02767050e0be2fd4db9a2ad6c12416ac806ed6ed&dn=tears_of_steel_1080p.webm&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&tr=wss%3A%2F%2Ftracker.webtorrent.io', displayName: 'Tears of Steel', posterURL: path.join('..', 'static', 'tearsOfSteel.jpg'), torrentPath: path.join('.', 'static', 'tearsOfSteel.torrent'), diff --git a/static/sintel.torrent b/static/sintel.torrent index cb7ca6c6..d8f20d66 100644 Binary files a/static/sintel.torrent and b/static/sintel.torrent differ