From f165369c9f05ea7a7b6940eb34dd7fe64d48c0bf Mon Sep 17 00:00:00 2001 From: fractal161 <628snapdragon@gmail.com> Date: Sat, 4 Feb 2023 15:16:10 -0500 Subject: [PATCH] check for mpv configuration directory --- mps_youtube/players/mpv.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mps_youtube/players/mpv.py b/mps_youtube/players/mpv.py index f59d0c04..3d427713 100644 --- a/mps_youtube/players/mpv.py +++ b/mps_youtube/players/mpv.py @@ -113,6 +113,9 @@ def clean_up(self): def launch_player(self, cmd): self.input_file = _get_input_file() cmd.append('--input-conf=' + self.input_file) + self.conf_dir = _get_conf_dir() + if self.conf_dir is not None: + cmd.append('--config-dir=' + self.conf_dir) self.sockpath = None self.fifopath = None @@ -310,6 +313,17 @@ def _get_input_file(): tmpfile.write(conf) return tmpfile.name +def _get_conf_dir(): + """ + Check if an mpv configuration directory is present in the + main configuration directory, and return its path if so + """ + confpath = os.path.join(paths.get_config_dir(), "mpv") + if os.path.isdir(confpath): + util.dbg("using %s for configuration directory", confpath) + return confpath + return None + def _get_mpv_version(exename): """ Get version of mpv as 3-tuple. """