부르크뮐러와 슈만 연습곡 30개의 공개 등록과 MIDI 및 원본·생성 자료를 제거했다. 정확한 파일명만 제외 목록에 넣어 재시작 후 재등록을 막았다. 회원 업로드와 기존 기본 샘플은 유지했다. 운영 백업: /home/syskiller/piano/backups/bach-to-basics/20261009-withdraw-practice-30. 격리 테스트 5개 통과. 운영 재시작 뒤 HTTPS 목록과 DB 및 파일에서 철회곡 0개를 확인했다. 회원 업로드 2건과 기존 기본 샘플 7개 보존.
This commit is contained in:
+4
-13
@@ -180,17 +180,6 @@ SAMPLES = (
|
||||
},
|
||||
)
|
||||
|
||||
# 별도 목록은 원본 MIDI와 권리 표시를 함께 보관한다. 화면에 쓰는 필드만 기본 샘플에 합친다.
|
||||
PRACTICE_COLLECTION = json.loads(
|
||||
(Path(__file__).with_name("sample_midi") / "practice_collection.json").read_text(encoding="utf-8")
|
||||
)
|
||||
SAMPLES += tuple(
|
||||
{key: item[key] for key in (
|
||||
"storage_name", "title", "artist", "description", "difficulty", "genre", "arrangement", "tags"
|
||||
)}
|
||||
for item in PRACTICE_COLLECTION
|
||||
)
|
||||
|
||||
LEGACY_SAMPLE_KEYS = (
|
||||
"first-snow-melody.mid",
|
||||
"first-snow-accompaniment.mid",
|
||||
@@ -201,14 +190,16 @@ LEGACY_SAMPLE_KEYS = (
|
||||
"evening-waltz-beginner.mid",
|
||||
"sunrise-arpeggio-easy.mid",
|
||||
"black-key-pentatonic-beginner.mid",
|
||||
) + tuple(f"practice-burgmuller-{number:02}.mid" for number in range(1, 19)) + tuple(
|
||||
f"practice-schumann-{number:02}.mid" for number in range(1, 13)
|
||||
)
|
||||
|
||||
|
||||
def _seed_samples() -> None:
|
||||
source_root = Path(__file__).with_name("sample_midi")
|
||||
with connect() as connection:
|
||||
# 초기 시험용으로 만든 짧은 음형은 실제 공개 도메인 연습곡으로 교체한다.
|
||||
# seed_key가 정확히 일치하는 기본 자료만 지우므로 회원 업로드에는 영향을 주지 않는다.
|
||||
# 사용자 요청으로 철회한 기본 연습곡만 제거한다. 회원 업로드에는 영향을 주지 않는다.
|
||||
# 재시작 후에도 다시 등록되지 않도록 철회한 파일 이름을 정확히 지정한다.
|
||||
placeholders = ",".join("?" for _ in LEGACY_SAMPLE_KEYS)
|
||||
connection.execute(
|
||||
f"DELETE FROM midi_items WHERE owner_id IS NULL AND seed_key IN ({placeholders})",
|
||||
|
||||
Reference in New Issue
Block a user