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

Script doesn't work without terminal on macOS Ventura 13.3 #55

Open
adriannedbailo opened this issue Oct 21, 2023 · 7 comments
Open

Script doesn't work without terminal on macOS Ventura 13.3 #55

adriannedbailo opened this issue Oct 21, 2023 · 7 comments

Comments

@adriannedbailo
Copy link

I'm encountering an issue where I can't launch MPV when opening a video without using the terminal. Additionally, there's another minor problem that I didn't face when using Linux. MPV doesn't seem to respond when I focus on the subtitle window, and vice versa — subtitles don't work when the playback window is in focus. For instance, I'm unable to interact with the keyboard when the subtitle window is active. I can see both components, but unfortunately, they don't seem to interact with each other simultaneously.

@oltodosel
Copy link
Owner

I don't use Mac. So I can't help.

@adriannedbailo
Copy link
Author

When I launch this script using mpv via Finder, it doesn't run. Yet, it works correctly when initiated through the terminal. I suspect the difference lies in the environments of Finder and the terminal. While I'm familiar with the terminal's environment, I'm unsure about Finder's. Is there a way to either modify the script or provide it permissions so it doesn't depend on Finder?

There is a list of environment variables from a terminal session on a macOS system.
__CFBundleIdentifier=com.apple.Terminal
TMPDIR=/var/folders/ct/l54j1pgd3tzckfnjznlr3rtr0000gn/T/
XPC_FLAGS=0x0
LaunchInstanceID=BD8501C3-CB44-40DA-AEF1-B3DCFC0230B1
TERM=xterm-256color
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.Q7Riaf1GLT/Listeners
SECURITYSESSIONID=186b4
XPC_SERVICE_NAME=0
TERM_PROGRAM=Apple_Terminal
TERM_PROGRAM_VERSION=447
TERM_SESSION_ID=AB2CFC2C-CBCE-47CB-AB9E-53343DE4C6ED
SHELL=/bin/zsh
HOME=/Users/arturanovskij
LOGNAME=arturanovskij
USER=arturanovskij
PATH=/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
SHLVL=1
PWD=/Users/arturanovskij
OLDPWD=/Users/arturanovskij
HOMEBREW_PREFIX=/opt/homebrew
HOMEBREW_CELLAR=/opt/homebrew/Cellar
HOMEBREW_REPOSITORY=/opt/homebrew
MANPATH=/opt/homebrew/share/man::
INFOPATH=/opt/homebrew/share/info:
LANG=uk_UA.UTF-8
_=/opt/homebrew/bin/python3
__CF_USER_TEXT_ENCODING=0x1F5:0x7:0x3E

@oltodosel
Copy link
Owner

https://man.archlinux.org/man/mpv.1#load~4
--load-osd-console=<yes|no> Enable the built-in script that shows a console on a key binding and lets you enter commands (default: yes). The ` key is used to show the console by default, and ESC to hide it again.

This way you'd be able to see console output right in the mpv and find out errors that the script might give.

@adriannedbailo
Copy link
Author

Знімок екрана 2023-10-25 о 09 23 14 Знімок екрана 2023-10-25 о 09 24 15 Regrettably it doesn't work and it's unclear why.

@oltodosel
Copy link
Owner

Evidently the python part of the script does not start. The problem must be here:

pyname = '~/.config/mpv/scripts/interSubs.py'

or/and here:
start_command_2 = start_command:format(pyname:gsub('~', os.getenv('HOME')), mpv_socket_2, sub_file_2)

Try entering full path instead on line 22.

@adriannedbailo
Copy link
Author

Evidently the python part of the script does not start. The problem must be here:

pyname = '~/.config/mpv/scripts/interSubs.py'

or/and here:

start_command_2 = start_command:format(pyname:gsub('~', os.getenv('HOME')), mpv_socket_2, sub_file_2)

Try entering full path instead on line 22.

I've tried the first step, and it didn't help. I didn't understand what I should change in line 69, can you help me with that?

@oltodosel
Copy link
Owner

I was wrong about the python part not starting, it very well might be. Console within mpv does not show output from the python script for some reason. I missed that, though your second screenshot clearly shows that.

You can try adding environment variables that your terminal uses right into here:

start_command = 'python3 "%s" "%s" "%s"'

It should look like this:
start_command = 'ENV1=ENV1 ENV2=ENV2 python3 "%s" "%s" "%s"'

python3 should be changed to what your Mac uses

P.S.
Не забувай донатити на дрони.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants