Report a failed podcast search without ending the music search

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
sanapachandClaude Opus 5.5 committed 2026-11-20 15:12:52 +02:00
1 parent 678c7b8211
commit 2ea3f7b337
7 files changed
+119 -31

No files matched your search

+13 -6
View File
@@ -4353,7 +4353,7 @@ document.addEventListener('alpine:init', () => {
similaritySearchLabel: '',
similaritySearchError: '',
similaritySearchStats: { loading: false, tracks: 0, artists: 0, peers: 0, elapsed_ms: 0 },
federationSearch: { loading: false, error: '', artists: [], releases: [], tracks: [], podcasts: [] },
federationSearch: { loading: false, error: '', artists: [], releases: [], tracks: [], podcasts: [], podcastDiscovery: '' },
artistFederation: { loading: false, error: '', releases: [], tracks: [] },
federationPreparing: {},
federationFailures: {},
@@ -5293,7 +5293,7 @@ document.addEventListener('alpine:init', () => {
this.similaritySearchError = '';
this.searchLoading = true;
this.searchResults = null;
this.federationSearch = { loading: true, error: '', artists: [], releases: [], tracks: [], podcasts: [] };
this.federationSearch = { loading: true, error: '', artists: [], releases: [], tracks: [], podcasts: [], podcastDiscovery: '' };
this.similaritySearchStats = { loading: true, tracks: 0, artists: 0, peers: 0, elapsed_ms: 0 };
Alpine.store('info').close();
try {
@@ -5435,12 +5435,12 @@ document.addEventListener('alpine:init', () => {
this._federationSearchSource.close();
this._federationSearchSource = null;
}
this.federationSearch = { loading: false, error: '', artists: [], releases: [], tracks: [], podcasts: [] };
this.federationSearch = { loading: false, error: '', artists: [], releases: [], tracks: [], podcasts: [], podcastDiscovery: '' };
},
startFederationSearch(query) {
this.stopFederationSearch();
this.federationSearch = { loading: true, error: '', artists: [], releases: [], tracks: [], podcasts: [] };
this.federationSearch = { loading: true, error: '', artists: [], releases: [], tracks: [], podcasts: [], podcastDiscovery: '' };
const source = new EventSource(`/api/player/federation/search/events?q=${encodeURIComponent(query)}`);
this._federationSearchSource = source;
const updateResults = (kind, keyFor, labelFor, entity) => {
@@ -5507,10 +5507,17 @@ document.addEventListener('alpine:init', () => {
podcasts.sort((left, right) => left.rank - right.rank);
this.federationSearch = { ...this.federationSearch, podcasts };
});
source.addEventListener('search.completed', () => {
source.addEventListener('search.completed', event => {
window.clearTimeout(watchdog);
// `running`, `off` or `failed`: a failed podcast search must
// not look like "no podcasts found".
let podcastDiscovery = '';
try {
const state = JSON.parse(event?.data)?.entity?.podcast_discovery;
if (['running', 'off', 'failed'].includes(state)) podcastDiscovery = state;
} catch {}
if (this._federationSearchSource === source) {
this.federationSearch = { ...this.federationSearch, loading: false };
this.federationSearch = { ...this.federationSearch, loading: false, podcastDiscovery };
}
source.close();
if (this._federationSearchSource === source) this._federationSearchSource = null;