Skip to content

Commit

Permalink
refactor: cleaned up imports and some code formatting
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Arndt <[email protected]>
  • Loading branch information
SpotlightKid committed Apr 5, 2024
1 parent a5d87f9 commit 75b1bb5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 24 deletions.
26 changes: 15 additions & 11 deletions ewi_usb_config/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down
14 changes: 1 addition & 13 deletions ewi_usb_config/ewidata.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 75b1bb5

Please sign in to comment.