From 41767802c2778d6236beecd2d67779246b0c3de9 Mon Sep 17 00:00:00 2001 From: langolierz Date: Fri, 21 Dec 2018 14:39:30 +0000 Subject: [PATCH] improving openframes capture interaction --- actions.py | 5 ++- json_objects/settings_default.json | 60 +++++++++++++++--------------- video_centre/of_capture.py | 19 ++-------- 3 files changed, 37 insertions(+), 47 deletions(-) diff --git a/actions.py b/actions.py index 2a52989..35ee357 100644 --- a/actions.py +++ b/actions.py @@ -408,10 +408,12 @@ class Actions(object): def switch_dev_mode(self, state): if state == 'on': + self.toggle_of_screen_size('dev') self.video_driver.osc_client.send_message("/dev_mode", True) self.switch_display_to_hdmi() elif state == 'off': - self.video_driver.osc_client.send_message("/dev_mode", False) + self.toggle_of_screen_size('full') + self.video_driver.osc_client.send_message("/dev_mode", True) self.switch_display_to_lcd() def switch_display_to_hdmi(self): @@ -507,7 +509,6 @@ class Actions(object): this_dispatcher.map("/player/a/status", self.video_driver.receive_status, "a.a") this_dispatcher.map("/player/b/status", self.video_driver.receive_status, "b.b") this_dispatcher.map("/player/c/status", self.video_driver.receive_status, "c.c") - this_dispatcher.map("/capture/is_setup", self.capture.receive_state) this_dispatcher.map("/shutdown", self.exit_osc_server) #this_dispatcher.map("/player/a/status", self.set_status) diff --git a/json_objects/settings_default.json b/json_objects/settings_default.json index 45f5df9..dd5fc92 100644 --- a/json_objects/settings_default.json +++ b/json_objects/settings_default.json @@ -1,5 +1,5 @@ { - "capture": { + "captur": { "TYPE": { "action": "update_capture_settings", "options": [ @@ -69,8 +69,8 @@ "value": "auto" } }, - "midi": { - "CHANNEL": { + "incur": { + "MIDI CHANNEL": { "action": null, "options": [ 1, @@ -92,7 +92,7 @@ ], "value": 1 }, - "INPUT": { + "MIDI INPUT": { "action": null, "options": [ "usb", @@ -101,18 +101,11 @@ ], "value": "disabled" }, - "STATUS": { + "MIDI STATUS": { "action": "get_midi_status", "options": [], "value": null }, - "CYCLE_PORT": { - "action": "cycle_midi_port_index", - "options": [], - "value": null - } - }, - "other": { "ANALOG_INPUT": { "action": null, "options": [ @@ -121,20 +114,14 @@ ], "value": "disabled" }, - "UPDATE_CODE": { - "action": "try_pull_code_and_reset", + "MIDI CYCLE_PORT": { + "action": "cycle_midi_port_index", "options": [], "value": null - }, - "DEV_MODE_RESET": { - "action": "switch_dev_mode", - "options": [ - "on", - "off" - ], - "value": "off" - }, - "OF_SCREEN_SIZE": { + } + }, + "conjur":{ + "OF_SCREEN_SIZE": { "action": "toggle_of_screen_size", "options": [ "full", @@ -142,7 +129,7 @@ ], "value": "dev" }, - "USE_OF_CAPTURE": { + "USE_WITH_CAPTUR": { "action": "set_capture_object", "options": [ "yes", @@ -158,13 +145,28 @@ ], "value": "omxplayer" }, - "RESTART_PROGRAM": { - "action": "restart_the_program", + "RESTART_OPENFRAMEWORKS": { + "action": "restart_openframeworks", + "options": [], + "value": null + } +}, + "other": { + "UPDATE_CODE": { + "action": "try_pull_code_and_reset", "options": [], "value": null }, - "RESTART_OPENFRAMEWORKS": { - "action": "restart_openframeworks", + "DEV_MODE_RESET": { + "action": "switch_dev_mode", + "options": [ + "on", + "off" + ], + "value": "off" + }, + "RESTART_PROGRAM": { + "action": "restart_the_program", "options": [], "value": null }, diff --git a/video_centre/of_capture.py b/video_centre/of_capture.py index ba05a2b..2497049 100644 --- a/video_centre/of_capture.py +++ b/video_centre/of_capture.py @@ -29,12 +29,9 @@ class OfCapture(object): print('sending setup message !') self.osc_client.send_message("/capture/setup", self.capture_type) - # try: - # self.device = picamera.PiCamera(resolution=self.resolution, framerate=self.framerate, sensor_mode = self.sensor_mode) - # except picamera.exc.PiCameraError as e: - # self.use_capture = False - # print('camera exception is {}'.format(e)) - # self.message_handler.set_message('INFO', 'no capture device attached') + self.has_capture = True + return True + def piCapture_with_no_source(self): is_piCapture = subprocess.check_output(['pivideo', '--query', 'ready']) @@ -219,15 +216,5 @@ class OfCapture(object): else: return int(fractions.Fraction(setting_value) * 1000000) - def receive_state(self, unused_addr, args): - if args == 1.0: - self.has_capture = True - self.message_handler.set_message('INFO', 'capture device attached') - else: - self.has_capture = False - self.message_handler.set_message('INFO', 'no capture device attached') - print('the has capture is set to {}'.format(self.has_capture)) - def close_capture(self): - pass