v1.3.7: 기록 관리(경기 · 경기 전후 대화 묶음, 한 번에 지우기 · zip 내보내기/받아오기) · 검토로 찾은 오류 고침

- 기록 묶음 API · zip 형식(gvr-bundle v1) · 받아오기 검사(꼭 필요한 내용이 없으면 실패, 아무것도 넣지 않음)
- 사이트 기록 탭, 큰 zip 조각 중계
- 관리자 확인 %인코딩 우회, 큰 전송 중 연결 끊김, 진행 중 경기 지우기, 예전 녹음 고치기 덮어쓰기,
  타임라인 끼워 넣기, 숫자 반복 줄이기, TTS 반쪽 파일 등

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-16 05:34:39 +09:00
parent c397bacf8c
commit 5d494eb8e8
36 changed files with 246 additions and 72 deletions

View File

@@ -183,14 +183,25 @@ def judge_repetition(text: str, segs: list[SegInfo], sensitivity: float) -> bool
return any(s.compression_ratio > t.compression + 0.4 for s in segs) and len(norm) >= 12
_REPEAT_RE = re.compile(r"(.{1,10}?)(?:\s*\1){2,}")
_REPEAT_RE = re.compile(r"(\S{1,10}?)((?:\s*\1){2,})")
def _collapse_one(m: re.Match[str]) -> str:
unit, rest = m.group(1), m.group(2)
# 숫자는 줄이지 않는다 ("1000원" → "10원" 이 되면 안 됨)
if any(ch.isdigit() for ch in unit):
return m.group(0)
# 한 글자 반복은 띄어 쓴 경우("아 아 아")만 고리로 본다 ("www", "ㅋㅋㅋ" 같은 한 덩어리는 그대로)
if len(unit) == 1 and not rest[:1].isspace():
return m.group(0)
return unit
def collapse_repetition(text: str) -> str:
"""Whisper 반복 고리("페이스페이스페이스…", "아 아 아 아")를 한 번으로 줄인다."""
"""Whisper 반복 고리("페이스페이스페이스…", "아 아 아 아")를 한 번으로 줄인다. 숫자 · 붙어 있는 한 글자 반복은 그대로."""
out = text.strip()
for _ in range(3):
nxt = _REPEAT_RE.sub(lambda m: m.group(1), out)
nxt = _REPEAT_RE.sub(_collapse_one, out)
if nxt == out:
break
out = nxt

View File

@@ -6,6 +6,7 @@ Edge TTS 는 말 속도를 0.5배까지만 늦춘다. 그보다 느리게(0.1~0.
from __future__ import annotations
import os
from fractions import Fraction
from .protocol import WorkerError
@@ -29,7 +30,9 @@ def change_tempo(src: str, dst: str, tempo: float) -> dict[str, float]:
import av.filter
chain = atempo_chain(tempo)
with av.open(src) as inp, av.open(dst, "w", format="ogg") as out:
# 다 만든 뒤에만 이름을 바꾼다 (중간에 죽어도 반쪽 파일이 안내 음성으로 남지 않게)
tmp = f"{dst}.part"
with av.open(src) as inp, av.open(tmp, "w", format="ogg") as out:
ist = inp.streams.audio[0]
ost = out.add_stream("libopus", rate=48000)
ost.layout = "mono"
@@ -66,4 +69,5 @@ def change_tempo(src: str, dst: str, tempo: float) -> dict[str, float]:
drain()
for p in ost.encode(None):
out.mux(p)
os.replace(tmp, dst)
return {"duration_s": round(dur, 3), "stages": len(chain)}

View File

@@ -47,3 +47,7 @@ def test_collapse_repetition() -> None:
assert collapse_repetition("아 아 아 아 아 아 아 아") == "아"
assert collapse_repetition("가자 가자") == "가자 가자"
assert collapse_repetition("레이즈 궁 빠졌어") == "레이즈 궁 빠졌어"
# 숫자 · 붙어 있는 한 글자 반복은 줄이지 않는다
assert collapse_repetition("1000원 줘 줘 줘 줘 줘") == "1000원 줘"
assert collapse_repetition("그래 그래 그래 2000 원") == "그래 2000 원"
assert collapse_repetition("www 다시") == "www 다시"