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

Added MPC-BE support #370

Open
wants to merge 1 commit 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
9 changes: 9 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ var argv = rc('peerflix', {}, optimist
.alias('m', 'mplayer').describe('m', 'autoplay in mplayer*').boolean('m')
.alias('g', 'smplayer').describe('g', 'autoplay in smplayer*').boolean('g')
.describe('mpchc', 'autoplay in MPC-HC player*').boolean('boolean')
.describe('mpcbe', 'autoplay in MPC-BE player*').boolean('boolean')
.describe('potplayer', 'autoplay in Potplayer*').boolean('boolean')
.alias('k', 'mpv').describe('k', 'autoplay in mpv*').boolean('k')
.alias('o', 'omx').describe('o', 'autoplay in omx**').boolean('o')
Expand Down Expand Up @@ -75,6 +76,7 @@ var MPLAYER_EXEC = 'mplayer ' + (onTop ? '-ontop' : '') + ' -really-quiet -noidx
var SMPLAYER_EXEC = 'smplayer ' + (onTop ? '-ontop' : '')
var MPV_EXEC = 'mpv ' + (onTop ? '--ontop' : '') + ' --really-quiet --loop=no '
var MPC_HC_ARGS = '/play'
var MPC_BE_ARGS = '/play'
var POTPLAYER_ARGS = ''

var enc = function (s) {
Expand All @@ -100,6 +102,7 @@ if (argv._.length > 1) {
SMPLAYER_EXEC += ' ' + playerArgs
MPV_EXEC += ' ' + playerArgs
MPC_HC_ARGS += ' ' + playerArgs
MPC_BE_ARGS += ' ' + playerArgs
POTPLAYER_ARGS += ' ' + playerArgs
}

Expand Down Expand Up @@ -264,6 +267,12 @@ var ontorrent = function (torrent) {
if (err) return
proc.exec('"' + regItem.value + '" "' + localHref + '" ' + MPC_HC_ARGS)
})
} else if (argv.mpcbe && process.platform === 'win32') {
player = 'mph-be'
registry('HKCU', '\\Software\\MPC-BE\\ShellExt', 'MpcPath', function (err, regItem) {
if (err) return
proc.exec('"' + regItem.value + '" "' + localHref + '" ' + MPC_BE_ARGS)
})
} else if (argv.potplayer && process.platform === 'win32') {
player = 'potplayer'
var runPotPlayer = function (regItem) {
Expand Down