feat: persist incremental live channel analysis

Persist live channel language metadata across background projection rebuilds and target Local AI identity analysis to newly detected streams unless a manual full analysis is requested.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
blomios
2026-10-07 23:12:42 +02:00
parent 9967fd7adf
commit 4319e64e1e
10 changed files with 516 additions and 98 deletions

View File

@ -195,7 +195,7 @@ class ChannelList {
clearTimeout(searchTimeout);
searchTimeout = setTimeout(() => {
if (this.projectedLogicalChannels || this.channels.length) this.render();
else this.loadChannels({ refreshLanguages: false });
else this.loadChannels();
}, this.projectedLogicalChannels || this.channels.length ? 75 : 250);
});
@ -366,13 +366,11 @@ class ChannelList {
}
setLanguageDetectionMode(mode) {
const safeMode = ['algo', 'laya', 'hybrid'].includes(mode) ? mode : 'algo';
this.layaLanguageResults.clear();
this.languageDetectionNotice = '';
this.languageDetectionFallback = false;
if (this.channels.length > 0) {
this.render();
void this.refreshLayaLanguages(safeMode);
}
}
@ -945,7 +943,7 @@ class ChannelList {
/**
* Load channels from selected source
*/
async loadChannels({ refreshLanguages = true } = {}) {
async loadChannels() {
if (this.isLoading) return;
this.isLoading = true;
this.currentRenderId = null; // Reset render tracking
@ -962,7 +960,7 @@ class ChannelList {
if (!sourceValue) {
// Load from all sources
await this.loadAllChannels({ refreshLanguages });
await this.loadAllChannels();
this.isLoading = false;
return;
}
@ -974,7 +972,6 @@ class ChannelList {
if (await this.loadProjectedChannels(parseInt(id, 10))) {
this.render();
if (refreshLanguages) void this.refreshLayaLanguages();
return;
}
@ -991,7 +988,6 @@ class ChannelList {
]);
this.render();
if (refreshLanguages) void this.refreshLayaLanguages();
} catch (err) {
console.error('Error loading channels:', err);
if (previousState.channels.length > 0) {
@ -1011,7 +1007,7 @@ class ChannelList {
/**
* Load channels from all enabled sources
*/
async loadAllChannels({ refreshLanguages = true } = {}) {
async loadAllChannels() {
const previousState = {
channels: this.channels,
groups: this.groups,
@ -1026,7 +1022,6 @@ class ChannelList {
if (await this.loadProjectedChannels()) {
this.render();
if (refreshLanguages) void this.refreshLayaLanguages();
return;
}
@ -1047,7 +1042,6 @@ class ChannelList {
this.loadFavorites()
]);
this.render();
if (refreshLanguages) void this.refreshLayaLanguages();
} catch (err) {
console.error('Error loading all channels:', err);
if (previousState.channels.length > 0) {
@ -1124,7 +1118,7 @@ class ChannelList {
} catch {}
this.renderLanguageFilter();
if (this.projectedLogicalChannels || this.channels.length) this.render();
else this.loadChannels({ refreshLanguages: false });
else this.loadChannels();
}
closeLanguagePanel() {

View File

@ -197,30 +197,7 @@ class SettingsPage {
clearInterval(this.liveAnalysisPollTimer);
this.liveAnalysisPollTimer = null;
if (presentation.complete) {
const mode = this.app.player?.settings?.languageDetectionMode || 'algo';
await this.app.channelList?.loadChannels({
refreshLanguages: mode !== 'laya' && mode !== 'hybrid'
});
if (mode === 'laya' || mode === 'hybrid') {
this.liveAnalysisStatus = {
status: 'building',
phase: 'laya_language',
languageProcessed: null,
languageTotal: null
};
this.renderLiveAnalysisStatus(this.liveAnalysisStatus);
await this.app.channelList?.refreshLayaLanguages(mode, {
onProgress: ({ processed, total }) => {
this.liveAnalysisStatus = {
status: 'building',
phase: 'laya_language',
languageProcessed: processed,
languageTotal: total
};
this.renderLiveAnalysisStatus(this.liveAnalysisStatus);
}
});
}
await this.app.channelList?.loadChannels();
this.liveAnalysisStatus = status;
this.renderLiveAnalysisStatus(status);
}
@ -272,11 +249,6 @@ class SettingsPage {
this.layaStatus = { runtimeAvailable: false, modelPresent: false, error: err.message };
}
this.renderLayaStatus(this.layaStatus);
const mode = this.app.player?.settings?.languageDetectionMode || 'algo';
if (mode !== 'algo' && this.layaStatus?.modelPresent && this.layaStatus?.runtimeAvailable &&
this.app.channelList?.languageDetectionNotice) {
void this.app.channelList.refreshLayaLanguages(mode);
}
if (this.layaStatus?.downloading) this.startLayaStatusPolling();
return this.layaStatus;
}