- Clear userlist between rooms

- Fixes for logger
- remove some unneeded logs
This commit is contained in:
trigg 2022-04-12 19:58:11 +00:00
parent f690fe5740
commit 77ec14b4d2
5 changed files with 14 additions and 16 deletions

View file

@ -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"]

View file

@ -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")

View file

@ -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]

View file

@ -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):

View file

@ -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()