Ejemplo n.º 1
0
 def on_loop(self):
     api.playout(
         timeout=1,
         action="set",
         id_channel=self.id_channel,
         key="loop",
         value=self.btn_loop.isChecked(),
     )
Ejemplo n.º 2
0
    def on_activate(self, mi):
        obj = self.model().object_data[mi.row()]
        can_mcr = has_right("mcr", self.id_channel)
        if obj.object_type == "item":

            if obj.id:
                if obj["item_role"] == "placeholder":
                    self.on_edit_item()

                elif self.parent().mcr and self.parent().mcr.isVisible(
                ) and can_mcr:
                    response = api.playout(
                        timeout=1,
                        action="cue",
                        id_channel=self.id_channel,
                        id_item=obj.id,
                    )
                    if not response:
                        logging.error(response.message)
                    self.clearSelection()

        # Event edit
        elif obj.object_type == "event" and (
                has_right("scheduler_view", self.id_channel)
                or has_right("scheduler_edit", self.id_channel)):
            self.on_edit_event()
        self.clearSelection()
Ejemplo n.º 3
0
    def execute(self, name):
        data = {}
        for slot in self.slots:
            data[slot] = self.slots[slot].get_value()

        response = api.playout(
            action="plugin_exec",
            id_channel=self.id_channel,
            id_plugin=self.id_plugin,
            action_name=name,
            data=json.dumps(data),
        )
        if response:
            logging.info(f"{self.title} action '{name}' executed succesfully.")
        else:
            logging.error(
                f"[PLUGINS] Plugin error {response.response}\n\n{response.message}"
            )
Ejemplo n.º 4
0
    def load(self):
        if not has_right("mcr", self.id_channel):
            return

        logging.debug("[PLUGINS] Loading playout plugins")
        for idx in reversed(range(self.count())):
            widget = self.widget(idx)
            self.removeTab(idx)
            widget.deleteLater()

        response = api.playout(action="plugin_list",
                               id_channel=self.id_channel)
        if not response:
            logging.error(
                f"[PLUGINS] Unable to load playout plugins:\n{response.message}"
            )
            return

        for plugin in response.data or []:
            self.plugins.append(PlayoutPlugin(self, plugin))
            self.addTab(self.plugins[-1], plugin.get("title", "unknown"))
Ejemplo n.º 5
0
 def on_cue_backward(self):
     api.playout(timeout=1,
                 action="cue_backward",
                 id_channel=self.id_channel)
Ejemplo n.º 6
0
 def on_abort(self):
     api.playout(timeout=1, action="abort", id_channel=self.id_channel)
Ejemplo n.º 7
0
 def on_retake(self):
     api.playout(timeout=1, action="retake", id_channel=self.id_channel)
Ejemplo n.º 8
0
 def on_freeze(self):
     api.playout(timeout=1, action="freeze", id_channel=self.id_channel)