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

Adds IINA support #365

Open
wants to merge 2 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
10 changes: 10 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('iina', 'autoplay in iina player (MacOS)*').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 @@ -74,6 +75,7 @@ var OMX_EXEC = argv.jack ? 'omxplayer -r -o local ' : 'omxplayer -r -o hdmi '
var MPLAYER_EXEC = 'mplayer ' + (onTop ? '-ontop' : '') + ' -really-quiet -noidx -loop 0 '
var SMPLAYER_EXEC = 'smplayer ' + (onTop ? '-ontop' : '')
var MPV_EXEC = 'mpv ' + (onTop ? '--ontop' : '') + ' --really-quiet --loop=no '
var IINA_EXEC = 'iina --keep-running ' + (onTop ? '--ontop' : '') + ' --really-quiet --loop=no '
var MPC_HC_ARGS = '/play'
var POTPLAYER_ARGS = ''

Expand All @@ -87,6 +89,7 @@ if (argv.t) {
MPLAYER_EXEC += ' -sub ' + enc(argv.t)
SMPLAYER_EXEC += ' -sub ' + enc(argv.t)
MPV_EXEC += ' --sub-file=' + enc(argv.t)
IINA_EXEC += ' --sub-file=' + enc(argv.t)
POTPLAYER_ARGS += ' ' + enc(argv.t)
}

Expand All @@ -99,6 +102,7 @@ if (argv._.length > 1) {
MPLAYER_EXEC += ' ' + playerArgs
SMPLAYER_EXEC += ' ' + playerArgs
MPV_EXEC += ' ' + playerArgs
IINA_EXEC += ' ' + playerArgs
MPC_HC_ARGS += ' ' + playerArgs
POTPLAYER_ARGS += ' ' + playerArgs
}
Expand Down Expand Up @@ -293,6 +297,12 @@ var ontorrent = function (torrent) {
vlc.on('exit', function () {
if (!argv.n && argv.quit !== false) process.exit(0)
})
} else if (argv.iina) {
player = 'iina'
var iina = proc.exec(IINA_EXEC + ' ' + localHref)
iina.on('exit', function () {
if (!argv.n && argv.quit !== false) process.exit(0)
})
}
}

Expand Down