diff --git a/discover_overlay/discord_connector.py b/discover_overlay/discord_connector.py index b2b01b4..f2acf97 100644 --- a/discover_overlay/discord_connector.py +++ b/discover_overlay/discord_connector.py @@ -275,7 +275,8 @@ class DiscordConnector: deaf = j["data"]["voice_state"]["deaf"] or j["data"]["voice_state"]["self_deaf"] thisuser["mute"] = mute thisuser["deaf"] = deaf - self.update_user(thisuser) + if self.current_voice!="0": + self.update_user(thisuser) self.set_in_room(thisuser["id"], True) elif j["evt"] == "VOICE_STATE_CREATE": self.list_altered = True @@ -375,7 +376,7 @@ class DiscordConnector: if 'data' in j and j['data'] and 'id' in j['data']: self.set_channel(j['data']['id']) self.list_altered = True - + self.in_room=[] for u in j['data']['voice_states']: thisuser = u["user"] nick = u["nick"] diff --git a/discover_overlay/discover_overlay.py b/discover_overlay/discover_overlay.py index d839bea..96b399e 100755 --- a/discover_overlay/discover_overlay.py +++ b/discover_overlay/discover_overlay.py @@ -40,8 +40,6 @@ try: except ModuleNotFoundError: from xdg import XDG_CONFIG_HOME as xdg_config_home -log = logging.getLogger(__name__) - class Discover: """Main application class""" @@ -337,9 +335,14 @@ def entrypoint(): pid_file = os.path.join(config_dir, "discover_overlay.pid") rpc_file = os.path.join(config_dir, "discover_overlay.rpc") debug_file = os.path.join(config_dir, "output.txt") - if "--debug" in line or "-v" in line: - logging.getLogger().setLevel(0) - logging.basicConfig(filename=debug_file) + logging.getLogger().setLevel(logging.WARNING) + FORMAT = "%(levelname)s - %(name)s - %(message)s" + if "--debug" in sys.argv or "-v" in sys.argv: + logging.getLogger().setLevel(logging.DEBUG) + logging.basicConfig(filename=debug_file, format=FORMAT) + else: + logging.basicConfig(format=FORMAT) + log = logging.getLogger(__name__) # Flatpak compat mode try: @@ -349,7 +352,6 @@ def entrypoint(): tfile.write(line) log.warning("Sent RPC command") else: - logging.getLogger().setLevel(logging.INFO) log.info("Flatpak compat mode started") Discover(rpc_file, debug_file, line) return @@ -358,7 +360,6 @@ def entrypoint(): try: with pidfile.PIDFile(pid_file): - logging.getLogger().setLevel(logging.INFO) Discover(rpc_file, debug_file, line) except pidfile.AlreadyRunningError: log.warning("Discover overlay is currently running") diff --git a/discover_overlay/notification_overlay.py b/discover_overlay/notification_overlay.py index b6fdbb2..89be284 100644 --- a/discover_overlay/notification_overlay.py +++ b/discover_overlay/notification_overlay.py @@ -25,6 +25,7 @@ gi.require_version('PangoCairo', '1.0') # pylint: disable=wrong-import-position,wrong-import-order from gi.repository import Gtk, Pango, PangoCairo # nopep8 +log = logging.getLogger(__name__) class NotificationOverlayWindow(OverlayWindow): """Overlay window for notifications""" @@ -451,7 +452,7 @@ class NotificationOverlayWindow(OverlayWindow): Draw an inline image as a custom emoticon """ if shape.data >= len(self.image_list): - logging.warning(f"{shape.data} >= {len(self.image_list)}") + log.warning(f"{shape.data} >= {len(self.image_list)}") return # key is the url to the image key = self.image_list[shape.data] diff --git a/discover_overlay/settings.py b/discover_overlay/settings.py index cc3e71e..ae8422d 100644 --- a/discover_overlay/settings.py +++ b/discover_overlay/settings.py @@ -96,8 +96,6 @@ class SettingsWindow(Gtk.VBox): for i in range(0, display.get_n_monitors()): if display.get_monitor(i).get_model() == name: return i - log.info( - "Could not find monitor : %s", name) return 0 def get_monitor_obj(self, name): @@ -109,8 +107,7 @@ class SettingsWindow(Gtk.VBox): for i in range(0, display.get_n_monitors()): if display.get_monitor(i).get_model() == name: return display.get_monitor(i) - log.info( - "Could not find monitor : %s", name) + return None def present_settings(self): diff --git a/discover_overlay/text_settings.py b/discover_overlay/text_settings.py index 8c3bfea..4ec290d 100644 --- a/discover_overlay/text_settings.py +++ b/discover_overlay/text_settings.py @@ -200,8 +200,6 @@ class TextSettingsWindow(SettingsWindow): return self.list_guilds = in_list self.list_guilds_keys = [] - log.warn("Guild list") - log.warn(in_list) for key in in_list.keys(): self.list_guilds_keys.append(key) self.list_guilds_keys.sort()