Add 'mpv.conf' in the config folder for customizing mpv.

This commit is contained in:
Ian Walton 2019-08-17 18:40:03 -04:00
parent 3cc96333e5
commit 50fc838fd2
2 changed files with 9 additions and 3 deletions

View File

@ -19,8 +19,11 @@ for platform, directory in confdirs:
if sys.platform.startswith(platform):
confdir = directory
def get(app, conf_file):
def get(app, conf_file, create=False):
conf_folder = confdir(app)
if not os.path.isdir(conf_folder):
os.makedirs(conf_folder)
return os.path.join(conf_folder,conf_file)
conf_file = os.path.join(conf_folder,conf_file)
if create and not os.path.isfile(conf_file):
open(conf_file, 'w').close()
return conf_file

View File

@ -3,6 +3,7 @@ import math
import os
import re
import mpv
import conffile
from threading import Thread, RLock
from time import sleep
@ -12,6 +13,7 @@ from utils import synchronous, Timer
# Scrobble progress to Plex server at most every 5 seconds
SCROBBLE_INTERVAL = 5
APP_NAME = 'plex-mpv-shim'
# Mark the item as watch when it is at 95%
COMPLETE_PERCENT = 0.95
@ -28,7 +30,8 @@ class PlayerManager(object):
``media`` are thread safe.
"""
def __init__(self):
self._player = mpv.MPV(input_default_bindings=True,input_vo_keyboard=True,osc=True)
mpv_config = conffile.get(APP_NAME,"mpv.conf", True)
self._player = mpv.MPV(input_default_bindings=True, input_vo_keyboard=True, osc=True, include=mpv_config)
self.url = None
@self._player.on_key_press('q')