fix: tighten lyric placeholder detection

This commit is contained in:
2026-07-22 00:13:39 +08:00
parent b0d1b1766d
commit 2ba121b0c1
4 changed files with 17 additions and 11 deletions
+9 -6
View File
@@ -14,13 +14,15 @@ text=open(sys.argv[1],encoding='utf-8-sig',errors='replace').read().replace('\r'
meta=re.compile(r'^\[(?:ti|ar|al|by|re|ve|offset):',re.I)
timed=re.compile(r'^\s*\[(?:\d{1,2}:)?\d{1,2}:\d{2}(?:\.\d+)?\]\s*(.*)$')
labels=re.compile(r'^(?:作词|作曲|词曲|编曲|制作人?|混音(?:师|助理)?|录音(?:师)?|工程师|弦乐|鼓和钢琴|电贝斯|额外编程|数字编辑|原唱|演唱|出品|发行|版权|produced|written|composer|arranged|lyrics?|music|artist|title)\s*[:\-].*$',re.I)
body=[]
body=[]; timed_lines=0
for raw in text.split('\n'):
line=raw.strip()
if not line or meta.match(line): continue
match=timed.match(line); line=(match.group(1).strip() if match else line)
if line and not labels.match(line): body.append(line)
sys.exit(0 if len(body)>=2 and len(''.join(body).replace(' ',''))>=8 else 1)
if line and not labels.match(line):
body.append(line); timed_lines += 1 if match else 0
valid=(len(body)>=3 and len(''.join(body).replace(' ',''))>=12) if timed_lines else (len(body)>=2 and len(''.join(body).replace(' ',''))>=8)
sys.exit(0 if valid else 1)
PY
then
echo "SKIP $audio"
@@ -42,13 +44,14 @@ def meaningful(text):
meta=re.compile(r'^\[(?:ti|ar|al|by|re|ve|offset):',re.I)
timed=re.compile(r'^\s*\[(?:\d{1,2}:)?\d{1,2}:\d{2}(?:\.\d+)?\]\s*(.*)$')
labels=re.compile(r'^(?:作词|作曲|词曲|编曲|制作人?|混音(?:师|助理)?|录音(?:师)?|工程师|弦乐|鼓和钢琴|电贝斯|额外编程|数字编辑|原唱|演唱|出品|发行|版权|produced|written|composer|arranged|lyrics?|music|artist|title)\s*[:\-].*$',re.I)
body=[]
body=[]; timed_lines=0
for raw in text.replace('\r','').split('\n'):
line=raw.strip()
if not line or meta.match(line): continue
match=timed.match(line); line=(match.group(1).strip() if match else line)
if line and not labels.match(line): body.append(line)
return len(body)>=2 and len(''.join(body).replace(' ',''))>=8
if line and not labels.match(line):
body.append(line); timed_lines += 1 if match else 0
return (len(body)>=3 and len(''.join(body).replace(' ',''))>=12) if timed_lines else (len(body)>=2 and len(''.join(body).replace(' ',''))>=8)
best=None
for x in rows if isinstance(rows,list) else []:
l=x.get('lyrics','').strip(); ct=x.get('title',''); ca=x.get('artist','')