mirror of
https://github.com/cyberboy666/r_e_c_u_r.git
synced 2025-12-15 21:00:10 +01:00
merge with dev
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import subprocess
|
||||
import json
|
||||
import xml.etree.ElementTree as ET
|
||||
import os
|
||||
@@ -91,6 +92,7 @@ class Data(object):
|
||||
|
||||
if os.path.isfile(self.PATH_TO_DATA_OBJECTS + self.SETTINGS_JSON):
|
||||
self.settings = self._read_json(self.SETTINGS_JSON)
|
||||
self.settings['user_input']['REMOTE_SERVER']['value'] = 'disabled' # remote server off at boot
|
||||
|
||||
self.key_mappings = self._read_json(self.KEYPAD_MAPPING_JSON)
|
||||
self.osc_mappings = self._read_json(self.OSC_MAPPING_JSON)
|
||||
@@ -120,6 +122,19 @@ class Data(object):
|
||||
self.midi_mappings = self._read_json(self.MIDI_MAPPING_JSON)
|
||||
return self.midi_mappings
|
||||
|
||||
def get_ip_address(self):
|
||||
ip_list = subprocess.check_output(['hostname', '-I']).decode('utf-8').split()
|
||||
if len(ip_list) > 0:
|
||||
return ip_list[0]
|
||||
else:
|
||||
return 'none'
|
||||
|
||||
def get_ip_for_osc_client(self):
|
||||
if self.settings['user_input']['REMOTE_SERVER']['value'] == 'enabled':
|
||||
return '127.0.0.1'
|
||||
else:
|
||||
return self.get_ip_address()
|
||||
|
||||
@staticmethod
|
||||
def create_empty_bank():
|
||||
empty_slot = dict(name='', location='', length=-1, start=-1, end=-1, rate=1)
|
||||
@@ -473,3 +488,5 @@ class Data(object):
|
||||
def try_remove_file(path):
|
||||
if os.path.exists(path):
|
||||
os.remove(path)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user