[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:
1 parent
463a77ac5d
commit
2520fda13b
6 files changed
+359
-47
No files matched your search
@@ -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:
|
||||
|
||||
@@ -1,31 +1,22 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Детектор: aa='Various Artists' у папки, где БОЛЬШИНСТВО файлов имеет одного artist.
|
||||
"""Detector A2 — 'Various Artists' on a folder that has only ONE artist.
|
||||
|
||||
Класс дефекта (сессия 8, 2026-09-27):
|
||||
Папка-АЛЬБОМ помечена 'Various Artists', хотя исполнитель один.
|
||||
Причины ложного срабатывания критерия «разные artist = сборник»:
|
||||
1. разнобой написания одного исполнителя
|
||||
('Иванушки' / 'Иванушки Int.' / 'Иванушки International');
|
||||
2. несколько чужих файлов в корне папки артиста
|
||||
(7 чужих треков среди 52 треков 'Агата Кристи').
|
||||
Rule (Alex): Various Artists ONLY when the performers are genuinely different.
|
||||
One artist — including spelling variants (Иванушки / Иванушки Int. / Иванушки
|
||||
International) and featured credits — gets THAT artist. For a DJ-mix compilation the
|
||||
albumartist is the DJ who compiled it, not Various Artists.
|
||||
|
||||
Правило Alex: «Папка с 1 уникальным артистом → АЛЬБОМ, albumartist = artist».
|
||||
Iterate until it reports zero candidates: the classes are nested — fixing one reveals
|
||||
the next (e.g. Агата Кристи → 9999 - Разное/Проекты).
|
||||
|
||||
Запуск:
|
||||
Usage:
|
||||
python3 find_va_misuse.py [путь_к_APPLY-PLAN.csv]
|
||||
|
||||
Выход: список папок-кандидатов с частотой доминирующего артиста.
|
||||
⚠️ Кандидат ≠ дефект. Каждый случай подтверждать у Alex (правило сессии 7:
|
||||
«не отвечать за Alex»). Спорный случай: '!Рэп/НТЛ' — формально попадает
|
||||
под правило сборника из сессии 5 (треки в корне при наличии подпапок-альбомов).
|
||||
|
||||
Контроль после правок: гонять детектор, пока он не вернёт пусто или только
|
||||
подтверждённые Alex спорные случаи (класс выявляется итеративно).
|
||||
"""
|
||||
import sys
|
||||
|
||||
import csv
|
||||
import collections
|
||||
import sys
|
||||
|
||||
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='')))
|
||||
@@ -49,7 +40,7 @@ for folder, rs in sorted(by.items()):
|
||||
continue
|
||||
top, n = art.most_common(1)[0]
|
||||
total = len(rs)
|
||||
# доминирует один артист: >50% файлов
|
||||
# one artist dominates — folder is NOT a genuine compilation
|
||||
if n / total > 0.5 and n >= 2:
|
||||
suspects.append((n, total, top, folder))
|
||||
|
||||
|
||||
Reference in new issue
Block a user