aboutsummaryrefslogtreecommitdiff
path: root/voctocore/lib/commands.py
diff options
context:
space:
mode:
authorMaZderMind <github@mazdermind.de>2015-05-10 23:07:11 +0200
committerMaZderMind <github@mazdermind.de>2015-05-10 23:07:11 +0200
commita93c71be7f309265658cd0cbc8bd63f22d7ce04f (patch)
tree0870006a765e15f4fe22f8db7b69d9b92700895b /voctocore/lib/commands.py
parent80d57d8006a5af2854efa195c49c6f5edd5f93b1 (diff)
Add controll-server and control mixer
Diffstat (limited to 'voctocore/lib/commands.py')
-rw-r--r--voctocore/lib/commands.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/voctocore/lib/commands.py b/voctocore/lib/commands.py
new file mode 100644
index 0000000..f3243f3
--- /dev/null
+++ b/voctocore/lib/commands.py
@@ -0,0 +1,39 @@
+#!/usr/bin/python3
+import logging
+
+from lib.config import Config
+
+class ControlServerCommands():
+ log = logging.getLogger('ControlServerCommands')
+
+ pipeline = None
+ vnames = []
+
+ def __init__(self, pipeline):
+ self.pipeline = pipeline
+ self.vnames = Config.getlist('sources', 'video')
+
+ def decodeVideoSrcName(self, src_name_or_id):
+ if isinstance(src_name_or_id, str):
+ try:
+ return self.vnames.index(src_name_or_id)
+ except Exception as e:
+ raise IndexError("video-source %s unknown" % src_name_or_id)
+
+ if src_name_or_id < 0 or src_name_or_id >= len(self.vnames):
+ raise IndexError("video-source %s unknown" % src_name_or_id)
+
+
+ def set_video_a(self, src_name_or_id):
+ src_id = self.decodeVideoSrcName(src_name_or_id)
+ self.pipeline.vmixer.setVideoA(src_id)
+ return True
+
+ def set_video_b(self, src_name_or_id):
+ src_id = self.decodeVideoSrcName(src_name_or_id)
+ self.pipeline.vmixer.setVideoB(src_id)
+ return True
+
+ def set_composite_mode(self, composite_mode):
+ self.pipeline.vmixer.set_composite_mode(src_name_or_id)
+ return True