feat: add cover image display for ABS audiobooks

- Add coverUrl to ABS data from coverPath
- Update dashboard.html to display cover image with fallback placeholder
- Style cover images with rounded corners and shadow
- Add error handling for broken image URLs

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
wralto-user-1
2026-11-02 22:53:15 +01:00
parent f33abdcc31
commit f4fe00d15b
2 changed files with 85 additions and 12 deletions

View File

@ -90,7 +90,7 @@ def fetch_weather():
def fetch_abs_data():
"""Fetch ABS user data and latest audiobook"""
"""Fetch ABS user data and latest audiobook with cover"""
try:
headers = {
"Authorization": f"Bearer {ABS_TOKEN}",
@ -125,11 +125,19 @@ def fetch_abs_data():
title = metadata.get("title", "Unbekannt")
author = metadata.get("author", "")
media_type = item_data.get("mediaType", "item")
# Get cover URL - construct full URL from coverPath
cover_path = item_data.get("coverPath", "")
cover_url = None
if cover_path:
# Remove leading slash if present and construct full URL
cover_url = f"{ABS_BASE_URL}{cover_path}" if cover_path.startswith("/") else f"{ABS_BASE_URL}/{cover_path}"
return {
"title": title,
"author": author,
"mediaType": media_type,
"coverUrl": cover_url,
"progress": round(latest.get("progress", 0) * 100),
"currentTime": format_duration(latest.get("currentTime", 0)),
"duration": format_duration(latest.get("duration", 0)),