-
Notifications
You must be signed in to change notification settings - Fork 187
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
refactor: use ffprobe even if located under /usr/bin #995
Conversation
Generally you have user installed binaries in |
True, I just wanted to shorten the commit message.
Not necessarily. I might e.g. want to test it with an ffmpeg executable I compiled locally to test a change in ffmpeg. |
@@ -557,7 +557,7 @@ async def probe( | |||
def _probe_codec_native( | |||
source, executable: str = "ffmpeg" | |||
) -> Tuple[Optional[str], Optional[int]]: | |||
exe = executable[:2] + "probe" if executable in ("ffmpeg", "avconv") else executable | |||
exe = executable[:-4] + "probe" if executable.endswith(("ffmpeg", "avconv")) else executable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a general question, shouldn't proper path manipulation be used for this?
Path(executable).parent / "ffprobe"
or similar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. I think
exe = executable[:-4] + "probe" if executable.endswith(("ffmpeg", "avconv")) else executable | |
exe = Path(executable).parent / "ffprobe" if Path(executable).name in ("ffmpeg", "avconv") else executable |
makes the most sense.
Hey @dotlambda, just bumping this. How are you feeling regarding the requested review comments? |
That would then be |
I do not necessarily agree with this for the sake of a change which may only benefit a small subset of users. Can you provide some further reasoning why the library should do this as a default versus you as a developer simply setting an item in the PATH with a higher precedence to be used? Also some context around how the change actually works given it flips the string substringing order would be appreciated |
Closed for the above reasons with no response. |
My specific use case is in Nixpkgs where I want to set a default ffmpeg executable that's used by any user of nextcord. I can't set PATH for those users because they import a Python module rather than run an executable. |
Summary
If I call
_probe_codec_native(source, "/bin/ffmpeg")
I want it to use/bin/ffprobe
.Checklist
task pyright
and fixed the relevant issues.