Compare commits

..

No commits in common. "ddb273024920d1a16c548686d12d2360471257e7" and "fcfe97ad89a3df36d72a4c77dff49cc0c23bb9d2" have entirely different histories.

6 changed files with 3 additions and 28 deletions

View File

@ -1,10 +0,0 @@
import cec
class CECHandler:
def __init__(self):
cec.init()
def power_on_if_needed(self):
tc = cec.Device(cec.CECDEVICE_TV)
if not tc.is_on():
tc.power_on()

View File

@ -37,9 +37,6 @@ class Config:
# The entire configuration file for use in user scripts # The entire configuration file for use in user scripts
options: dict[str, Any] options: dict[str, Any]
# Enables the use of CEC
cec: bool
def load_config(config_path: Path | None) -> Config: def load_config(config_path: Path | None) -> Config:
if config_path is None: if config_path is None:
@ -67,5 +64,4 @@ def load_config(config_path: Path | None) -> Config:
config_data.get("players", {}), config_data.get("players", {}),
), ),
options=config_data.get("options", {}), options=config_data.get("options", {}),
cec=config_data.get("cec", False),
) )

View File

@ -151,11 +151,6 @@ class PlayerRpcObject(JsonRpcObject):
@after(lambda: I.get("DataBridge").set_loading(False)) @after(lambda: I.get("DataBridge").set_loading(False))
def open(self, params: dict[str, Any]) -> Any: def open(self, params: dict[str, Any]) -> Any:
# Turn on the TV
config: Config = I.get("Config")
if config.cec:
I.get("CECHandler").power_on_if_needed()
I.get("DataBridge").set_loading(True) I.get("DataBridge").set_loading(True)
url = urlparse(params["item"]["file"]) url = urlparse(params["item"]["file"])
@ -166,6 +161,7 @@ class PlayerRpcObject(JsonRpcObject):
url = urlparse(url.query) url = urlparse(url.query)
# Find out what player class to use # Find out what player class to use
config: Config = I.get("Config")
scheme_configuration = config.players.get(url.scheme) scheme_configuration = config.players.get(url.scheme)
if scheme_configuration is None: if scheme_configuration is None:
I.get("DataBridge").notification.emit(f"No player available for {url.scheme}") I.get("DataBridge").notification.emit(f"No player available for {url.scheme}")

View File

@ -13,7 +13,6 @@ from PySide6.QtQml import QQmlApplicationEngine
from microkodi.jsonrpc import JsonRpcHandler, GlobalMethodHandler from microkodi.jsonrpc import JsonRpcHandler, GlobalMethodHandler
from microkodi.ui.bridge import DataBridge from microkodi.ui.bridge import DataBridge
from microkodi.config import Config, load_config from microkodi.config import Config, load_config
from microkodi.cec_handler import CECHandler
from microkodi.repository import I from microkodi.repository import I
@ -24,11 +23,6 @@ def run_kodi_server():
method_handler = GlobalMethodHandler() method_handler = GlobalMethodHandler()
I.register("GlobalMethodHandler", method_handler) I.register("GlobalMethodHandler", method_handler)
# Setup CEC
if config.cec:
I.register("CECHandler", CECHandler())
logger.info("Enabling CEC support")
# Load extra plugins # Load extra plugins
if config.scripts: if config.scripts:
logger.info("Loading scripts...") logger.info("Loading scripts...")

View File

@ -77,7 +77,7 @@ class VlcProgram(Program):
return self._process is not None and self._process.returncode is None return self._process is not None and self._process.returncode is None
def is_playing(self) -> bool: def is_playing(self) -> bool:
return self.get_player_info().playing return self.get_player_info().is_playing
def resume(self): def resume(self):
self.__vlc_command("pl_pause") self.__vlc_command("pl_pause")

View File

@ -4,8 +4,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"pyside6", "pyside6",
"requests", "requests",
"yt-dlp", "yt-dlp"
"cec"
] ]
[tools.build] [tools.build]