Skip to content

Commit

Permalink
tweak logging, fix lock warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiko2k committed Dec 3, 2024
1 parent 04750af commit cea5f08
Showing 1 changed file with 31 additions and 28 deletions.
59 changes: 31 additions & 28 deletions src/tauon/t_modules/t_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11984,15 +11984,16 @@ def render(self, track: TrackClass, location, size=None, force_offset=None) -> b

if key not in self.queue:
self.queue.append(key)
try:
self.lock.release()
except RuntimeError as e:
if str(e) == "release unlocked lock":
logging.debug("RuntimeError: Attempted to release already unlocked lock")
else:
logging.exception("Unknown RuntimeError trying to release lock: {e}")
except Exception:
logging.exception("Unknown error trying to release lock")
if self.lock.locked():
try:
self.lock.release()
except RuntimeError as e:
if str(e) == "release unlocked lock":
logging.error("RuntimeError: Attempted to release already unlocked lock")
else:
logging.exception("Unknown RuntimeError trying to release lock: {e}")
except Exception:
logging.exception("Unknown error trying to release lock")

return False

Expand Down Expand Up @@ -12432,7 +12433,7 @@ def get_embed(self, track: TrackClass):
if frame:
pic = frame[0].data
except Exception:
logging.exception("Failed to get tags")
logging.debug(f"Failed to get tags on file: {filepath}")

if pic is not None and len(pic) < 30:
pic = None
Expand Down Expand Up @@ -25255,15 +25256,16 @@ def render(self):
ddt.rect((thl, yy + pad, album_art_size, album_art_size), [50, 50, 50, 150])
# gall_ren.render(pctl.get_track(item[2]), (50 * gui.scale, yy + 5), 50 * gui.scale)
if not item[5].draw(thumbnail_rx - album_art_size, yy + pad):
try:
gall_ren.lock.release()
except RuntimeError as e:
if str(e) == "release unlocked lock":
logging.error("RuntimeError: Attempted to release already unlocked gall_ren_lock")
else:
logging.exception("Unknown RuntimeError trying to release gall_ren_lock: {e}")
except Exception:
logging.exception("Unknown error trying to release gall_ren_lock")
if gall_ren.lock.locked():
try:
gall_ren.lock.release()
except RuntimeError as e:
if str(e) == "release unlocked lock":
logging.error("RuntimeError: Attempted to release already unlocked gall_ren_lock")
else:
logging.exception("Unknown RuntimeError trying to release gall_ren_lock: {e}")
except Exception:
logging.exception("Unknown error trying to release gall_ren_lock")

# Result text
if n in (0, 5, 6, 7, 8, 10): # Bold
Expand Down Expand Up @@ -44136,15 +44138,16 @@ def drop_file(target):
power += 1

if pctl.playerCommandReady:
try:
tm.player_lock.release()
except RuntimeError as e:
if str(e) == "release unlocked lock":
logging.debug("RuntimeError: Attempted to release already unlocked player_lock")
else:
logging.exception("Unknown RuntimeError trying to release player_lock: {e}")
except Exception:
logging.exception("Unknown exception trying to release player_lock")
if tm.player_lock.locked():
try:
tm.player_lock.release()
except RuntimeError as e:
if str(e) == "release unlocked lock":
logging.error("RuntimeError: Attempted to release already unlocked player_lock")
else:
logging.exception("Unknown RuntimeError trying to release player_lock: {e}")
except Exception:
logging.exception("Unknown exception trying to release player_lock")

if gui.frame_callback_list:
i = len(gui.frame_callback_list) - 1
Expand Down

0 comments on commit cea5f08

Please sign in to comment.