smplayer-dev / smplayer

Free Media Player for Windows, Linux and Mac OS with YouTube support.
https://smplayer.info
GNU General Public License v2.0
639 stars 91 forks source link

yt-dlp not detected in macOS #715

Open superbonaci opened 1 year ago

superbonaci commented 1 year ago

Describe the bug yt-dlp is already installed in my system but smplayer doesn't detect it. When trying to open YouTube URL says "SMPlayer failed to communicate with the external YouTube application..."

$ which -a yt-dlp
/opt/homebrew/bin/yt-dlp

To Reproduce Steps to reproduce the behavior:

  1. Install brew: https://brew.sh/
  2. Install smplayer: brew install --cask smplayer
  3. Install yt-dlp: brew install yt-dpl
  4. Try to open any YouTube URL
  5. See error

Expected behavior Detect yt-dlp location based on $PATH or be able to manually add yt-dlp path.

Your Enviroment

TinosNitso commented 8 months ago

My autoloader.lua has a fix. It's like this: --script-opts=ytdl_hook-ytdl_path=/Users/username/Desktop/yt-dlp_macos

I just downloaded yt-dlp_macos to my Desktop.

superbonaci commented 8 months ago

@TinosNitso can you use environment variables in the autoloader.lua? for example

--script-opts=ytdl_hook-ytdl_path=$HOME/Desktop/yt-dlp_macos
TinosNitso commented 8 months ago

That's too general for me at the moment. I'd have to go through & test all 3 OSs. In my latest update I changed it to require the executable be in the same folder as autoloader.lua, & all other scripts. The simplest idea is to put all scripts wherever yt-dlp is, or vice versa, unless it's Windows.

I haven't properly released it yet due to on-going testing issues. Getting all scripts to always work with YouTube on MacOS is a new challenge. Insta-pausing doesn't work in that case, etc. 🤔

smplayer-dev commented 8 months ago

SMPlayer downloads and uses yt-dlp from ~/bin because it doesn't rely on a system version, which could become obsolete pretty quickly.

I guess you can create a symlink in ~/bin pointing to your system version.

superbonaci commented 8 months ago

I think it's more common for users to have ~/.local/bin than ~/bin in $PATH. Although I think MacOS by default does not include any dir inside any user's home as PATH, it has to be manually added to ~/.zshrc.