jellyfin-mpv-shim/run.py

24 lines
779 B
Python
Raw Normal View History

2019-08-18 06:09:42 +00:00
#!/usr/bin/env python3
# Newer revisions of python-mpv require mpv-1.dll in the PATH.
import os
import sys
2020-01-17 03:11:54 +00:00
import multiprocessing
2020-08-22 15:38:07 +00:00
if sys.platform.startswith("win32") or sys.platform.startswith("cygwin"):
# Detect if bundled via pyinstaller.
# From: https://stackoverflow.com/questions/404744/
2020-08-22 15:38:07 +00:00
if getattr(sys, "frozen", False):
2020-08-22 19:00:24 +00:00
application_path = getattr(sys, "_MEIPASS")
else:
application_path = os.path.dirname(os.path.abspath(__file__))
os.environ["PATH"] = application_path + os.pathsep + os.environ["PATH"]
2020-01-11 04:10:08 +00:00
from jellyfin_mpv_shim.mpv_shim import main
2020-08-22 15:38:07 +00:00
if __name__ == "__main__":
2020-01-17 03:11:54 +00:00
# https://stackoverflow.com/questions/24944558/pyinstaller-built-windows-exe-fails-with-multiprocessing
multiprocessing.freeze_support()
2020-08-22 15:38:07 +00:00
main()