new menu option: creating new torrents

This commit is contained in:
Feross Aboukhadijeh
2016-03-02 02:33:18 -08:00
parent 2ff2031ed1
commit 7a22e73840
2 changed files with 8 additions and 5 deletions

View File

@@ -85,16 +85,15 @@ var template = [
label: 'File', label: 'File',
submenu: [ submenu: [
{ {
label: 'Create Torrent File...', label: 'Create New Torrent...',
accelerator: 'CmdOrCtrl+N', accelerator: 'CmdOrCtrl+N',
click: function () { click: function () {
electron.dialog.showOpenDialog({ electron.dialog.showOpenDialog({
title: 'Select a file or folder for the torrent file.', title: 'Select a file or folder for the torrent file.',
properties: [ 'openFile', 'multiSelections' ] properties: [ 'openFile', 'openDirectory', 'multiSelections' ]
}, function (filenames) { }, function (filenames) {
filenames.forEach(function (filename) { if (!Array.isArray(filenames)) return
mainWindow.send('action', 'addTorrent', filename) mainWindow.send('action', 'seed', filenames)
})
}) })
} }
}, },

View File

@@ -69,6 +69,10 @@ function handler (action, ...args) {
var torrentId = args[0] var torrentId = args[0]
addTorrent(torrentId) addTorrent(torrentId)
} }
if (action === 'seed') {
var files = args[0]
seed(files)
}
if (action === 'openPlayer') { if (action === 'openPlayer') {
var torrent = args[0] var torrent = args[0]
openPlayer(torrent) openPlayer(torrent)