diff --git a/ewi_usb_config/cli.py b/ewi_usb_config/cli.py index d41c32f..612a778 100644 --- a/ewi_usb_config/cli.py +++ b/ewi_usb_config/cli.py @@ -38,11 +38,19 @@ from time import sleep, time from rtmidi import midiutil - -from .ewidata import * +from rtmidi.nidiconstants import ( + CONTROL_CHANGE, + DATA_ENTRY_LSB, + DATA_ENTRY_MSB, + END_OF_EXCLUSIVE, + NRPN_LSB, + NRPN_MSB, + SYSTEM_EXCLUSIVE, +) + +from .ewidata import MANUFACTURER_ID_AKAI, MODEL_ID_EWI_USB, MSG_ID_DUMP_REQUEST, NRPN from .version import version as __version__ - PROG = "ewi-usb-config" log = logging.getLogger(PROG) @@ -151,8 +159,8 @@ def send_system_exclusive(self, msg=""): """Send a MIDI system exclusive (SysEx) message.""" if ( msg - and msg.startswith(b"\xF0") - and msg.endswith(b"\xF7") + and msg.startswith(b"\xf0") + and msg.endswith(b"\xf7") and all((val <= 0x7F for val in msg[1:-1])) ): self._midiout.send_message(msg) @@ -286,9 +294,7 @@ def do_send_dump(args): akai.close() else: - log.error( - f"No supported SysEx message found in '{args.send}'. Nothing was sent." - ) + log.error(f"No supported SysEx message found in '{args.send}'. Nothing was sent.") def main(args=None): @@ -382,9 +388,7 @@ def main(args=None): if args.force: log.warning(f"Overwriting exiting file '{args.receive}'.") else: - log.error( - f"File '{args.receive}' exist. Use option -f to overwrite. Aborting." - ) + log.error(f"File '{args.receive}' exist. Use option -f to overwrite. Aborting.") return try: diff --git a/ewi_usb_config/ewidata.py b/ewi_usb_config/ewidata.py index d7bee12..365c8b2 100644 --- a/ewi_usb_config/ewidata.py +++ b/ewi_usb_config/ewidata.py @@ -1,18 +1,6 @@ import enum -from rtmidi.midiconstants import ( - BREATH_CONTROLLER, - CONTROL_CHANGE, - DATA_ENTRY_LSB, - DATA_ENTRY_MSB, - END_OF_EXCLUSIVE, - MODULATION, - NRPN_LSB, - NRPN_MSB, - PITCH_BEND, - SYSTEM_EXCLUSIVE, -) - +from rtmidi.midiconstants import BREATH_CONTROLLER, MODULATION MANUFACTURER_ID_AKAI = 0x47 MODEL_ID_EWI_USB = 0x6D