From 2e9928a411097ca54f56f6ac7e7234783c9c2235 Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Thu, 21 May 2026 02:38:39 +0000 Subject: [PATCH] Scope reel poster fallback to browser cards --- frontend/src/App.vue | 23 +++++++----- frontend/src/components/MediaCard.vue | 53 ++++++++++++++++----------- 2 files changed, 45 insertions(+), 31 deletions(-) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index b248d49..da6e5a2 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -184,7 +184,7 @@ import { ref, computed, onMounted, onUnmounted, watch } from 'vue'; import { useRouter, useRoute } from 'vue-router'; import type { Movie, Series, MediaItem, EpisodeWithSeries, MatchedPerson, MatchedEpisode, TaskInfo } from './types'; -import { playMedia, openFolder, isMpcBeReachable, fetchResumePositions, normalizeMediaPath } from './api'; +import { playMedia, openFolder, isMpcBeReachable, fetchResumePositions, normalizeMediaPath, getPlayerStatus } from './api'; import { useKeyboardNavigation } from './composables/useKeyboardNavigation'; import { useMediaWebSocket } from './composables/useMediaWebSocket'; import Header from './components/Header.vue'; @@ -227,6 +227,15 @@ async function refreshResumePositions() { resumePositions.value = await fetchResumePositions(); } +async function refreshPlayerStatus() { + try { + const status = await getPlayerStatus(); + mpcBeConnected.value = status.remote; + } catch { + mpcBeConnected.value = false; + } +} + function hasResumePosition(filePath: string | null) { if (!filePath) return false; const normalizedPath = normalizeMediaPath(filePath); @@ -379,6 +388,7 @@ function handleEscapeKey(event: KeyboardEvent) { } onMounted(() => { + void refreshPlayerStatus(); void refreshResumePositions(); document.addEventListener('keydown', handleEscapeKey); window.addEventListener('mediahive:gamepad-action', onGamepadAction as EventListener); @@ -501,15 +511,11 @@ function movieToMediaItem(movie: Movie): MediaItem { const torrents = Object.values(movie.torrents || {}); const resolution = torrents.length > 0 ? torrents[0].resolution : null; - // Use first showreel image as fallback if no cover - const coverPath = movie.cover_path || - (movie.showreel_images && movie.showreel_images.length > 0 ? movie.showreel_images[0] : null); - return { id: movie.id, title: movie.title || 'Unknown', year: movie.year, - cover_path: coverPath, + cover_path: movie.cover_path, showreel_images: movie.showreel_images, type: 'movies', resolution: resolution, @@ -528,14 +534,11 @@ function seriesToMediaItem(series: Series): MediaItem { } } - // Use first reel image as fallback if no cover - const coverPath = series.cover_path || (reelImages.length > 0 ? reelImages[0] : null); - return { id: series.id, title: series.title || 'Unknown', year: null, - cover_path: coverPath, + cover_path: series.cover_path, showreel_images: reelImages.length > 0 ? reelImages : null, type: 'series', data: series, diff --git a/frontend/src/components/MediaCard.vue b/frontend/src/components/MediaCard.vue index 9349773..4a1135b 100644 --- a/frontend/src/components/MediaCard.vue +++ b/frontend/src/components/MediaCard.vue @@ -7,17 +7,24 @@ @keydown.enter.prevent="$emit('click')" >
- +
{{ item.type === 'movies' ? '🎬' : item.type === 'episode' ? '📺' : '📺' }}
@@ -30,7 +37,6 @@ {{ displayTitle }} {{ item.year }}
-