Compare commits

...

2 Commits

Author SHA1 Message Date
Erik Thiele
9d317ee592 chore: Version auf 6.2.7 heben 2026-09-08 09:09:37 +02:00
Erik Thiele
cbadf096fd fix: Loeschen entfernt auch den Playlist-Eintrag der Datei
Der Filter in delete_file verglich nur item["url"], traf damit aber nur
URL-Eintraege. Bei Dateien wurde die Datei vom Datentraeger geloescht,
der Eintrag {"name": ...} blieb als Karteileiche in der config.json
stehen - in der Priority-Playlist wie in jeder Screen-Playlist.
Vergleich laeuft jetzt ueber playlist_item_name(), das alle drei
Eintragsformen abdeckt.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-08 09:09:37 +02:00

15
app.py
View File

@@ -51,7 +51,7 @@ CONFIG_FILE = os.path.join(BASE_DIR, "config.json") # Persistente Konfiguration
USERS_FILE = os.path.join(BASE_DIR, "users.json") # User-Datenbank USERS_FILE = os.path.join(BASE_DIR, "users.json") # User-Datenbank
HISTORY_FILE = os.path.join(BASE_DIR, "history.json") # Aktivitätsverlauf HISTORY_FILE = os.path.join(BASE_DIR, "history.json") # Aktivitätsverlauf
APP_VERSION = "6.2.6" APP_VERSION = "6.2.7"
UPLOAD_EXTENSIONS = {".jpg", ".jpeg", ".png", ".mp4"} UPLOAD_EXTENSIONS = {".jpg", ".jpeg", ".png", ".mp4"}
app = Flask(__name__) app = Flask(__name__)
@@ -1878,18 +1878,15 @@ def delete_file(site, screen, filename):
if screen == "priority": if screen == "priority":
path = os.path.join(priority_dir(site), filename) path = os.path.join(priority_dir(site), filename)
playlist = get_priority_config(cfg, site).get("playlist", []) playlist = get_priority_config(cfg, site).get("playlist", [])
playlist[:] = [item for item in playlist if not (
(isinstance(item, str) and item == filename) or
(isinstance(item, dict) and item.get("url") == filename)
)]
else: else:
path = os.path.join(MEDIA_DIR, site, screen, filename) path = os.path.join(MEDIA_DIR, site, screen, filename)
screens_cfg = cfg.get("sites", {}).get(site, {}).get("screens", {}) screens_cfg = cfg.get("sites", {}).get(site, {}).get("screens", {})
playlist = screens_cfg.get(screen, {}).get("playlist", []) playlist = screens_cfg.get(screen, {}).get("playlist", [])
playlist[:] = [item for item in playlist if not (
(isinstance(item, str) and item == filename) or # Ueber playlist_item_name vergleichen: Datei-Eintraege stehen als
(isinstance(item, dict) and item.get("url") == filename) # {"name": ...}, URLs als {"url": ...}, Altbestand als reiner String.
)] playlist[:] = [item for item in playlist
if playlist_item_name(item) != filename]
if os.path.exists(path): if os.path.exists(path):
os.remove(path) os.remove(path)