diff --git a/Dockerfile b/Dockerfile index 2617b76..5635fa7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM python:3.12-slim -RUN apt-get update && apt-get install -y --no-install-recommends chromaprint-tools && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y --no-install-recommends libchromaprint-tools && rm -rf /var/lib/apt/lists/* WORKDIR /app COPY pyproject.toml README.md ./ COPY am_deduper ./am_deduper diff --git a/am_deduper/db.py b/am_deduper/db.py index d705a50..fadd2a8 100644 --- a/am_deduper/db.py +++ b/am_deduper/db.py @@ -44,4 +44,7 @@ def connect(path: Path) -> sqlite3.Connection: conn.execute("PRAGMA foreign_keys=ON") conn.execute("PRAGMA busy_timeout=5000") conn.executescript(SCHEMA) + cols={r[1] for r in conn.execute("PRAGMA table_info(audio_tracks)")} + if "version_flags" not in cols: + conn.execute("ALTER TABLE audio_tracks ADD COLUMN version_flags TEXT") return conn diff --git a/am_deduper/scanner.py b/am_deduper/scanner.py index f89584a..4c276f6 100644 --- a/am_deduper/scanner.py +++ b/am_deduper/scanner.py @@ -24,7 +24,7 @@ def index_file(conn, path: Path) -> None: flags = ",".join(meta.get("version_flags", [])) conn.execute(""" INSERT INTO audio_tracks(file_path,file_size,fast_hash,duration,artist,title,album,format,bitrate,sample_rate,bit_depth,version_flags,inode,device,status) - VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,'active') + VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,'active') ON CONFLICT(file_path) DO UPDATE SET file_size=excluded.file_size, fast_hash=excluded.fast_hash, duration=excluded.duration,artist=excluded.artist,title=excluded.title,album=excluded.album,format=excluded.format, bitrate=excluded.bitrate,sample_rate=excluded.sample_rate,bit_depth=excluded.bit_depth,version_flags=excluded.version_flags,