feat: Add playlist management functionality and compliance checks
- Introduced a new "Playlists" column in results view with visual indicators for membership. - Added `playlist_api.py` to handle playlist-related operations (fetch, add, remove tracks). - Implemented `PlaylistManagerDialog` for seamless playlist addition/removal with caching. - Integrated compliance check script (`check_agents_compliance.py`) for ensuring coding standards. - Added extensive documentation (`playlist_membership_manager.md`) covering architecture and flow. - Updated GUI logic and QStandardItemModel setup to include playlist data. - Included unit tests for playlist management components and API.
This commit is contained in:
@@ -47,6 +47,30 @@ class QtHandler(logging.Handler):
|
||||
XStream.stdout().write("%s\n" % record)
|
||||
|
||||
|
||||
# --- Verbosity control -------------------------------------------------------
|
||||
# If False: DEBUG and WARNING messages are suppressed (INFO/ERROR/CRITICAL shown).
|
||||
# If True: DEBUG and WARNING messages are shown.
|
||||
_VERBOSE_DEBUG = False
|
||||
|
||||
|
||||
class DebugWarningFilter(logging.Filter):
|
||||
def filter(self, record: logging.LogRecord) -> bool:
|
||||
# Always allow INFO (and above except WARNING handled below)
|
||||
# Suppress DEBUG and WARNING when _VERBOSE_DEBUG is False
|
||||
if not _VERBOSE_DEBUG and record.levelno in (logging.DEBUG, logging.WARNING):
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def enable_debug_and_warnings(enabled: bool = True):
|
||||
"""Enable/disable showing DEBUG and WARNING log records globally.
|
||||
|
||||
INFO/ERROR/CRITICAL are unaffected and always shown.
|
||||
"""
|
||||
global _VERBOSE_DEBUG
|
||||
_VERBOSE_DEBUG = bool(enabled)
|
||||
|
||||
|
||||
logger_gui = logging.getLogger(__name__)
|
||||
handler_qt: QtHandler = QtHandler()
|
||||
# log_fmt: str = "[%(asctime)s] %(levelname)s: %(message)s"
|
||||
@@ -57,6 +81,8 @@ level_styles = coloredlogs.DEFAULT_LEVEL_STYLES.copy()
|
||||
level_styles["info"] = {"color": "green"}
|
||||
formatter = coloredlogs.ColoredFormatter(fmt=log_fmt, level_styles=level_styles)
|
||||
handler_qt.setFormatter(formatter)
|
||||
# Apply filter to control DEBUG/WARNING visibility
|
||||
handler_qt.addFilter(DebugWarningFilter())
|
||||
logger_gui.addHandler(handler_qt)
|
||||
logger_gui.setLevel(logging.DEBUG)
|
||||
|
||||
@@ -64,5 +90,7 @@ logger_cli = logging.getLogger(__name__)
|
||||
handler_stream: logging.StreamHandler = logging.StreamHandler()
|
||||
formatter = coloredlogs.ColoredFormatter(fmt=log_fmt, level_styles=level_styles)
|
||||
handler_stream.setFormatter(formatter)
|
||||
# Apply filter to control DEBUG/WARNING visibility
|
||||
handler_stream.addFilter(DebugWarningFilter())
|
||||
logger_cli.addHandler(handler_stream)
|
||||
logger_cli.setLevel(logging.DEBUG)
|
||||
|
||||
Reference in New Issue
Block a user