1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00

Infile code reorganization

This commit is contained in:
Chocobozzz 2016-01-31 11:23:52 +01:00
parent cda021079f
commit c45f7f8400
26 changed files with 661 additions and 524 deletions

View file

@ -10,22 +10,21 @@
var host = config.get('webserver.host')
var port = config.get('webserver.port')
var nodeKey = 'webtorrentnode' + port
var processKey = 'webtorrent' + port
ipc.config.silent = true
ipc.config.id = nodeKey
var webtorrentnode = {}
var webtorrentnode = {
add: add,
app: null, // Pid of the app
create: create,
remove: remove,
seed: seed,
silent: false // Useful for beautiful tests
}
// Useful for beautiful tests
webtorrentnode.silent = false
// Useful to kill it
webtorrentnode.app = null
webtorrentnode.create = function (options, callback) {
function create (options, callback) {
if (typeof options === 'function') {
callback = options
options = {}
@ -75,7 +74,7 @@
ipc.server.start()
}
webtorrentnode.seed = function (path, callback) {
function seed (path, callback) {
var extension = pathUtils.extname(path)
var basename = pathUtils.basename(path, extension)
var data = {
@ -104,7 +103,7 @@
ipc.server.broadcast(processKey + '.seed', data)
}
webtorrentnode.add = function (magnetUri, callback) {
function add (magnetUri, callback) {
var data = {
_id: magnetUri,
args: {
@ -131,7 +130,7 @@
ipc.server.broadcast(processKey + '.add', data)
}
webtorrentnode.remove = function (magnetUri, callback) {
function remove (magnetUri, callback) {
var data = {
_id: magnetUri,
args: {
@ -156,5 +155,7 @@
ipc.server.broadcast(processKey + '.remove', data)
}
// ---------------------------------------------------------------------------
module.exports = webtorrentnode
})()