fix(ui): correct imports, guard checks, logging and settings handling

This commit is contained in:
4gray committed 2025-10-26 08:58:53 +01:00
1 parent b56519da4b
commit 9be8dce961
21 files changed
+238 -213

No files matched your search

+5 -7
View File
@@ -13,7 +13,6 @@ import {
Language,
OPEN_FILE,
Settings,
SETTINGS_UPDATE,
STORE_KEY,
Theme,
VIEW_ADD_PLAYLIST,
@@ -120,13 +119,12 @@ export class AppComponent implements OnInit, OnDestroy {
.getValueFromLocalStorage(STORE_KEY.Settings)
.subscribe((settings: Settings) => {
if (settings && Object.keys(settings).length > 0) {
// Send settings to Electron main process
if (window.electron) {
window.electron.updateSettings(settings);
}
// No need to send settings to Electron on init
// Settings are stored in IndexedDB and loaded by the settings store
// Only specific Electron settings (MPV/VLC paths) are sent when changed in settings component
this.translate.use(settings.language ?? this.DEFAULT_LANG);
// Fetch EPG if URLs are configured
if (
window.electron &&
@@ -252,16 +252,20 @@ export class SettingsComponent implements OnInit {
onSubmit(): void {
this.settingsStore.updateSettings(this.settingsForm.value).then(() => {
this.applyChangedSettings();
if (window.electron) {
window.electron.updateSettings(this.settingsForm.value);
// Set player paths if using external players
if (this.settingsForm.value.mpvPlayerPath) {
window.electron.setMpvPlayerPath(this.settingsForm.value.mpvPlayerPath);
window.electron.setMpvPlayerPath(
this.settingsForm.value.mpvPlayerPath
);
}
if (this.settingsForm.value.vlcPlayerPath) {
window.electron.setVlcPlayerPath(this.settingsForm.value.vlcPlayerPath);
window.electron.setVlcPlayerPath(
this.settingsForm.value.vlcPlayerPath
);
}
}
});
@@ -1,4 +1,4 @@
@if ((activeProcesses$ | async)?.length) {
<!-- @if ((activeProcesses$ | async)?.length) {
<div class="mpv-player-bar">
@for (process of activeProcesses$ | async; track process.id) {
<div class="player-item">
@@ -24,20 +24,6 @@
</div>
</div>
<div class="player-controls">
<!-- <button
mat-icon-button
(click)="pauseStream(process.id)"
title="Pause"
>
<mat-icon>pause</mat-icon>
</button>
<button
mat-icon-button
(click)="playStream(process.id)"
title="Play"
>
<mat-icon>play_arrow</mat-icon>
</button> -->
<button
mat-icon-button
(click)="closeStream(process.id)"
@@ -50,3 +36,4 @@
}
</div>
}
-->
@@ -1,30 +1,19 @@
import { CommonModule } from '@angular/common';
import { Component } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { Observable } from 'rxjs';
import {
MpvPlayerService,
MpvProcess,
} from '../../services/mpv-player.service';
@Component({
imports: [CommonModule, MatIconModule, MatButtonModule],
/* imports: [MatIcon, MatIconButton], */
selector: 'app-mpv-player-bar',
templateUrl: './mpv-player-bar.component.html',
styleUrls: ['./mpv-player-bar.component.scss']
styleUrls: ['./mpv-player-bar.component.scss'],
})
export class MpvPlayerBarComponent {
activeProcesses$: Observable<MpvProcess[]>;
constructor(private mpvPlayerService: MpvPlayerService) {
this.activeProcesses$ = this.mpvPlayerService.activeProcesses$;
}
/* private mpvPlayerService = inject(MpvPlayerService);
activeProcesses$ = this.mpvPlayerService.activeProcesses$;
async closeStream(processId: number): Promise<void> {
await this.mpvPlayerService.closeStream(processId);
}
} */
/* async playStream(processId: number): Promise<void> {
await this.mpvPlayerService.playStream(processId);
}
@@ -1,4 +1,4 @@
import { Injectable } from '@angular/core';
/* import { Injectable } from '@angular/core';
import { invoke } from '@tauri-apps/api/core';
import { listen } from '@tauri-apps/api/event';
import { BehaviorSubject } from 'rxjs';
@@ -75,3 +75,4 @@ export class MpvPlayerService {
await invoke('close_mpv_process', { processId });
}
}
*/