mirror of
https://github.com/jellyfin/jellyfin-mpv-shim.git
synced 2024-11-22 21:49:41 +00:00
Added support for creating a .app file (#184)
* Added support for creating a .app file * Updated webclient to use get_resources properly and added an extra check for mpv_location * code fixes and removed unneccesary check for platform * changed mpv location conditional to check if it's frozen * forgot to use get_resource for packaged mpv * added platform check for get_resource
This commit is contained in:
parent
b078f0091b
commit
4eda21e688
BIN
jellyfin.icns
Normal file
BIN
jellyfin.icns
Normal file
Binary file not shown.
@ -2,6 +2,7 @@ import logging
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import platform
|
||||
|
||||
from threading import RLock, Lock, Event
|
||||
from queue import Queue
|
||||
@ -123,6 +124,10 @@ class PlayerManager(object):
|
||||
def __init__(self):
|
||||
self._video = None
|
||||
mpv_options = OrderedDict()
|
||||
mpv_location = settings.mpv_ext_path
|
||||
# Use bundled path for MPV if not specified by user, on Mac OS, and frozen
|
||||
if mpv_location is None and platform.system() == "Darwin" and getattr(sys, 'frozen', False):
|
||||
mpv_location = get_resource('mpv')
|
||||
self.timeline_trigger = None
|
||||
self.action_trigger = None
|
||||
self.external_subtitles = {}
|
||||
@ -149,7 +154,7 @@ class PlayerManager(object):
|
||||
{
|
||||
"start_mpv": settings.mpv_ext_start,
|
||||
"ipc_socket": settings.mpv_ext_ipc,
|
||||
"mpv_location": settings.mpv_ext_path,
|
||||
"mpv_location": mpv_location,
|
||||
"player-operation-mode": "cplayer",
|
||||
}
|
||||
)
|
||||
|
@ -6,6 +6,7 @@ from threading import Lock
|
||||
import logging
|
||||
import sys
|
||||
import os.path
|
||||
import platform
|
||||
|
||||
from .conf import settings
|
||||
from datetime import datetime
|
||||
@ -234,6 +235,10 @@ def get_resource(*path):
|
||||
else:
|
||||
application_path = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
# ! Test code for Mac
|
||||
if getattr(sys, 'frozen', False) and platform.system() == 'Darwin':
|
||||
application_path = os.path.join(os.path.dirname(sys.executable), "../Resources")
|
||||
|
||||
return os.path.join(application_path, *path)
|
||||
|
||||
|
||||
|
@ -57,7 +57,7 @@ class Server(threading.Thread):
|
||||
app = Flask(
|
||||
__name__,
|
||||
static_url_path="",
|
||||
static_folder=get_resource("webclient_view", "webclient"),
|
||||
static_folder=get_resource("webclient_view", "webclient")
|
||||
)
|
||||
|
||||
@app.after_request
|
||||
|
22
setup-mac.py
Normal file
22
setup-mac.py
Normal file
@ -0,0 +1,22 @@
|
||||
from setuptools import setup
|
||||
|
||||
APP = ['/usr/local/bin/jellyfin-mpv-desktop']
|
||||
OPTIONS = {
|
||||
'argv_emulation' : True,
|
||||
'iconfile' : 'jellyfin.icns',
|
||||
'resources' : [
|
||||
'/usr/local/bin/mpv',
|
||||
'/usr/local/bin/jellyfin-mpv-shim',
|
||||
'/usr/local/lib/python3.9/site-packages/jellyfin_mpv_shim/webclient_view'
|
||||
],
|
||||
'packages': [
|
||||
'pkg_resources'
|
||||
]
|
||||
}
|
||||
|
||||
setup(
|
||||
app=APP,
|
||||
name='Jellyfin MPV Desktop',
|
||||
options={'py2app': OPTIONS},
|
||||
setup_requires=['py2app'],
|
||||
)
|
Loading…
Reference in New Issue
Block a user