Diverse rettelser
This commit is contained in:
@@ -744,4 +744,28 @@ def get_community_alts_for_song(song_id: str) -> list:
|
||||
WHERE cad.song_id = ?
|
||||
ORDER BY cad.avg_rating DESC
|
||||
""", (song_id,)).fetchall()
|
||||
return [dict(r) for r in rows]
|
||||
return [dict(r) for r in rows]
|
||||
|
||||
def refresh_file_availability():
|
||||
"""Tjek hurtigt om alle kendte filer stadig eksisterer — opdater file_missing.
|
||||
Køres ved opstart i baggrundstråd."""
|
||||
from pathlib import Path
|
||||
try:
|
||||
with get_db() as conn:
|
||||
rows = conn.execute(
|
||||
"SELECT id, local_path, file_missing FROM files"
|
||||
).fetchall()
|
||||
for row in rows:
|
||||
try:
|
||||
exists = Path(row["local_path"]).exists()
|
||||
expected = 0 if exists else 1
|
||||
if row["file_missing"] != expected:
|
||||
conn.execute(
|
||||
"UPDATE files SET file_missing=? WHERE id=?",
|
||||
(expected, row["id"])
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
logger.info("Fil-tilgængelighed opdateret")
|
||||
except Exception as e:
|
||||
logger.warning(f"refresh_file_availability fejl: {e}")
|
||||
Reference in New Issue
Block a user