[2026-09-27] eagle: personal/plans/music-artist-albumartist-repair.md personal/plans/tagwriter-container.md personal/tech/id3-tag-repair.md personal/tech/music-tags-repair-truenas.md personal/tech/scripts/find_aa_hijack.py personal/tech/scripts/find_va_misuse.py

This commit is contained in:
Alexey Martemyanov committed 2026-09-27 14:19:15 +06:00
1 parent 463a77ac5d
commit 2520fda13b
6 files changed
+359 -47

No files matched your search

+18 -14
View File
@@ -1,26 +1,29 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Детектор класса «albumartist размножен от чужого файла в корне папки».
"""Detector A1 — albumartist hijacked from a random ROOT file of the folder.
Сессия 6, 2026-09-27. Нашёл 7 испорченных папок из 11 подозреваемых
(The Prodigy->DJ Feel, Банд Эрос->VIP77, Дискотека Авария, Жуки,
Потап & Каменских, Король и Шут, Ленинград).
Rule (Alex): a track's albumartist = its OWN artist, unless the album is a genuine
compilation. A value taken from one stray file in the root must NOT be propagated.
ПРИЗНАК ПОРЧИ:
для папки, где new_albumartist ОДИН на всю папку:
он не совпадает с top-артистом папки
И не совпадает с именем папки
И совпадает с МИНОРИТАРНЫМ артистом папки
-> ПОДОЗРЕВАЕМЫЙ
Finds folders where the folder-level albumartist equals the `artist` of a MINORITY
file, but is neither the top artist nor the folder name.
ЗАПУСК: python3 find_aa_hijack.py
Не меняет файлы. Только печатает.
Benign hits to review manually (NOT corruption):
- eponymous compilation (ДДТ/2008 L'Echoppe — files are a duet credit)
- letter sub-folder of a set (Сборка Песни для детей/L)
- category root (z Другое, Enigma, Ленинград)
- any folder the user explicitly decided (Re Sfaction, S Is Here)
Usage:
python3 find_aa_hijack.py [путь_к_APPLY-PLAN.csv]
"""
import sys
import csv
import collections
import os
P = '/Users/admin/Downloads/music-tags/APPLY-PLAN.csv'
P = sys.argv[1] if len(sys.argv) > 1 else '/Users/admin/Downloads/music-tags/APPLY-PLAN.csv'
rows = list(csv.DictReader(open(P, encoding='utf-8-sig', newline='')))
@@ -36,13 +39,14 @@ suspects = []
for folder, rs in sorted(by_folder.items()):
aa_vals = collections.Counter(s(r['new_albumartist']) for r in rs if s(r['new_albumartist']))
if len(aa_vals) != 1:
continue # смешанные папки — отдельный случай
continue # mixed folder — separate case
aa = next(iter(aa_vals))
art = collections.Counter(s(r['new_artist']) for r in rs if s(r['new_artist']))
if not art:
continue
top_artist, top_n = art.most_common(1)[0]
folder_name = os.path.basename(folder)
# albumartist matches a MINORITY artist, not the top one, not the folder name
if aa != top_artist and aa != folder_name and aa in art:
minority = art[aa]
if minority < top_n: