fix(quality): repair two PR #896 merge blockers
#1 DB init crash: the idx_lh_verification_status index was created before the ALTER TABLE that adds the column, so a fresh library_history (every existing install + clean checkouts) died on startup with "no such column: verification_status". Move the index after the column migration. #2 #652 quarantine loop returns: the rewritten filter_results_by_quality_preference dropped the _drop_quarantined_sources() pre-filter, letting a previously-quarantined (user, file) win the picker again and re-quarantine forever. Re-wire it at the top of the method. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
1005c7e306
commit
5d5ed486c4
2 changed files with 13 additions and 1 deletions
|
|
@ -2026,6 +2026,13 @@ class SoulseekClient(DownloadSourcePlugin):
|
|||
"""
|
||||
from database.music_database import MusicDatabase
|
||||
|
||||
if not results:
|
||||
return []
|
||||
|
||||
# Issue #652: drop candidates on the quarantine record BEFORE ranking,
|
||||
# so a previously-quarantined source can't win the quality picker by
|
||||
# superior bitrate and re-trigger the same failed download in a loop.
|
||||
results = self._drop_quarantined_sources(results)
|
||||
if not results:
|
||||
return []
|
||||
|
||||
|
|
|
|||
|
|
@ -664,7 +664,6 @@ class MusicDatabase:
|
|||
""")
|
||||
cursor.execute("CREATE INDEX IF NOT EXISTS idx_lh_event_type ON library_history (event_type)")
|
||||
cursor.execute("CREATE INDEX IF NOT EXISTS idx_lh_created_at ON library_history (created_at DESC)")
|
||||
cursor.execute("CREATE INDEX IF NOT EXISTS idx_lh_verification_status ON library_history (verification_status)")
|
||||
|
||||
# Migration: add download_source column
|
||||
cursor.execute("PRAGMA table_info(library_history)")
|
||||
|
|
@ -677,6 +676,12 @@ class MusicDatabase:
|
|||
cursor.execute(f"ALTER TABLE library_history ADD COLUMN {_col} TEXT")
|
||||
logger.info(f"Added {_col} column to library_history")
|
||||
|
||||
# Index on verification_status — MUST come after the ALTER above:
|
||||
# on a fresh DB the base CREATE TABLE has no verification_status
|
||||
# column, so indexing it before the migration adds it raises
|
||||
# "no such column: verification_status" and aborts DB init.
|
||||
cursor.execute("CREATE INDEX IF NOT EXISTS idx_lh_verification_status ON library_history (verification_status)")
|
||||
|
||||
# One-time backfill: derive verification_status for history rows
|
||||
# written before the column existed (or by pipeline exits that
|
||||
# missed it) from the acoustid_result those imports already
|
||||
|
|
|
|||
Loading…
Reference in a new issue