Remove dependency on cchardet
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Fri, 16 May 2025 23:05:02 +0000 (01:05 +0200)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Fri, 16 May 2025 23:05:02 +0000 (01:05 +0200)
music_assistant/helpers/util.py
pyproject.toml
requirements_all.txt

index 64d38117cbab4637858098d740631c0ca2de8914..8aa995d2b4ca436946e047cb59b44c94a6cd29f0 100644 (file)
@@ -22,7 +22,7 @@ from types import TracebackType
 from typing import TYPE_CHECKING, Any, ParamSpec, Self, TypeVar, cast
 from urllib.parse import urlparse
 
-import cchardet as chardet
+import chardet
 import ifaddr
 from zeroconf import IPVersion
 
@@ -32,6 +32,7 @@ from music_assistant.helpers.process import check_output
 if TYPE_CHECKING:
     from collections.abc import Iterator
 
+    from chardet.resultdict import ResultDict
     from zeroconf.asyncio import AsyncServiceInfo
 
     from music_assistant.mass import MusicAssistant
@@ -567,7 +568,7 @@ async def close_async_generator(agen: AsyncGenerator[Any, None]) -> None:
 async def detect_charset(data: bytes, fallback: str = "utf-8") -> str:
     """Detect charset of raw data."""
     try:
-        detected: dict[str, Any] = await asyncio.to_thread(chardet.detect, data)
+        detected: ResultDict = await asyncio.to_thread(chardet.detect, data)
         if detected and detected["encoding"] and detected["confidence"] > 0.75:
             assert isinstance(detected["encoding"], str)  # for type checking
             return detected["encoding"]
index 72696d08ea91d0b649dd8371a5f235fb020cf081..6a21994be2f2d4d259a3fece51a1ac315535958c 100644 (file)
@@ -20,7 +20,7 @@ dependencies = [
   "certifi==2025.4.26",
   "colorlog==6.9.0",
   "cryptography==44.0.3",
-  "faust-cchardet>=2.1.18",
+  "chardet>=5.2.0",
   "ifaddr==0.2.0",
   "mashumaro==3.15",
   "music-assistant-frontend==2.15.1",
index f1a473ca20405b0a53b68556baf4cd3fee6a6b74..1973448c934662dd0300f4efc07d3b7f76474cbf 100644 (file)
@@ -17,12 +17,12 @@ audible==0.10.0
 bgutil-ytdlp-pot-provider==0.8.3
 bidict==0.23.1
 certifi==2025.4.26
+chardet>=5.2.0
 colorlog==6.9.0
 cryptography==44.0.3
 deezer-python-async==0.3.0
 defusedxml==0.7.1
 duration-parser==1.0.1
-faust-cchardet>=2.1.18
 hass-client==1.2.0
 ibroadcastaio==0.4.0
 ifaddr==0.2.0