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',
submenu: [
{
label: 'Create Torrent File...',
label: 'Create New Torrent...',
accelerator: 'CmdOrCtrl+N',
click: function () {
electron.dialog.showOpenDialog({
title: 'Select a file or folder for the torrent file.',
properties: [ 'openFile', 'multiSelections' ]
properties: [ 'openFile', 'openDirectory', 'multiSelections' ]
}, function (filenames) {
filenames.forEach(function (filename) {
mainWindow.send('action', 'addTorrent', filename)
})
if (!Array.isArray(filenames)) return
mainWindow.send('action', 'seed', filenames)
})
}
},

View File

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