From d5bea54a83d3f54fd2db6728e547776f97a16449 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Sun, 27 Mar 2016 00:58:50 -0700 Subject: [PATCH 1/4] sintel.torrent: Use webtorrent.io torrent --- static/sintel.torrent | Bin 19994 -> 20323 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/static/sintel.torrent b/static/sintel.torrent index cb7ca6c6fc8506c755d84a9d09cc784e3d291ca6..d8f20d6691829b8fb2d682fb70c2802f865c9941 100644 GIT binary patch delta 449 zcma)(O-{ow5QUXBTmdN@AWoeBSQSfl?21??_Rv~&ZENhP6e0Bt-6GUGa3(H-DS<`A zg550M`=s~H>s$13iVmV>z1C*b9EysK!m>2=*z*k_F&6Y7y*G%UJ>h1{+Kd*zg+xi` zmHJ-~RME}&Qu_m-2EXeOr9nr+&1g|Hpvr6(Rsehr=n~swFQfxvaK-Ab?gF`-g}Jdd zWJi1qGyGdL?0)S?WBlI3bJnRGh0fyzbhIp~| z-nyV^2g8pVX>Nj-b3+;(i%^ubEIZoObxxbSftG>hMo7J?*!}W0Y2Q!JcZ;fGf6~$k X>{1sbfl6qWmr2-z;ZuTaZ3*xRSh${t delta 95 zcmaDnk8#! Date: Sun, 27 Mar 2016 01:06:36 -0700 Subject: [PATCH 2/4] Make right click -> "copy magnet uri" work for default torrents For #233 --- renderer/index.js | 5 ++--- renderer/state.js | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/renderer/index.js b/renderer/index.js index c860dea0..e45ce2df 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 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'), From aad3acfe915dc7af0a058748b5bd41e11009468e Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Sun, 27 Mar 2016 01:06:58 -0700 Subject: [PATCH 3/4] Right click -> "Save torrent file" without using streams For #233 --- renderer/index.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/renderer/index.js b/renderer/index.js index e45ce2df..a034501c 100644 --- a/renderer/index.js +++ b/renderer/index.js @@ -871,13 +871,12 @@ function saveTorrentFileAs (torrentSummary) { filters: [{ name: 'Torrents', extensions: ['torrent'] }] } 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) + }) + }) }) } From 75412388e5c110fac872d5c87ee1c5e48e6abd54 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Sun, 27 Mar 2016 01:10:45 -0700 Subject: [PATCH 4/4] Save .torrent dialog: Add "All Files" option --- renderer/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/renderer/index.js b/renderer/index.js index a034501c..6a8cfd3d 100644 --- a/renderer/index.js +++ b/renderer/index.js @@ -868,7 +868,10 @@ 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) => { fs.readFile(torrentSummary.torrentPath, function (err, torrentFile) {