summaryrefslogtreecommitdiff
path: root/voctogui/lib/videopreviews.py
diff options
context:
space:
mode:
authorMaZderMind <git@mazdermind.de>2015-11-15 19:18:28 +0100
committerMaZderMind <git@mazdermind.de>2015-11-15 19:18:28 +0100
commit96d9712579f49d57106ab1462e9571cfc53d222e (patch)
tree30f9b8a0ef838a165143321ff7e95667d1a5caff /voctogui/lib/videopreviews.py
parent7061df44a9f2291c9a9147dea6878bbc1bd424d8 (diff)
avoid re-reansmitting the same state again, fixes #20
Diffstat (limited to 'voctogui/lib/videopreviews.py')
-rw-r--r--voctogui/lib/videopreviews.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/voctogui/lib/videopreviews.py b/voctogui/lib/videopreviews.py
index 1afaa52..d80541f 100644
--- a/voctogui/lib/videopreviews.py
+++ b/voctogui/lib/videopreviews.py
@@ -20,6 +20,8 @@ class VideoPreviewsController(object):
self.a_btns = {}
self.b_btns = {}
+ self.current_source = {'a': None, 'b': None}
+
try:
width = Config.getint('previews', 'width')
self.log.debug('Preview-Width configured to %u', width)
@@ -105,6 +107,10 @@ class VideoPreviewsController(object):
channel, idx = btn_name.split(' ')[:2]
source_name = self.sources[int(idx)]
+ if self.current_source[channel] == source_name:
+ self.log.info('video-channel %s already on %s', channel, source_name)
+ return
+
self.log.info('video-channel %s changed to %s', channel, source_name)
Connection.send('set_video_'+channel, source_name)
@@ -121,5 +127,8 @@ class VideoPreviewsController(object):
def on_video_status(self, source_a, source_b):
self.log.info('on_video_status callback w/ sources: %s and %s', source_a, source_b)
+ self.current_source['a'] = source_a
+ self.current_source['b'] = source_b
+
self.a_btns[source_a].set_active(True)
self.b_btns[source_b].set_active(True)