Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove on player exit #332

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 11 additions & 21 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ var ontorrent = function (torrent) {
})

vlc.on('exit', function () {
if (!argv.n && argv.quit !== false) process.exit(0)
if (!argv.n && argv.quit !== false) onexit()
})
}
}
Expand All @@ -296,28 +296,28 @@ var ontorrent = function (torrent) {
player = 'omx'
var omx = proc.exec(OMX_EXEC + ' ' + localHref)
omx.on('exit', function () {
if (!argv.n && argv.quit !== false) process.exit(0)
if (!argv.n && argv.quit !== false) onexit()
})
}
if (argv.mplayer) {
player = 'mplayer'
var mplayer = proc.exec(MPLAYER_EXEC + ' ' + localHref)
mplayer.on('exit', function () {
if (!argv.n && argv.quit !== false) process.exit(0)
if (!argv.n && argv.quit !== false) onexit()
})
}
if (argv.smplayer) {
player = 'smplayer'
var smplayer = proc.exec(SMPLAYER_EXEC + ' ' + localHref)
smplayer.on('exit', function () {
if (!argv.n && argv.quit !== false) process.exit(0)
if (!argv.n && argv.quit !== false) onexit()
})
}
if (argv.mpv) {
player = 'mpv'
var mpv = proc.exec(MPV_EXEC + ' ' + localHref)
mpv.on('exit', function () {
if (!argv.n && argv.quit !== false) process.exit(0)
if (!argv.n && argv.quit !== false) onexit()
})
}
if (argv.webplay) {
Expand Down Expand Up @@ -468,26 +468,16 @@ var ontorrent = function (torrent) {
// better output a status message so the user knows we're working on it :)
clivas.line('')
clivas.line('{yellow:info} {green:peerflix is exiting...}')
if (argv.remove) {
engine.remove(() => process.exit())
} else {
process.exit()
}
}

watchVerifying(engine)

if (argv.remove) {
var remove = function () {
onexit()
engine.remove(function () {
process.exit()
})
}

process.on('SIGINT', remove)
process.on('SIGTERM', remove)
} else {
process.on('SIGINT', function () {
onexit()
process.exit()
})
}
process.on('SIGINT' || 'SIGTERM', onexit)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will only listen for sigint :) you need to add both listeners

}

parsetorrent.remote(filename, function (err, parsedtorrent) {
Expand Down