Skip to content

Commit

Permalink
Add libmpv-2.dll to windows library search list
Browse files Browse the repository at this point in the history
  • Loading branch information
jaseg committed Nov 18, 2023
1 parent 0bfd64d commit 93cf60e
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions mpv.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,9 @@

if os.name == 'nt':
# Note: mpv-2.dll with API version 2 corresponds to mpv v0.35.0. Most things should work with the fallback, too.
dll = ctypes.util.find_library('mpv-2.dll') or ctypes.util.find_library('mpv-1.dll')
dll = ctypes.util.find_library('mpv-2.dll') or ctypes.util.find_library('libmpv-2.dll') or ctypes.util.find_library('mpv-1.dll')
if dll is None:
raise OSError('Cannot find mpv-1.dll or mpv-2.dll in your system %PATH%. One way to deal with this is to ship '
'the dll with your script and put the directory your script is in into %PATH% before '
'"import mpv": os.environ["PATH"] = os.path.dirname(__file__) + os.pathsep + os.environ["PATH"] '
'If mpv-1.dll is located elsewhere, you can add that path to os.environ["PATH"].')
raise OSError('Cannot find mpv-1.dll, mpv-2.dll or libmpv-2.dll in your system %PATH%. One way to deal with this is to ship the dll with your script and put the directory your script is in into %PATH% before "import mpv": os.environ["PATH"] = os.path.dirname(__file__) + os.pathsep + os.environ["PATH"] If mpv-1.dll is located elsewhere, you can add that path to os.environ["PATH"].')
backend = CDLL(dll)
fs_enc = 'utf-8'
else:
Expand All @@ -52,10 +49,7 @@

sofile = ctypes.util.find_library('mpv')
if sofile is None:
raise OSError("Cannot find libmpv in the usual places. Depending on your distro, you may try installing an "
"mpv-devel or mpv-libs package. If you have libmpv around but this script can't find it, consult "
"the documentation for ctypes.util.find_library which this script uses to look up the library "
"filename.")
raise OSError("Cannot find libmpv in the usual places. Depending on your distro, you may try installing an mpv-devel or mpv-libs package. If you have libmpv around but this script can't find it, consult the documentation for ctypes.util.find_library which this script uses to look up the library filename.")
backend = CDLL(sofile)
fs_enc = sys.getfilesystemencoding()

Expand Down

0 comments on commit 93cf60e

Please sign in to comment.