Allow using user config with external MPV. (#78)

This commit is contained in:
Ian Walton 2020-08-15 22:15:00 -04:00
parent 9b70c6197c
commit 1c0919f6bf
3 changed files with 12 additions and 8 deletions

View File

@ -195,6 +195,9 @@ for media playback on OSX.
- `mpv_ext_start` - Start a managed copy of MPV with the client. Default: `true` - `mpv_ext_start` - Start a managed copy of MPV with the client. Default: `true`
- If not specified, the user must start MPV prior to launching the client. - If not specified, the user must start MPV prior to launching the client.
- MPV must be launched with `--input-ipc-server=[value of mpv_ext_ipc]`. - MPV must be launched with `--input-ipc-server=[value of mpv_ext_ipc]`.
- `mpv_ext_no_ovr` - Disable built-in mpv configuration files and use user defaults.
- Please note that some scripts and settings, such as ones to keep MPV open, may break
functionality in MPV Shim.
### Keyboard Shortcuts ### Keyboard Shortcuts

View File

@ -40,6 +40,7 @@ class Settings(object):
"mpv_ext_path": None, "mpv_ext_path": None,
"mpv_ext_ipc": None, "mpv_ext_ipc": None,
"mpv_ext_start": True, "mpv_ext_start": True,
"mpv_ext_no_ovr": False,
"enable_osc": True, "enable_osc": True,
"use_web_seek": False, "use_web_seek": False,
"display_mirroring": False, "display_mirroring": False,

View File

@ -108,10 +108,11 @@ class PlayerManager(object):
violates assumptions. violates assumptions.
""" """
def __init__(self): def __init__(self):
mpv_config = conffile.get(APP_NAME,"mpv.conf", True)
input_config = conffile.get(APP_NAME,"input.conf", True)
self._video = None self._video = None
extra_options = {} mpv_options = {}
if not (settings.mpv_ext and settings.mpv_ext_no_ovr):
mpv_options["include"] = conffile.get(APP_NAME,"mpv.conf", True)
mpv_options["input_conf"] = conffile.get(APP_NAME,"input.conf", True)
self.timeline_trigger = None self.timeline_trigger = None
self.action_trigger = None self.action_trigger = None
self.external_subtitles = {} self.external_subtitles = {}
@ -131,16 +132,15 @@ class PlayerManager(object):
self.update_check = UpdateChecker(self) self.update_check = UpdateChecker(self)
if is_using_ext_mpv: if is_using_ext_mpv:
extra_options = { mpv_options.update({
"start_mpv": settings.mpv_ext_start, "start_mpv": settings.mpv_ext_start,
"ipc_socket": settings.mpv_ext_ipc, "ipc_socket": settings.mpv_ext_ipc,
"mpv_location": settings.mpv_ext_path, "mpv_location": settings.mpv_ext_path,
"player-operation-mode": "cplayer" "player-operation-mode": "cplayer"
} })
self._player = mpv.MPV(input_default_bindings=True, input_vo_keyboard=True, self._player = mpv.MPV(input_default_bindings=True, input_vo_keyboard=True,
input_media_keys=True, include=mpv_config, input_conf=input_config, input_media_keys=True, log_handler=mpv_log_handler,
log_handler=mpv_log_handler, loglevel=settings.mpv_log_level, loglevel=settings.mpv_log_level, **mpv_options)
**extra_options)
self.menu = OSDMenu(self) self.menu = OSDMenu(self)
self.syncplay = SyncPlayManager(self) self.syncplay = SyncPlayManager(self)