Skip to content

Commit

Permalink
Prevent override of user configured scripts. (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
iwalton3 committed Feb 25, 2023
1 parent 2c44996 commit 1f5046f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
26 changes: 12 additions & 14 deletions jellyfin_mpv_shim/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,26 +185,24 @@ def __init__(self):

mpv_options["osc"] = False

if not (settings.mpv_ext and settings.mpv_ext_no_ovr):
# it seems there is no other way to auto-pass scripts
scripts_dir = conffile.get_dir(APP_NAME, "scripts")
for item in os.listdir(scripts_dir):
if not item.endswith(".disable"):
scripts.append(os.path.join(scripts_dir, item))

if scripts:
# it seems there is no other way to auto-pass scripts
scripts_dir = conffile.get_dir(APP_NAME, "scripts")
for item in os.listdir(scripts_dir):
if not item.endswith(".disable"):
scripts.append(os.path.join(scripts_dir, item))

if scripts:
if settings.mpv_ext:
mpv_options["script"] = scripts
else:
mpv_options["scripts"] = (
";" if sys.platform.startswith("win32") else ":"
).join(scripts)

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)
else:
if scripts:
log.warning("Builtin scripts are ignored with mpv_ext_no_ovr.")
log.warning(
f"For full functionality, manually add these scripts: {scripts}"
)

self._player = mpv.MPV(
input_default_bindings=True,
input_vo_keyboard=True,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
install_requires=[
"python-mpv",
"jellyfin-apiclient-python>=1.9.2",
"python-mpv-jsonipc>=1.1.14",
"python-mpv-jsonipc>=1.2.0",
"requests",
],
include_package_data=True,
Expand Down

0 comments on commit 1f5046f

Please sign in to comment.