Compare commits

...

2 commits
main ... v0.4.3

Author SHA1 Message Date
jaseg
80a0e7888a Version 0.4.3 2019-12-03 23:45:26 +01:00
ripdog
c6a8088f3a Allow mpv-1.dll to be placed in python script directory (#96)
Windows: Look for DLL in script directory

Loading DLLs through ctypes on Windows is a mess. ctypes looks in PATH, which is different from the Windows built-in DLL loading system. By default ctypes looks next to python.exe, but you might not want to install python script dependencies next to the system-wide python interpreter.

This commit adds a fallback looking for mpv-1.dll in the same directory the mpv.py script is placed in to allow people to use python-mpv with a minimum in configuration. You can still control loading behavior through PATH. For details on this, consult the following stackoverflow answer: https://stackoverflow.com/a/23805306
2019-12-03 23:42:57 +01:00
2 changed files with 5 additions and 2 deletions

5
mpv.py
View file

@ -28,7 +28,10 @@ import re
import traceback import traceback
if os.name == 'nt': if os.name == 'nt':
backend = CDLL('mpv-1.dll') try:
backend = CDLL('mpv-1.dll')
except FileNotFoundError:
backend = CDLL(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'mpv-1.dll'))
fs_enc = 'utf-8' fs_enc = 'utf-8'
else: else:
import locale import locale

View file

@ -3,7 +3,7 @@
from setuptools import setup from setuptools import setup
setup( setup(
name = 'python-mpv', name = 'python-mpv',
version = '0.4.2', version = '0.4.3',
py_modules = ['mpv'], py_modules = ['mpv'],
description = 'A python interface to the mpv media player', description = 'A python interface to the mpv media player',
url = 'https://github.com/jaseg/python-mpv', url = 'https://github.com/jaseg/python-mpv',