feat: add NAS management UI and operation history
This commit is contained in:
@@ -34,7 +34,12 @@ def index_file(conn, path: Path) -> None:
|
||||
|
||||
def scan(root: Path, db_path: Path) -> int:
|
||||
count = 0
|
||||
seen = set()
|
||||
with connect(db_path) as conn:
|
||||
for path in iter_music(root):
|
||||
index_file(conn, path); count += 1
|
||||
index_file(conn, path); seen.add(str(path)); count += 1
|
||||
rows = conn.execute("SELECT id,file_path,status FROM audio_tracks WHERE status!='missing'").fetchall()
|
||||
for row in rows:
|
||||
if row["file_path"] not in seen and not Path(row["file_path"]).exists():
|
||||
conn.execute("UPDATE audio_tracks SET status='missing',updated_at=CURRENT_TIMESTAMP WHERE id=?", (row["id"],))
|
||||
return count
|
||||
|
||||
Reference in New Issue
Block a user