Skip to content

Commit

Permalink
Merge pull request #1209 from fractal161/mpv-conf
Browse files Browse the repository at this point in the history
fix: check for mpv configuration directory
  • Loading branch information
iamtalhaasghar authored Feb 23, 2023
2 parents 496b776 + f165369 commit 3d4e720
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions mps_youtube/players/mpv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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. """
Expand Down

0 comments on commit 3d4e720

Please sign in to comment.