2023-11-25 13:49:41 +00:00
|
|
|
from src.backend.PluginManager.ActionBase import ActionBase
|
|
|
|
from src.backend.PluginManager.PluginBase import PluginBase
|
2024-02-15 10:03:05 +00:00
|
|
|
from src.backend.PluginManager.ActionHolder import ActionHolder
|
2023-11-25 13:49:41 +00:00
|
|
|
|
|
|
|
# Import gtk modules
|
|
|
|
import gi
|
|
|
|
gi.require_version("Gtk", "4.0")
|
|
|
|
gi.require_version("Adw", "1")
|
|
|
|
from gi.repository import Gtk, Adw, Gdk
|
|
|
|
|
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
import threading
|
|
|
|
from datetime import timedelta
|
|
|
|
from loguru import logger as log
|
|
|
|
|
|
|
|
# Add plugin to sys.paths
|
|
|
|
sys.path.append(os.path.dirname(__file__))
|
|
|
|
|
|
|
|
from OBSActionBase import OBSActionBase
|
|
|
|
|
2024-01-14 10:50:34 +00:00
|
|
|
from actions.ToggleRecord.ToggleRecord import ToggleRecord
|
|
|
|
from actions.RecPlayPause.RecPlayPause import RecPlayPause
|
2024-03-26 14:30:17 +00:00
|
|
|
from actions.SwitchScene.SwitchScene import SwitchScene
|
2023-11-25 13:49:41 +00:00
|
|
|
|
|
|
|
class OBS(PluginBase):
|
|
|
|
def __init__(self):
|
|
|
|
super().__init__()
|
|
|
|
|
2024-01-14 10:50:34 +00:00
|
|
|
# Launch backend
|
2024-02-15 10:03:05 +00:00
|
|
|
print("launch backend")
|
2024-01-14 12:56:10 +00:00
|
|
|
self.launch_backend(os.path.join(self.PATH, "backend", "backend.py"), os.path.join(self.PATH, ".venv"))
|
2024-02-15 10:03:05 +00:00
|
|
|
print("backend launched")
|
|
|
|
|
|
|
|
self.lm = self.locale_manager
|
|
|
|
self.lm.set_to_os_default()
|
|
|
|
|
|
|
|
|
|
|
|
self.register(
|
|
|
|
plugin_name=self.lm.get("plugin.name"),
|
2024-03-09 12:50:43 +00:00
|
|
|
github_repo="https://github.com/StreamController/OBSPlugin",
|
2024-03-07 15:02:25 +00:00
|
|
|
plugin_version="1.0.0",
|
|
|
|
app_version="1.0.0-alpha",
|
2024-02-15 10:03:05 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
toggle_record_action_holder = ActionHolder(
|
|
|
|
plugin_base=self,
|
|
|
|
action_base=ToggleRecord,
|
2024-03-26 14:33:54 +00:00
|
|
|
action_id="com_core447_OBSPlugin::ToggleRecord",
|
2024-02-15 10:03:05 +00:00
|
|
|
action_name=self.lm.get("actions.toggle-record.name")
|
|
|
|
)
|
|
|
|
self.add_action_holder(toggle_record_action_holder)
|
|
|
|
|
|
|
|
rec_play_pause_action_holder = ActionHolder(
|
|
|
|
plugin_base=self,
|
|
|
|
action_base=RecPlayPause,
|
2024-03-26 14:33:54 +00:00
|
|
|
action_id="com_core447_OBSPlugin::RecPlayPause",
|
2024-02-15 10:03:05 +00:00
|
|
|
action_name=self.lm.get("actions.rec-play-pause.name")
|
|
|
|
)
|
|
|
|
self.add_action_holder(rec_play_pause_action_holder)
|
2023-11-25 13:49:41 +00:00
|
|
|
|
2024-03-26 14:30:17 +00:00
|
|
|
switch_scene_action_holder = ActionHolder(
|
|
|
|
plugin_base=self,
|
|
|
|
action_base=SwitchScene,
|
2024-03-26 14:33:54 +00:00
|
|
|
action_id="com_core447_OBSPlugin::SwitchScene",
|
2024-03-26 14:30:17 +00:00
|
|
|
action_name=self.lm.get("actions.switch-scene.name")
|
|
|
|
)
|
|
|
|
self.add_action_holder(switch_scene_action_holder)
|
|
|
|
|
2023-11-25 13:49:41 +00:00
|
|
|
# Load custom css
|
|
|
|
self.add_css_stylesheet(os.path.join(self.PATH, "style.css"))
|