feat: add acoustic dedupe pipeline and docker runtime

This commit is contained in:
OpenClaw Agent
2026-09-18 04:51:21 +08:00
parent 6154cd0752
commit 8c658cfe76
12 changed files with 218 additions and 135 deletions
+15 -6
View File
@@ -1,24 +1,33 @@
from __future__ import annotations
import re
from pathlib import Path
from .constants import MUSIC_EXTENSIONS, VERSION_MARKERS
try:
from tinytag import TinyTag
except ImportError: # optional until metadata phase is invoked
except ImportError:
TinyTag = None
def read_metadata(path: Path) -> dict:
data = {"format": path.suffix.lower().lstrip(".")}
if TinyTag is None:
return {}
tag = TinyTag.get(str(path), image=False)
return {
return data
try:
tag = TinyTag.get(str(path), image=False)
except Exception:
return data
data.update({
"duration": tag.duration,
"artist": tag.artist,
"title": tag.title,
"album": tag.album,
"format": path.suffix.lower().lstrip("."),
"bitrate": int(tag.bitrate) if tag.bitrate else None,
"sample_rate": int(tag.samplerate) if tag.samplerate else None,
"bit_depth": int(tag.bitdepth) if tag.bitdepth else None,
}
})
text = " ".join(str(data.get(k) or "") for k in ("title", "album", "file_name"))
data["version_flags"] = [m for m in VERSION_MARKERS if re.search(rf"(?<!\w){re.escape(m)}(?!\w)", text, re.I)]
return data