fix(epg): open epg archives in external players

This commit is contained in:
4gray committed 2023-09-10 09:02:32 +02:00
1 parent e3c45bdf0b
commit 7db50a7bf3
1 file changed
+37
+37
View File
@@ -17,6 +17,7 @@ import {
CHANNEL_SET_USER_AGENT,
EPG_GET_PROGRAM,
OPEN_MPV_PLAYER,
OPEN_VLC_PLAYER,
} from '../../../shared/ipc-commands';
import { DataService } from '../services/data.service';
import { PlaylistsService } from '../services/playlists.service';
@@ -67,6 +68,42 @@ export class PlaylistEffects {
}
);
setActiveEpgProgram$ = createEffect(
() => {
return this.actions$.pipe(
ofType(PlaylistActions.setActiveEpgProgram),
combineLatestWith(this.store.select(selectActive)),
map(([, activeChannel]) => {
firstValueFrom(this.storage.get(STORE_KEY.Settings)).then(
(settings: Settings) => {
if (
settings &&
Object.keys(settings).length > 0 &&
settings.player === VideoPlayer.MPV
)
this.dataService.sendIpcEvent(OPEN_MPV_PLAYER, {
url:
activeChannel.url +
activeChannel.epgParams ?? '',
});
else if (
settings &&
Object.keys(settings).length > 0 &&
settings.player === VideoPlayer.VLC
)
this.dataService.sendIpcEvent(OPEN_VLC_PLAYER, {
url:
activeChannel.url +
activeChannel.epgParams ?? '',
});
}
);
})
);
},
{ dispatch: false }
);
setActiveChannel$ = createEffect(() => {
return this.actions$.pipe(
ofType(PlaylistActions.setActiveChannel),