mirror of
https://github.com/cyberboy666/r_e_c_u_r.git
synced 2025-12-05 16:00:06 +01:00
updating settings
This commit is contained in:
63
actions.py
63
actions.py
@@ -32,7 +32,7 @@ class Actions(object):
|
||||
self.server = self.setup_osc_server()
|
||||
|
||||
def set_capture_object(self, value):
|
||||
if self.data.settings['captur']['USE_OF_CAPTURE']['value'] == 'yes':
|
||||
if self.data.settings['video']['VIDEO_BACKEND']['value'] != 'omxplayer':
|
||||
self.python_capture.close_capture()
|
||||
self.capture = self.of_capture
|
||||
else:
|
||||
@@ -83,7 +83,7 @@ class Actions(object):
|
||||
|
||||
def _load_this_slot_into_next_player(self, slot):
|
||||
### load next player for seamless type otherwise respect player mode
|
||||
if self.data.settings['recur']['LOOP_TYPE']['value'] == 'seamless':
|
||||
if self.data.settings['sampler']['LOOP_TYPE']['value'] == 'seamless':
|
||||
if self.data.update_next_slot_number(slot):
|
||||
self.video_driver.reload_next_player()
|
||||
else:
|
||||
@@ -127,7 +127,7 @@ class Actions(object):
|
||||
self._load_this_slot_into_next_player(9)
|
||||
|
||||
def switch_to_next_player(self):
|
||||
if self.data.settings['recur']['LOOP_TYPE']['value'] == 'seamless':
|
||||
if self.data.settings['sampler']['LOOP_TYPE']['value'] == 'seamless':
|
||||
self.video_driver.switch_players_and_start_video()
|
||||
else:
|
||||
self.video_driver.current_player.toggle_show()
|
||||
@@ -137,7 +137,7 @@ class Actions(object):
|
||||
|
||||
def cycle_display_mode(self):
|
||||
display_modes = [["BROWSER",'NAV_BROWSER'],["SETTINGS",'NAV_SETTINGS'],[ "SAMPLER",'PLAYER']]
|
||||
if self.data.settings['conjur']['VIDEO_BACKEND']['value'] == 'openframeworks':
|
||||
if self.data.settings['video']['VIDEO_BACKEND']['value'] == 'openframeworks':
|
||||
display_modes.append(["SHADERS",'NAV_SHADERS'])
|
||||
if self.data.settings['detour']['TRY_DEMO']['value'] == 'enabled':
|
||||
display_modes.append(["DETOUR",'NAV_DETOUR'])
|
||||
@@ -149,8 +149,8 @@ class Actions(object):
|
||||
|
||||
|
||||
def toggle_action_on_player(self):
|
||||
play = 'play' in self.data.settings['recur']['ON_ACTION']['value']
|
||||
show = 'show' in self.data.settings['recur']['ON_ACTION']['value']
|
||||
play = 'play' in self.data.settings['sampler']['ON_ACTION']['value']
|
||||
show = 'show' in self.data.settings['sampler']['ON_ACTION']['value']
|
||||
if play:
|
||||
self.toggle_play_on_player()
|
||||
if show:
|
||||
@@ -169,24 +169,24 @@ class Actions(object):
|
||||
self.video_driver.next_player.toggle_show()
|
||||
|
||||
def increase_seek_time(self):
|
||||
options = self.data.settings['recur']['SEEK_TIME']['options']
|
||||
current_index = [index for index, item in enumerate(options) if item == self.data.settings['recur']['SEEK_TIME']['value'] ][0]
|
||||
self.data.settings['recur']['SEEK_TIME']['value'] = options[(current_index + 1) % len(options) ]
|
||||
self.message_handler.set_message('INFO', 'The Seek Time is now ' + str(self.data.settings['recur']['SEEK_TIME']['value']) + 's')
|
||||
options = self.data.settings['sampler']['SEEK_TIME']['options']
|
||||
current_index = [index for index, item in enumerate(options) if item == self.data.settings['sampler']['SEEK_TIME']['value'] ][0]
|
||||
self.data.settings['sampler']['SEEK_TIME']['value'] = options[(current_index + 1) % len(options) ]
|
||||
self.message_handler.set_message('INFO', 'The Seek Time is now ' + str(self.data.settings['sampler']['SEEK_TIME']['value']) + 's')
|
||||
|
||||
|
||||
def decrease_seek_time(self):
|
||||
options = self.data.settings['recur']['SEEK_TIME']['options']
|
||||
current_index = [index for index, item in enumerate(options) if item == self.data.settings['recur']['SEEK_TIME']['value'] ][0]
|
||||
self.data.settings['recur']['SEEK_TIME']['value'] = options[(current_index - 1) % len(options) ]
|
||||
self.message_handler.set_message('INFO', 'The Seek Time is now ' + str(self.data.settings['recur']['SEEK_TIME']['value']) + 's')
|
||||
options = self.data.settings['sampler']['SEEK_TIME']['options']
|
||||
current_index = [index for index, item in enumerate(options) if item == self.data.settings['sampler']['SEEK_TIME']['value'] ][0]
|
||||
self.data.settings['sampler']['SEEK_TIME']['value'] = options[(current_index - 1) % len(options) ]
|
||||
self.message_handler.set_message('INFO', 'The Seek Time is now ' + str(self.data.settings['sampler']['SEEK_TIME']['value']) + 's')
|
||||
|
||||
|
||||
def seek_forward_on_player(self):
|
||||
self.video_driver.current_player.seek(self.data.settings['recur']['SEEK_TIME']['value'])
|
||||
self.video_driver.current_player.seek(self.data.settings['sampler']['SEEK_TIME']['value'])
|
||||
|
||||
def seek_back_on_player(self):
|
||||
self.video_driver.current_player.seek(-(self.data.settings['recur']['SEEK_TIME']['value']))
|
||||
self.video_driver.current_player.seek(-(self.data.settings['sampler']['SEEK_TIME']['value']))
|
||||
|
||||
def toggle_function(self):
|
||||
self.data.function_on = not self.data.function_on
|
||||
@@ -255,7 +255,7 @@ class Actions(object):
|
||||
self.capture.start_recording()
|
||||
|
||||
def toggle_screen_mirror(self):
|
||||
if self.data.settings['other']['DEV_MODE_RESET']['value'] == 'off':
|
||||
if self.data.settings['system']['DEV_MODE_RESET']['value'] == 'off':
|
||||
if self.data.update_screen:
|
||||
self.data.update_screen = False
|
||||
subprocess.call(['sudo', 'systemctl', 'start', 'raspi2fb@1'])
|
||||
@@ -414,7 +414,7 @@ class Actions(object):
|
||||
self.capture.update_capture_settings()
|
||||
|
||||
def change_piCapture_input(self, setting_value):
|
||||
if self.data.settings['captur']['TYPE']['value'] == 'piCaptureSd1':
|
||||
if self.data.settings['capture']['TYPE']['value'] == 'piCaptureSd1':
|
||||
subprocess.call(['pivideo', '-s', setting_value])
|
||||
|
||||
def change_output_mode(self, setting_value):
|
||||
@@ -456,7 +456,7 @@ class Actions(object):
|
||||
self.data.update_setting_value('other','DEV_MODE_RESET', 'off')
|
||||
|
||||
def check_if_should_start_openframeworks(self):
|
||||
if self.data.settings['conjur']['VIDEO_BACKEND']['value'] == 'openframeworks':
|
||||
if self.data.settings['video']['VIDEO_BACKEND']['value'] != 'omxplayer':
|
||||
self.openframeworks_process = subprocess.Popen(['/home/pi/openFrameworks/apps/myApps/c_o_n_j_u_r/bin/c_o_n_j_u_r'])
|
||||
print('conjur pid is {}'.format(self.openframeworks_process.pid))
|
||||
|
||||
@@ -472,10 +472,11 @@ class Actions(object):
|
||||
self.video_driver.osc_client.send_message("/dev_mode", True)
|
||||
|
||||
def switch_video_backend(self, state):
|
||||
if state == 'openframeworks':
|
||||
self.check_if_should_start_openframeworks()
|
||||
if state == 'ofvideoplayer' or state == 'ofxomxplayer':
|
||||
self.switch_conjur_player_type(state)
|
||||
elif state == 'omxplayer':
|
||||
self.exit_openframeworks()
|
||||
self.set_capture_object('nothing')
|
||||
self.reset_players()
|
||||
|
||||
def reset_players(self):
|
||||
@@ -581,10 +582,10 @@ class Actions(object):
|
||||
self.shaders.focused_param = 0
|
||||
|
||||
def increase_this_param(self):
|
||||
self.shaders.increase_this_param(self.data.settings['conjur']['SHADER_PARAM']['value'])
|
||||
self.shaders.increase_this_param(self.data.settings['shader']['SHADER_PARAM']['value'])
|
||||
|
||||
def decrease_this_param(self):
|
||||
self.shaders.decrease_this_param(self.data.settings['conjur']['SHADER_PARAM']['value'])
|
||||
self.shaders.decrease_this_param(self.data.settings['shader']['SHADER_PARAM']['value'])
|
||||
|
||||
def increase_param_focus(self):
|
||||
self.shaders.focused_param = (self.shaders.focused_param + 1)%self.shaders.selected_shader['param_number']
|
||||
@@ -593,16 +594,16 @@ class Actions(object):
|
||||
self.shaders.focused_param = (self.shaders.focused_param - 1)%self.shaders.selected_shader['param_number']
|
||||
|
||||
def increase_shader_param(self):
|
||||
options = self.data.settings['conjur']['SHADER_PARAM']['options']
|
||||
current_index = [index for index, item in enumerate(options) if item == self.data.settings['conjur']['SHADER_PARAM']['value'] ][0]
|
||||
self.data.settings['conjur']['SHADER_PARAM']['value'] = options[(current_index + 1) % len(options) ]
|
||||
self.message_handler.set_message('INFO', 'The Param amountis now ' + str(self.data.settings['conjur']['SHADER_PARAM']['value']))
|
||||
options = self.data.settings['shader']['SHADER_PARAM']['options']
|
||||
current_index = [index for index, item in enumerate(options) if item == self.data.settings['shader']['SHADER_PARAM']['value'] ][0]
|
||||
self.data.settings['shader']['SHADER_PARAM']['value'] = options[(current_index + 1) % len(options) ]
|
||||
self.message_handler.set_message('INFO', 'The Param amountis now ' + str(self.data.settings['shader']['SHADER_PARAM']['value']))
|
||||
|
||||
def decrease_shader_param(self):
|
||||
options = self.data.settings['conjur']['SHADER_PARAM']['options']
|
||||
current_index = [index for index, item in enumerate(options) if item == self.data.settings['conjur']['SHADER_PARAM']['value'] ][0]
|
||||
self.data.settings['conjur']['SHADER_PARAM']['value'] = options[(current_index - 1) % len(options) ]
|
||||
self.message_handler.set_message('INFO', 'The Param amountis now ' + str(self.data.settings['conjur']['SHADER_PARAM']['value']))
|
||||
options = self.data.settings['shader']['SHADER_PARAM']['options']
|
||||
current_index = [index for index, item in enumerate(options) if item == self.data.settings['shader']['SHADER_PARAM']['value'] ][0]
|
||||
self.data.settings['shader']['SHADER_PARAM']['value'] = options[(current_index - 1) % len(options) ]
|
||||
self.message_handler.set_message('INFO', 'The Param amountis now ' + str(self.data.settings['shader']['SHADER_PARAM']['value']))
|
||||
|
||||
|
||||
def set_fixed_length(self, value):
|
||||
|
||||
@@ -189,10 +189,10 @@ class Data(object):
|
||||
return context
|
||||
|
||||
def _overwrite_values_with_sampler_settings(self, start, end, length):
|
||||
use_rand_start = self.settings['recur']['RAND_START_MODE']['value'] == 'on'
|
||||
use_fixed_length = self.settings['recur']['FIXED_LENGTH_MODE']['value'] == 'on'
|
||||
fixed_length_value = self.settings['recur']['FIXED_LENGTH']['value']
|
||||
fixed_length_multiply = self.settings['recur']['FIXED_LENGTH_MULTIPLY']['value']
|
||||
use_rand_start = self.settings['sampler']['RAND_START_MODE']['value'] == 'on'
|
||||
use_fixed_length = self.settings['sampler']['FIXED_LENGTH_MODE']['value'] == 'on'
|
||||
fixed_length_value = self.settings['sampler']['FIXED_LENGTH']['value']
|
||||
fixed_length_multiply = self.settings['sampler']['FIXED_LENGTH_MULTIPLY']['value']
|
||||
total_fixed_length = fixed_length_value * fixed_length_multiply
|
||||
if start == -1:
|
||||
start = 0
|
||||
@@ -216,7 +216,7 @@ class Data(object):
|
||||
return new_start, new_end
|
||||
|
||||
def _update_next_bankslot_value(self, slot_num, is_current=False):
|
||||
next_setting = self.settings['recur']['LOAD_NEXT']['value']
|
||||
next_setting = self.settings['sampler']['LOAD_NEXT']['value']
|
||||
loaded_slots = self._get_list_of_loaded_slots_in_current_bank()
|
||||
if loaded_slots:
|
||||
if next_setting == 'random':
|
||||
|
||||
@@ -146,6 +146,7 @@ class Display(object):
|
||||
self._highlight_this_row(self.settings_menu.selected_list_index - self.settings_menu.top_menu_index)
|
||||
|
||||
def _load_shaders(self):
|
||||
self.TITLE = '================== c_o_n_j_u_r ================'
|
||||
line_count = 0
|
||||
self.display_text.insert(END, '------------------ <SHADERS> ------------------ \n')
|
||||
self.display_text.tag_add("DISPLAY_MODE", 4.19, 4.28)
|
||||
@@ -179,8 +180,9 @@ class Display(object):
|
||||
|
||||
|
||||
def _load_detour(self):
|
||||
self.TITLE = '================== d_e_t_o_u_r ================'
|
||||
line_count = 0
|
||||
self.display_text.insert(END, '------------------ <DETOUR> ------------------- \n')
|
||||
self.display_text.insert(END, '------------------ <FRAME-SAMPLER> ------------ \n')
|
||||
self.display_text.tag_add("DISPLAY_MODE", 4.19, 4.28)
|
||||
|
||||
## showing current detour info:
|
||||
|
||||
@@ -115,14 +115,14 @@ class BrowserMenu(Menu):
|
||||
|
||||
class SettingsMenu(Menu):
|
||||
|
||||
FOLDER_ORDER = ['video', 'recur', 'incur', 'captur', 'conjur', 'detour', 'other' ]
|
||||
RECUR_ORDER = ['LOAD_NEXT', 'RAND_START_MODE', 'FIXED_LENGTH_MODE', 'FIXED_LENGTH' ]
|
||||
FOLDER_ORDER = ['video', 'sampler', 'user_input', 'capture', 'shader', 'detour', 'system' ]
|
||||
SAMPLER_ORDER = ['LOAD_NEXT', 'RAND_START_MODE', 'FIXED_LENGTH_MODE', 'FIXED_LENGTH' ]
|
||||
VIDEO_ORDER = ['OUTPUT', 'SCREEN_MODE']
|
||||
INCUR_ORDER = ['MIDI_INPUT', 'MIDI_STATUS', 'CYCLE_MIDI_PORT']
|
||||
CAPTUR_ORDER = ['DEVICE']
|
||||
CONJUR_ORDER = ['VIDEO_BACKEND']
|
||||
USER_INPUT_ORDER = ['MIDI_INPUT', 'MIDI_STATUS', 'CYCLE_MIDI_PORT']
|
||||
CAPTURE_ORDER = ['DEVICE']
|
||||
SHADER_ORDER = []
|
||||
DETOUR_ORDER = []
|
||||
OTHER_ORDER = []
|
||||
SYSTEM_ORDER = []
|
||||
|
||||
def __init__(self, data, message_handler, menu_height):
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"captur": {
|
||||
"capture": {
|
||||
"TYPE": {
|
||||
"action": "update_capture_settings",
|
||||
"options": [
|
||||
@@ -68,17 +68,9 @@
|
||||
"max"
|
||||
],
|
||||
"value": "auto"
|
||||
},
|
||||
"USE_OF_CAPTURE": {
|
||||
"action": "set_capture_object",
|
||||
"options": [
|
||||
"yes",
|
||||
"no"
|
||||
],
|
||||
"value": "yes"
|
||||
}
|
||||
},
|
||||
"incur": {
|
||||
"user_inputs": {
|
||||
"MIDI_CHANNEL": {
|
||||
"action": null,
|
||||
"options": [
|
||||
@@ -129,7 +121,7 @@
|
||||
"value": "disabled"
|
||||
}
|
||||
},
|
||||
"other": {
|
||||
"system": {
|
||||
"UPDATE_CODE": {
|
||||
"action": "try_pull_code_and_reset",
|
||||
"options": [],
|
||||
@@ -169,14 +161,14 @@
|
||||
"value": null
|
||||
}
|
||||
},
|
||||
"conjur": {
|
||||
"VIDEO_BACKEND": {
|
||||
"action": "switch_video_backend",
|
||||
"shader": {
|
||||
"USE_SHADER": {
|
||||
"action": "update_capture_settings",
|
||||
"options": [
|
||||
"omxplayer",
|
||||
"openframeworks"
|
||||
"enabled",
|
||||
"disabled"
|
||||
],
|
||||
"value": "openframeworks"
|
||||
"value": "enabled"
|
||||
},
|
||||
"SHADER_PARAM": {
|
||||
"action": null,
|
||||
@@ -191,11 +183,6 @@
|
||||
0.4
|
||||
],
|
||||
"value": 0.10
|
||||
},
|
||||
"RESTART_OPENFRAMEWORKS": {
|
||||
"action": "restart_openframeworks",
|
||||
"options": [],
|
||||
"value": null
|
||||
}
|
||||
},
|
||||
"detour": {
|
||||
@@ -216,7 +203,7 @@
|
||||
"value": "output"
|
||||
}
|
||||
},
|
||||
"recur": {
|
||||
"sampler": {
|
||||
"ACTION_GATED": {
|
||||
"action": null,
|
||||
"options": [
|
||||
@@ -350,6 +337,15 @@
|
||||
],
|
||||
"value": "black"
|
||||
},
|
||||
"VIDEO_BACKEND": {
|
||||
"action": "switch_video_backend",
|
||||
"options": [
|
||||
"omxplayer",
|
||||
"ofvideoplayer",
|
||||
"ofxomxplayer"
|
||||
],
|
||||
"value": "ofvideoplayer"
|
||||
},
|
||||
"HDMI_MODE": {
|
||||
"action": "change_hdmi_settings",
|
||||
"options": [
|
||||
|
||||
@@ -16,7 +16,7 @@ class AnalogInput(object):
|
||||
|
||||
|
||||
def check_if_listening_enabled(self):
|
||||
if self.data.settings['incur']['ANALOG_INPUT']['value'] == 'enabled':
|
||||
if self.data.settings['user_input']['ANALOG_INPUT']['value'] == 'enabled':
|
||||
if not self.analog_input:
|
||||
try:
|
||||
## note - using software spi for now although on the same pins as the hardware spi described below because hardware spi wasnt working with lcd display
|
||||
@@ -36,7 +36,7 @@ class AnalogInput(object):
|
||||
self.root.after(1000, self.check_if_listening_enabled)
|
||||
|
||||
def poll_analog_inputs(self):
|
||||
if self.data.settings['incur']['ANALOG_INPUT']['value'] == 'enabled':
|
||||
if self.data.settings['user_input']['ANALOG_INPUT']['value'] == 'enabled':
|
||||
|
||||
for i in range(0,8):
|
||||
if str(i) in self.analog_mappings:
|
||||
|
||||
@@ -19,7 +19,7 @@ class MidiInput(object):
|
||||
|
||||
def try_open_port(self):
|
||||
#self.data.midi_status = 'disconnected'
|
||||
self.midi_setting = self.data.settings['incur']['MIDI_INPUT']['value']
|
||||
self.midi_setting = self.data.settings['user_input']['MIDI_INPUT']['value']
|
||||
self.port_index = self.data.midi_port_index
|
||||
#print('try open port : midi setting is {}'.format(midi_setting))
|
||||
if self.midi_setting == 'usb':
|
||||
@@ -52,7 +52,7 @@ class MidiInput(object):
|
||||
for message in self.midi_device.iter_pending():
|
||||
i = i + 1
|
||||
message_dict = message.dict()
|
||||
midi_channel = midi_setting = self.data.settings['incur']['MIDI_CHANNEL']['value'] - 1
|
||||
midi_channel = midi_setting = self.data.settings['user_input']['MIDI_CHANNEL']['value'] - 1
|
||||
|
||||
if not message_dict.get('channel', None) == midi_channel:
|
||||
pass
|
||||
@@ -82,7 +82,7 @@ class MidiInput(object):
|
||||
if i > 0:
|
||||
pass
|
||||
#print('the number processed {}'.format(i))
|
||||
if self.data.settings['incur']['MIDI_INPUT']['value'] == self.midi_setting and self.data.midi_port_index == self.port_index:
|
||||
if self.data.settings['user_input']['MIDI_INPUT']['value'] == self.midi_setting and self.data.midi_port_index == self.port_index:
|
||||
self.root.after(self.midi_delay, self.poll_midi_input)
|
||||
else:
|
||||
self.data.midi_status = 'disconnected'
|
||||
|
||||
@@ -44,7 +44,7 @@ class NumpadInput(object):
|
||||
if self.data.function_on and len(this_mapping[mode]) > 1:
|
||||
print('the action being called is {}'.format(this_mapping[mode][1]))
|
||||
getattr(self.actions, this_mapping[mode][1])()
|
||||
if self.data.settings['recur']['FUNC_GATED']['value'] == 'off':
|
||||
if self.data.settings['sampler']['FUNC_GATED']['value'] == 'off':
|
||||
self.data.function_on = False
|
||||
else:
|
||||
print('the action being called is {}'.format(this_mapping[mode][0]))
|
||||
@@ -57,12 +57,12 @@ class NumpadInput(object):
|
||||
def check_key_release_settings(self, key):
|
||||
|
||||
this_mapping = self.key_mappings[key]
|
||||
if self.data.settings['recur']['ACTION_GATED']['value'] == 'on':
|
||||
if self.data.settings['sampler']['ACTION_GATED']['value'] == 'on':
|
||||
if self.data.control_mode == 'PLAYER' and 'PLAYER' in this_mapping:
|
||||
if this_mapping['PLAYER'][0] == 'toggle_action_on_player' and not self.data.function_on:
|
||||
print('released action key')
|
||||
self.run_action_for_mapped_key(key)
|
||||
if self.data.settings['recur']['FUNC_GATED']['value'] == 'on':
|
||||
if self.data.settings['sampler']['FUNC_GATED']['value'] == 'on':
|
||||
if 'DEFAULT' in this_mapping:
|
||||
if this_mapping['DEFAULT'][0] == 'toggle_function':
|
||||
self.run_action_for_mapped_key(key)
|
||||
|
||||
@@ -51,7 +51,7 @@ class AltVideoPlayer:
|
||||
self.start = 0
|
||||
self.client.send_message("/player/{}/load".format(self.name[0]), [self.location, self.start / self.total_length, self.end / self.total_length, self.rate])
|
||||
self.crop_length = self.end - self.start
|
||||
if 'show' in self.data.settings['recur']['ON_LOAD']['value']:
|
||||
if 'show' in self.data.settings['sampler']['ON_LOAD']['value']:
|
||||
self.set_alpha_value(255)
|
||||
else:
|
||||
pass
|
||||
@@ -63,12 +63,12 @@ class AltVideoPlayer:
|
||||
#return False
|
||||
|
||||
def start_video(self):
|
||||
if 'play' in self.data.settings['recur']['ON_START']['value']:
|
||||
if 'play' in self.data.settings['sampler']['ON_START']['value']:
|
||||
self.status = 'PLAYING'
|
||||
self.client.send_message("/player/{}/play".format(self.name[0]), True)
|
||||
else:
|
||||
self.status = 'START'
|
||||
if 'show' in self.data.settings['recur']['ON_START']['value']:
|
||||
if 'show' in self.data.settings['sampler']['ON_START']['value']:
|
||||
self.set_alpha_value(255)
|
||||
else:
|
||||
self.set_alpha_value(0)
|
||||
@@ -159,7 +159,7 @@ class AltVideoPlayer:
|
||||
|
||||
## not sure if i am going to implement this atm
|
||||
def set_screen_size_for_dev_mode(self):
|
||||
if self.data.settings['other']['DEV_MODE_RESET']['value'] == 'on':
|
||||
if self.data.settings['system']['DEV_MODE_RESET']['value'] == 'on':
|
||||
##self.client.send_message("/player/{}/alpha".format(self.name[0]), amount)
|
||||
return True, '--win', '50,350,550,750'
|
||||
else:
|
||||
|
||||
@@ -33,7 +33,7 @@ class Capture(object):
|
||||
return True
|
||||
except picamera.exc.PiCameraError as e:
|
||||
self.use_capture = False
|
||||
self.data.settings['captur']['DEVICE']['value'] = 'disabled'
|
||||
self.data.settings['capture']['DEVICE']['value'] = 'disabled'
|
||||
print('camera exception is {}'.format(e))
|
||||
self.message_handler.set_message('INFO', 'no capture device attached')
|
||||
return False
|
||||
@@ -41,7 +41,7 @@ class Capture(object):
|
||||
def piCapture_with_no_source(self):
|
||||
is_piCapture = subprocess.check_output(['pivideo', '--query', 'ready'])
|
||||
if 'Video Processor was not found' not in str(is_piCapture):
|
||||
self.data.settings['captur']['TYPE']['value'] = "piCaptureSd1"
|
||||
self.data.settings['capture']['TYPE']['value'] = "piCaptureSd1"
|
||||
is_source = subprocess.check_output(['pivideo', '--query', 'lock'])
|
||||
if 'No active video detected' in str(is_source):
|
||||
self.message_handler.set_message('INFO', 'piCapture detected w no input source')
|
||||
@@ -50,18 +50,18 @@ class Capture(object):
|
||||
|
||||
def update_capture_settings(self):
|
||||
##setting class variables
|
||||
self.use_capture = self.data.settings['captur']['DEVICE']['value'] == 'enabled'
|
||||
self.resolution = self.convert_resolution_value(self.data.settings['captur']['RESOLUTION']['value'])
|
||||
self.framerate = self.convert_framerate_value(self.data.settings['captur']['FRAMERATE']['value'])
|
||||
self.capture_type = self.data.settings['captur']['TYPE']['value']
|
||||
self.use_capture = self.data.settings['capture']['DEVICE']['value'] == 'enabled'
|
||||
self.resolution = self.convert_resolution_value(self.data.settings['capture']['RESOLUTION']['value'])
|
||||
self.framerate = self.convert_framerate_value(self.data.settings['capture']['FRAMERATE']['value'])
|
||||
self.capture_type = self.data.settings['capture']['TYPE']['value']
|
||||
if self.capture_type == "piCaptureSd1":
|
||||
self.sensor_mode = 6
|
||||
else:
|
||||
self.sensor_mode = 0
|
||||
##update current instance (device) if in use
|
||||
if self.device and not self.device.closed:
|
||||
self.device.image_effect = self.data.settings['captur']['IMAGE_EFFECT']['value']
|
||||
self.device.shutter_speed = self.convert_shutter_value(self.data.settings['captur']['SHUTTER']['value'])
|
||||
self.device.image_effect = self.data.settings['capture']['IMAGE_EFFECT']['value']
|
||||
self.device.shutter_speed = self.convert_shutter_value(self.data.settings['capture']['SHUTTER']['value'])
|
||||
## can only update resolution and framerate if not recording
|
||||
if not self.is_recording:
|
||||
self.device.framerate = self.framerate
|
||||
@@ -95,7 +95,7 @@ class Capture(object):
|
||||
|
||||
|
||||
def set_preview_screen_size(self):
|
||||
if self.data.settings['other']['DEV_MODE_RESET']['value'] == 'on':
|
||||
if self.data.settings['system']['DEV_MODE_RESET']['value'] == 'on':
|
||||
self.device.preview.fullscreen = False
|
||||
self.device.preview.window = (50, 350, 500, 400)
|
||||
else:
|
||||
|
||||
@@ -39,7 +39,7 @@ class OfCapture(object):
|
||||
def piCapture_with_no_source(self):
|
||||
is_piCapture = subprocess.check_output(['pivideo', '--query', 'ready'])
|
||||
if 'Video Processor was not found' not in str(is_piCapture):
|
||||
self.data.settings['captur']['TYPE']['value'] = "piCaptureSd1"
|
||||
self.data.settings['capture']['TYPE']['value'] = "piCaptureSd1"
|
||||
is_source = subprocess.check_output(['pivideo', '--query', 'lock'])
|
||||
if 'No active video detected' in str(is_source):
|
||||
self.message_handler.set_message('INFO', 'piCapture detected w no input source')
|
||||
@@ -48,10 +48,10 @@ class OfCapture(object):
|
||||
|
||||
def update_capture_settings(self):
|
||||
##setting class variables
|
||||
self.use_capture = self.data.settings['captur']['DEVICE']['value'] == 'enabled'
|
||||
self.resolution = self.convert_resolution_value(self.data.settings['captur']['RESOLUTION']['value'])
|
||||
self.framerate = self.convert_framerate_value(self.data.settings['captur']['FRAMERATE']['value'])
|
||||
self.capture_type = self.data.settings['captur']['TYPE']['value']
|
||||
self.use_capture = self.data.settings['capture']['DEVICE']['value'] == 'enabled'
|
||||
self.resolution = self.convert_resolution_value(self.data.settings['capture']['RESOLUTION']['value'])
|
||||
self.framerate = self.convert_framerate_value(self.data.settings['capture']['FRAMERATE']['value'])
|
||||
self.capture_type = self.data.settings['capture']['TYPE']['value']
|
||||
if self.capture_type == "piCaptureSd1":
|
||||
self.sensor_mode = 6
|
||||
else:
|
||||
@@ -65,7 +65,7 @@ class OfCapture(object):
|
||||
return True
|
||||
except picamera.exc.PiCameraError as e:
|
||||
self.use_capture = False
|
||||
self.data.settings['captur']['DEVICE']['value'] = 'disabled'
|
||||
self.data.settings['capture']['DEVICE']['value'] = 'disabled'
|
||||
print('camera exception is {}'.format(e))
|
||||
self.message_handler.set_message('INFO', 'no capture device attached')
|
||||
return False
|
||||
|
||||
@@ -34,8 +34,8 @@ class VideoDriver(object):
|
||||
|
||||
|
||||
def update_video_settings(self):
|
||||
self.switch_on_finish = self.data.settings['recur']['ON_FINISH']['value'] == 'switch'
|
||||
self.loop_parallel = self.data.settings['recur']['LOOP_TYPE']['value'] == 'parallel'
|
||||
self.switch_on_finish = self.data.settings['sampler']['ON_FINISH']['value'] == 'switch'
|
||||
self.loop_parallel = self.data.settings['sampler']['LOOP_TYPE']['value'] == 'parallel'
|
||||
|
||||
def get_next_layer_value(self):
|
||||
if self.layer > 0:
|
||||
@@ -135,8 +135,8 @@ class VideoDriver(object):
|
||||
|
||||
def reset_all_players(self):
|
||||
self.exit_all_players()
|
||||
|
||||
if(self.data.settings['conjur']['VIDEO_BACKEND']['value'] == 'openframeworks'):
|
||||
state = self.data.settings['video']['VIDEO_BACKEND']['value']
|
||||
if(state == 'ofvideoplayer' or state == 'ofxomxplayer'):
|
||||
self.last_player = AltVideoPlayer(self.root, self.message_handler, self.data, self.osc_client, 'a.a')
|
||||
self.current_player = AltVideoPlayer(self.root,self.message_handler, self.data, self.osc_client, 'b.b')
|
||||
self.next_player = AltVideoPlayer(self.root, self.message_handler, self.data, self.osc_client, 'c.c')
|
||||
|
||||
@@ -58,7 +58,7 @@ class VideoPlayer:
|
||||
print('{}: the duration is {}'.format(self.name, self.total_length))
|
||||
if self.start > 0.9:
|
||||
self.set_position(self.start - 0.9)
|
||||
if 'show' in self.data.settings['recur']['ON_LOAD']['value']:
|
||||
if 'show' in self.data.settings['sampler']['ON_LOAD']['value']:
|
||||
self.set_alpha_value(255)
|
||||
else:
|
||||
self.set_alpha_value(0)
|
||||
@@ -80,11 +80,11 @@ class VideoPlayer:
|
||||
self.root.after(5, self.pause_at_start)
|
||||
|
||||
def start_video(self):
|
||||
if 'show' in self.data.settings['recur']['ON_START']['value']:
|
||||
if 'show' in self.data.settings['sampler']['ON_START']['value']:
|
||||
self.set_alpha_value(255)
|
||||
else:
|
||||
self.set_alpha_value(0)
|
||||
if 'play' in self.data.settings['recur']['ON_START']['value']:
|
||||
if 'play' in self.data.settings['sampler']['ON_START']['value']:
|
||||
self.status = 'PLAYING'
|
||||
self.omx_player.play()
|
||||
else:
|
||||
@@ -180,7 +180,7 @@ class VideoPlayer:
|
||||
|
||||
def set_screen_size_for_dev_mode(self):
|
||||
## only dev mode is needed now that auto handles all modes... can be removed probably ...
|
||||
if self.data.settings['other']['DEV_MODE_RESET']['value'] == 'on':
|
||||
if self.data.settings['system']['DEV_MODE_RESET']['value'] == 'on':
|
||||
return True, '--win', '50,350,550,750'
|
||||
else:
|
||||
aspect_mode = self.data.settings['video']['SCREEN_MODE']['value']
|
||||
|
||||
Reference in New Issue
Block a user