From 11694351048db08533f157c2003f7d3b88cdb507 Mon Sep 17 00:00:00 2001 From: onyx-and-iris <75868496+onyx-and-iris@users.noreply.github.com> Date: Wed, 28 Sep 2022 18:03:22 +0100 Subject: [PATCH] base renamed to vbancmd misc renamed to event info message fixed if no events subbed to now using logging module in Event class --- vban_cmd/{misc.py => event.py} | 16 +++++++++++----- vban_cmd/{base.py => vbancmd.py} | 6 +++--- 2 files changed, 14 insertions(+), 8 deletions(-) rename vban_cmd/{misc.py => event.py} (66%) rename vban_cmd/{base.py => vbancmd.py} (96%) diff --git a/vban_cmd/misc.py b/vban_cmd/event.py similarity index 66% rename from vban_cmd/misc.py rename to vban_cmd/event.py index f913157..5711905 100644 --- a/vban_cmd/misc.py +++ b/vban_cmd/event.py @@ -1,13 +1,19 @@ +import logging + + class Event: + logger = logging.getLogger("event.event") + def __init__(self, subs: dict): self.subs = subs def info(self, msg): - info = ( - f"{msg} events", - f"Now listening for {', '.join(self.get())} events", - ) - print("\n".join(info)) + info = (f"{msg} events",) + if self.any(): + info += (f"now listening for {', '.join(self.get())} events",) + else: + info += (f"not listening for any events",) + self.logger.info(", ".join(info)) @property def pdirty(self): diff --git a/vban_cmd/base.py b/vban_cmd/vbancmd.py similarity index 96% rename from vban_cmd/base.py rename to vban_cmd/vbancmd.py index bb32707..6c23310 100644 --- a/vban_cmd/base.py +++ b/vban_cmd/vbancmd.py @@ -3,7 +3,7 @@ import time from abc import ABCMeta, abstractmethod from typing import Iterable, Optional, Union -from .misc import Event +from .event import Event from .packet import RequestHeader from .subject import Subject from .util import Socket, comp, script @@ -122,8 +122,8 @@ class VbanCmd(metaclass=ABCMeta): strip levels in PREFADER mode. """ return ( - tuple(val for val in packet.inputlevels), - tuple(val for val in packet.outputlevels), + tuple(((1 << 16) - 1) - val for val in packet.inputlevels), + tuple(((1 << 16) - 1) - val for val in packet.outputlevels), ) def apply(self, data: dict):