debugagen openhome

This commit is contained in:
2025-12-05 21:59:43 +01:00
parent 2ffd3b5fb5
commit 27aa70d81f
17 changed files with 919 additions and 496 deletions

View File

@@ -0,0 +1,55 @@
import type {
OpenHomePlaylistAddRequest,
OpenHomePlaylistSnapshot,
} from '@/services/pmocontrol/types'
const API_BASE = '/api/control'
export async function getOpenHomePlaylist(rendererId: string): Promise<OpenHomePlaylistSnapshot> {
const resp = await fetch(
`${API_BASE}/renderers/${encodeURIComponent(rendererId)}/oh/playlist`,
)
if (!resp.ok) {
throw new Error(`Failed to fetch OpenHome playlist: ${resp.status} ${resp.statusText}`)
}
return resp.json()
}
export async function clearOpenHomePlaylist(rendererId: string): Promise<void> {
const resp = await fetch(
`${API_BASE}/renderers/${encodeURIComponent(rendererId)}/oh/playlist/clear`,
{ method: 'POST' },
)
if (!resp.ok) {
throw new Error(`Failed to clear OpenHome playlist: ${resp.status} ${resp.statusText}`)
}
}
export async function addOpenHomeTrack(
rendererId: string,
payload: OpenHomePlaylistAddRequest,
): Promise<void> {
const resp = await fetch(
`${API_BASE}/renderers/${encodeURIComponent(rendererId)}/oh/playlist/add`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
},
)
if (!resp.ok) {
throw new Error(`Failed to add track to OpenHome playlist: ${resp.status} ${resp.statusText}`)
}
}
export async function playOpenHomeTrack(rendererId: string, trackId: number): Promise<void> {
const resp = await fetch(
`${API_BASE}/renderers/${encodeURIComponent(
rendererId,
)}/oh/playlist/play/${encodeURIComponent(trackId.toString())}`,
{ method: 'POST' },
)
if (!resp.ok) {
throw new Error(`Failed to play OpenHome track ${trackId}: ${resp.status} ${resp.statusText}`)
}
}

View File

@@ -5,11 +5,28 @@
// RENDERERS
// ============================================================================
export type RendererProtocolSummary = 'upnp' | 'openhome' | 'hybrid'
export interface RendererCapabilitiesSummary {
has_avtransport: boolean
has_avtransport_set_next: boolean
has_rendering_control: boolean
has_connection_manager: boolean
has_linkplay_http: boolean
has_arylic_tcp: boolean
has_oh_playlist: boolean
has_oh_volume: boolean
has_oh_info: boolean
has_oh_time: boolean
has_oh_radio: boolean
}
export interface RendererSummary {
id: string
friendly_name: string
model_name: string
protocol: 'UpnpAvOnly' | 'OpenHomeOnly' | 'Hybrid'
protocol: RendererProtocolSummary
capabilities: RendererCapabilitiesSummary
online: boolean
}
@@ -51,6 +68,32 @@ export interface QueueSnapshot {
current_index: number | null // Index de la piste en cours (null si rien en lecture)
}
// ============================================================================
// OPENHOME PLAYLIST
// ============================================================================
export interface OpenHomePlaylistTrack {
id: number
uri: string
title: string | null
artist: string | null
album: string | null
album_art_uri: string | null
}
export interface OpenHomePlaylistSnapshot {
renderer_id: string
current_id: number | null
tracks: OpenHomePlaylistTrack[]
}
export interface OpenHomePlaylistAddRequest {
uri: string
metadata: string
after_id?: number | null
play?: boolean
}
// ============================================================================
// MEDIA SERVERS
// ============================================================================