|
@ -1,4 +1,4 @@ |
|
|
#! /usr/bin/env python3 |
|
|
#/bin/env python3 |
|
|
# -*- coding: utf-8 -*- |
|
|
# -*- coding: utf-8 -*- |
|
|
""" |
|
|
""" |
|
|
Copyright 2021, Nils Hilbricht, Germany ( https://www.hilbricht.net ) |
|
|
Copyright 2021, Nils Hilbricht, Germany ( https://www.hilbricht.net ) |
|
@ -27,6 +27,7 @@ import os.path |
|
|
import json |
|
|
import json |
|
|
import atexit |
|
|
import atexit |
|
|
from sys import exit as sysexit |
|
|
from sys import exit as sysexit |
|
|
|
|
|
import base64 #for jack metadata icon |
|
|
|
|
|
|
|
|
#Third Party Modules |
|
|
#Third Party Modules |
|
|
from calfbox import cbox |
|
|
from calfbox import cbox |
|
@ -34,6 +35,7 @@ from calfbox import cbox |
|
|
#Our Template Modules |
|
|
#Our Template Modules |
|
|
from .history import History |
|
|
from .history import History |
|
|
from .duration import DB, DL, D1, D2, D4, D8, D16, D32, D64, D128, MAXIMUM_TICK_DURATION |
|
|
from .duration import DB, DL, D1, D2, D4, D8, D16, D32, D64, D128, MAXIMUM_TICK_DURATION |
|
|
|
|
|
from ..start import PATHS |
|
|
|
|
|
|
|
|
#User Data |
|
|
#User Data |
|
|
from engine.config import * |
|
|
from engine.config import * |
|
@ -114,6 +116,9 @@ class Session(object): |
|
|
logger.error("Will not load or save because: " + e.__repr__()) |
|
|
logger.error("Will not load or save because: " + e.__repr__()) |
|
|
if not self.data: |
|
|
if not self.data: |
|
|
self.data = Data(parentSession = self) |
|
|
self.data = Data(parentSession = self) |
|
|
|
|
|
|
|
|
|
|
|
self.sendJackMetadataIcon() |
|
|
|
|
|
|
|
|
logger.info("New/Open session complete") |
|
|
logger.info("New/Open session complete") |
|
|
|
|
|
|
|
|
def openFromJson(self, absoluteJsonFilePath): |
|
|
def openFromJson(self, absoluteJsonFilePath): |
|
@ -183,3 +188,27 @@ class Session(object): |
|
|
logger.info("@atexit: Calfbox Audio stopped ") |
|
|
logger.info("@atexit: Calfbox Audio stopped ") |
|
|
cbox.shutdown_engine() |
|
|
cbox.shutdown_engine() |
|
|
logger.info("@atexit: Calfbox Engine shutdown ") |
|
|
logger.info("@atexit: Calfbox Engine shutdown ") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def sendJackMetadataIcon(self): |
|
|
|
|
|
"""Convert our icon to base64 UTF-8 and send it to jack metadata. |
|
|
|
|
|
Actually, the icon is already encoded in our codebase so we don't have to locate the file |
|
|
|
|
|
on the users disk when installed |
|
|
|
|
|
|
|
|
|
|
|
Sent once at the end of self.nsm_openOrNewCallback |
|
|
|
|
|
""" |
|
|
|
|
|
#testData = "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAAAAABWESUoAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAAAgcAAAIHASw6dZwAAAAHdElNRQfkBBEHMwXdauI0AAABrElEQVQ4y4XTv0vbQRzG8fc3Jv5WqqUKRvjaaKE6pE5RBFHBdlIQSp3yB3QouDh0q05K0UUzuZQMLdh/wFKhKEIERR1EOwlVxGhaUyqRSox5HBI1F5N423Gv4z6fu+fgwaGsEXqaObsPTtx2QXDVT21B8IEq/hQA3x1NY4QygcMoOOx3fX3Ej7xdJPqYVRBf3iPGGZa2sLbzgKWiZ2fSZTn+3CDiLtmQpCGK1nOB5CAzkqRF8MZzgI8MJVOyAybug1WXHZUkxffmoexnNvhnu0KS9PddNQC+RBYYYVKSfnmsDv/rJ8CcCY5LfFeS/nvbdiVdjEJT0gDTLEjSVMVRamMPrBjgVWVCkpobWgd2JCkAIwZw90rSPkDjuaQ96DRe87cNEAY43AQaLQ5TK2lgxQBanIDVABTXEDWAOwLweNIBbz0AcZxGHt6UnkmStma+SZLC0GwU+YlZI3qfYdAAsZr600zQDQHzqqd4eX63HoSKsAkuu+m6jftaGbzPfu7j59ROpCr9Ug3tsTSwULqbyPAyTu8L18XSAdSt2ekLyshkIlB/07rnNtcPf/5rhItvET2iDPMAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjAtMDQtMTdUMDc6NTE6MDUrMDA6MDAudbalAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIwLTA0LTE3VDA3OjUxOjA1KzAwOjAwXygOGQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAAASUVORK5CYII=" |
|
|
|
|
|
|
|
|
|
|
|
logger.info("Sending program icons to jack metadata") |
|
|
|
|
|
|
|
|
|
|
|
icon_32_base64_utf8 = os.path.join(PATHS["share"], "icon_32_base64_utf8.txt") |
|
|
|
|
|
assert os.path.exists(icon_32_base64_utf8), icon_32_base64_utf8 |
|
|
|
|
|
with open(icon_32_base64_utf8, "r") as fSmall: |
|
|
|
|
|
cbox.JackIO.Metadata.set_icon_small(fSmall.read()) |
|
|
|
|
|
|
|
|
|
|
|
icon_128_base64_utf8 = os.path.join(PATHS["share"], "icon_128_base64_utf8.txt") |
|
|
|
|
|
assert os.path.exists(icon_128_base64_utf8), icon_128_base64_utf8 |
|
|
|
|
|
with open(icon_128_base64_utf8, "r") as fLarge: |
|
|
|
|
|
cbox.JackIO.Metadata.set_icon_large(fLarge.read()) |
|
|
|
|
|
|
|
|
|
|
|
cbox.JackIO.Metadata.set_icon_name(METADATA["shortName"]) |
|
|