Skip to content

Commit

Permalink
Fix initial path creation, reenable x42-at1
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <[email protected]>
  • Loading branch information
falkTX committed Jan 31, 2024
1 parent 74f0690 commit 7c96a4c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 26 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,7 @@ ifneq ($(PAWPAW_DEBUG),1)
PLUGINS += mod-pitchshifter
PLUGINS += modspectre
PLUGINS += pitchtracking-series
# needs fixing, cuts audio output
# PLUGINS += x42-fat1
PLUGINS += x42-fat1
PLUGINS += x42-tuna-lv2-labs
endif

Expand Down
2 changes: 1 addition & 1 deletion src/PawPaw
Submodule PawPaw updated 1 files
+0 −65 build-mod-plugin.sh
48 changes: 25 additions & 23 deletions utils/cxfreeze/mod-ui-setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

ROOT = os.path.abspath(os.path.dirname(sys.argv[0]))
DATA_DIR = os.getenv('MOD_DATA_DIR', os.path.join(ROOT, 'data'))
DEVICE_DIR = os.path.join(DATA_DIR, 'device')

sys.path = [ROOT] + sys.path

Expand All @@ -43,9 +44,9 @@
os.environ['MOD_USER_PEDALBOARDS_DIR'] = os.path.join(DATA_DIR, 'pedalboards')
os.environ['MOD_USER_PLUGINS_DIR'] = os.path.join(DATA_DIR, 'lv2')

def makedirs(dir: str):
def makedirs(path: str):
try:
os.makedirs(os.path.join(DATA_DIR, 'user-files', 'Audio Loops'), exist_ok=True)
os.makedirs(path, exist_ok=True)
except OSError:
pass

Expand All @@ -64,32 +65,33 @@ def makedirs(dir: str):
makedirs(os.path.join(DATA_DIR, 'user-files', 'NAM Models'))

# fake device setup
makedirs(os.path.join(DATA_DIR, 'device'))
makedirs(DEVICE_DIR)
#os.environ['MOD_API_KEY'] = os.path.join(resdir, '..', 'mod_api_key.pub')
os.environ['MOD_DEVICE_KEY'] = os.path.join(DATA_DIR, 'device', 'rsa')
os.environ['MOD_DEVICE_TAG'] = os.path.join(DATA_DIR, 'device', 'tag')
os.environ['MOD_DEVICE_UID'] = os.path.join(DATA_DIR, 'device', 'uid')
os.environ['MOD_DEVICE_KEY'] = os.path.join(DEVICE_DIR, 'rsa')
os.environ['MOD_DEVICE_TAG'] = os.path.join(DEVICE_DIR, 'tag')
os.environ['MOD_DEVICE_UID'] = os.path.join(DEVICE_DIR, 'uid')

from datetime import datetime
from random import randint

if not os.path.isfile(os.environ['MOD_DEVICE_TAG']):
with open(os.environ['MOD_DEVICE_TAG'], 'w') as fh:
tag = 'MDS-{0}-0-00-000-{1}'.format(datetime.utcnow().strftime('%Y%m%d'), randint(9000, 9999))
fh.write(tag)
if not os.path.isfile(os.environ['MOD_DEVICE_UID']):
with open(os.environ['MOD_DEVICE_UID'], 'w') as fh:
uid = ':'.join(['{0}{1}'.format(randint(0, 9), randint(0, 9)) for i in range(0, 16)])
fh.write(uid)
if not os.path.isfile(os.environ['MOD_DEVICE_KEY']):
try:
key = RSA.generate(2048)
with open(os.environ['MOD_DEVICE_KEY'], 'wb') as fh:
fh.write(key.exportKey('PEM'))
with open(os.environ['MOD_DEVICE_KEY'] + '.pub', 'wb') as fh:
fh.write(key.publickey().exportKey('PEM'))
except Exception as ex:
print('Can\'t create a device key: {0}'.format(ex))
if os.path.exists(DEVICE_DIR):
if not os.path.isfile(os.environ['MOD_DEVICE_TAG']):
with open(os.environ['MOD_DEVICE_TAG'], 'w') as fh:
tag = 'MDS-{0}-0-00-000-{1}'.format(datetime.utcnow().strftime('%Y%m%d'), randint(9000, 9999))
fh.write(tag)
if not os.path.isfile(os.environ['MOD_DEVICE_UID']):
with open(os.environ['MOD_DEVICE_UID'], 'w') as fh:
uid = ':'.join(['{0}{1}'.format(randint(0, 9), randint(0, 9)) for i in range(0, 16)])
fh.write(uid)
if not os.path.isfile(os.environ['MOD_DEVICE_KEY']):
try:
key = RSA.generate(2048)
with open(os.environ['MOD_DEVICE_KEY'], 'wb') as fh:
fh.write(key.exportKey('PEM'))
with open(os.environ['MOD_DEVICE_KEY'] + '.pub', 'wb') as fh:
fh.write(key.publickey().exportKey('PEM'))
except Exception as ex:
print('Can\'t create a device key: {0}'.format(ex))

# import webserver after setting up environment
from mod import webserver
Expand Down

0 comments on commit 7c96a4c

Please sign in to comment.