Skip to content

feat: add PotPlayer support#823

Open
hendy643 wants to merge 4 commits into4gray:masterfrom
hendy643:feat/potplayer_support
Open

feat: add PotPlayer support#823
hendy643 wants to merge 4 commits into4gray:masterfrom
hendy643:feat/potplayer_support

Conversation

@hendy643
Copy link
Copy Markdown

  • Implemented IPC commands for opening and setting the path for PotPlayer.
  • Added PotPlayer as a video player option in settings and player services.
  • Enhanced the settings component to allow users to specify the PotPlayer path.
  • Updated internationalization files to include PotPlayer labels and descriptions.
  • Modified the external player session interface to support PotPlayer.
  • Updated the effects and services to handle PotPlayer interactions.

- Implemented IPC commands for opening and setting the path for PotPlayer.
- Added PotPlayer as a video player option in settings and player services.
- Enhanced the settings component to allow users to specify the PotPlayer path.
- Updated internationalization files to include PotPlayer labels and descriptions.
- Modified the external player session interface to support PotPlayer.
- Updated the effects and services to handle PotPlayer interactions.
Copilot AI review requested due to automatic review settings March 15, 2026 15:48
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Mar 15, 2026

Greptile Summary

This PR adds PotPlayer as a fourth external video player option in IPTVnator (joining MPV, VLC, and the embedded ArtPlayer). It wires the full integration stack: IPC commands, preload bridge, electron service dispatch, player/effects services, settings UI (Windows-only), signal store, shared interfaces, and i18n strings for 17 locales.

Key observations:

  • HTTP metadata not forwarded to PotPlayer: The OPEN_POTPLAYER IPC handler accepts userAgent, referer, origin, headers, and startTime but the spawn call only passes the bare URL. Streams that require custom HTTP headers or a specific User-Agent for authentication will fail silently when PotPlayer is selected, unlike VLC which builds a rich argument list.
  • Belarusian (by.json) translation uses wrong language: The new POTPLAYER_PATH_DESCRIPTION is in Russian and the label uses the Ukrainian preposition "до" instead of the Belarusian "да", inconsistent with the correctly-translated VLC strings already in that file.
  • The Windows-only guard (isWindowsDesktop) correctly prevents PotPlayer from appearing in settings on non-Windows platforms.
  • Session lifecycle (open/error/close), error notifications, path resolution with fallback to known Windows install locations, and form persistence all follow established patterns from the VLC implementation.

Confidence Score: 3/5

  • Safe to merge for users on standard streams, but streams requiring custom HTTP headers or a specific User-Agent will silently fail with PotPlayer selected.
  • The integration is structurally sound and follows existing patterns throughout the codebase. The primary concern is a functional gap: accepted parameters (userAgent, referer, origin, headers, startTime) are not forwarded to PotPlayer, which will silently break header-protected streams. The Belarusian translation bug is minor. No security issues or crashes identified for the normal Windows use-case.
  • apps/electron-backend/src/app/events/player.events.ts (OPEN_POTPLAYER handler — HTTP metadata handling), apps/web/src/assets/i18n/by.json (incorrect language used for new strings)

Important Files Changed

Filename Overview
apps/electron-backend/src/app/events/player.events.ts Adds OPEN_POTPLAYER IPC handler and SET_POTPLAYER_PATH handler. The handler correctly manages sessions and error states but silently ignores all stream metadata (user-agent, referer, origin, custom headers, startTime) — only the URL is forwarded to the spawned PotPlayer process.
apps/electron-backend/src/app/api/main.preload.ts Adds openInPotPlayer and setPotPlayerPath IPC bridge methods. Mirrors existing patterns for VLC/MPV correctly.
apps/web/src/app/services/electron.service.ts Adds OPEN_POTPLAYER IPC dispatch block following the same pattern as the existing VLC handler. Error handling and snackbar notification are correctly implemented.
apps/web/src/app/services/player.service.ts Correctly adds PotPlayer branch to openResolvedPlayback, dispatching OPEN_POTPLAYER event. Test file also updated.
apps/web/src/app/settings/settings.component.ts Adds isWindowsDesktop guard, conditionally includes PotPlayer in the player options list, adds potPlayerPath form control, and calls setPotPlayerPath on submit. Settings are correctly persisted via patchValue on load.
libs/shared/interfaces/src/lib/settings.interface.ts Adds VideoPlayer.PotPlayer enum value and potPlayerPath property to Settings interface. Straightforward.
libs/services/src/lib/settings-store.service.ts Adds potPlayerPath to DEFAULT_SETTINGS and getSettings() return. Clean integration with existing signal store.
apps/web/src/assets/i18n/by.json New PotPlayer strings are written in Russian and Ukrainian rather than Belarusian, inconsistent with the existing correctly-translated entries in the same file.

Sequence Diagram

sequenceDiagram
    participant User
    participant SettingsUI as Settings Component
    participant EffectsOrPlayer as Effects / PlayerService
    participant ElectronSvc as ElectronService
    participant Preload as main.preload.ts
    participant Backend as player.events.ts (IPC)
    participant PotPlayer as PotPlayer Process

    User->>SettingsUI: Select PotPlayer (Windows only)
    SettingsUI->>Backend: setPotPlayerPath via IPC (SET_POTPLAYER_PATH)
    Backend->>Backend: store.set(POTPLAYER_PATH, path)

    User->>EffectsOrPlayer: Play channel
    EffectsOrPlayer->>ElectronSvc: sendIpcEvent(OPEN_POTPLAYER, payload)
    ElectronSvc->>Preload: window.electron.openInPotPlayer(url, title, ...)
    Preload->>Backend: ipcRenderer.invoke('OPEN_POTPLAYER', url, ...)
    Backend->>Backend: beginSession(), getPotPlayerPath()
    Backend->>PotPlayer: spawn(potPlayerPath, [url])
    Note over Backend,PotPlayer: userAgent/referer/headers/startTime NOT forwarded
    PotPlayer-->>Backend: proc 'exit' event
    Backend->>Backend: markClosed(session.id)
    Backend-->>Preload: ExternalPlayerSession
    Preload-->>ElectronSvc: ExternalPlayerSession
    ElectronSvc-->>EffectsOrPlayer: ExternalPlayerSession
Loading

Comments Outside Diff (2)

  1. apps/electron-backend/src/app/events/player.events.ts, line 1026 (link)

    HTTP headers, user-agent, referer, and start time are silently ignored

    The OPEN_POTPLAYER handler accepts userAgent, referer, origin, headers, and startTime as parameters, but the args array passed to spawn contains only the URL. All of the stream-level metadata is silently dropped.

    This means channels that require a custom User-Agent (e.g. Xtream-coded streams), a Referer header, or an HTTP origin will not authenticate or load correctly when played through PotPlayer. By contrast, the VLC handler builds a rich argument list that passes --http-user-agent, --http-referrer, and header overrides.

    PotPlayer 230+ supports passing these via its /open CLI flag or an .m3u/.pls playlist wrapper that can include #EXTVLCOPT-style directives. At a minimum, this limitation should be documented in a comment so users are not confused when header-protected streams fail.

    // Current implementation – all metadata is dropped:
    const args = [url];
    
    // Consider at least passing user-agent, e.g.:
    // const args = [url, ...(userAgent ? [`/useragent`, userAgent] : [])];
    // Note: PotPlayer's CLI support for HTTP headers is limited.
  2. apps/web/src/assets/i18n/by.json, line 542-544 (link)

    Wrong language used in Belarusian translation

    The new POTPLAYER_PATH_LABEL and POTPLAYER_PATH_DESCRIPTION strings are not in Belarusian. POTPLAYER_PATH_DESCRIPTION is in Russian ("Установите путь…"), and POTPLAYER_PATH_LABEL / POTPLAYER_PATH use the Ukrainian preposition "до" instead of the Belarusian "да".

    Compare the existing (correct) entry in the same file:

    • VLC_PLAYER_PATH_DESCRIPTION: "Усталюйце шлях да прайгравальніка VLC у вашай сістэме…" ← proper Belarusian

    The new entries should follow the same pattern:

Prompt To Fix All With AI
This is a comment left during a code review.
Path: apps/electron-backend/src/app/events/player.events.ts
Line: 1026

Comment:
**HTTP headers, user-agent, referer, and start time are silently ignored**

The `OPEN_POTPLAYER` handler accepts `userAgent`, `referer`, `origin`, `headers`, and `startTime` as parameters, but the `args` array passed to `spawn` contains only the URL. All of the stream-level metadata is silently dropped.

This means channels that require a custom `User-Agent` (e.g. Xtream-coded streams), a `Referer` header, or an HTTP origin will not authenticate or load correctly when played through PotPlayer. By contrast, the VLC handler builds a rich argument list that passes `--http-user-agent`, `--http-referrer`, and header overrides.

PotPlayer 230+ supports passing these via its `/open` CLI flag or an `.m3u`/`.pls` playlist wrapper that can include `#EXTVLCOPT`-style directives. At a minimum, this limitation should be documented in a comment so users are not confused when header-protected streams fail.

```typescript
// Current implementation – all metadata is dropped:
const args = [url];

// Consider at least passing user-agent, e.g.:
// const args = [url, ...(userAgent ? [`/useragent`, userAgent] : [])];
// Note: PotPlayer's CLI support for HTTP headers is limited.
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: apps/web/src/assets/i18n/by.json
Line: 542-544

Comment:
**Wrong language used in Belarusian translation**

The new `POTPLAYER_PATH_LABEL` and `POTPLAYER_PATH_DESCRIPTION` strings are not in Belarusian. `POTPLAYER_PATH_DESCRIPTION` is in Russian ("Установите путь…"), and `POTPLAYER_PATH_LABEL` / `POTPLAYER_PATH` use the Ukrainian preposition "до" instead of the Belarusian "да".

Compare the existing (correct) entry in the same file:
- `VLC_PLAYER_PATH_DESCRIPTION`: "Усталюйце шлях **да** прайгравальніка VLC **у вашай сістэме**…" ← proper Belarusian

The new entries should follow the same pattern:

```suggestion
        "POTPLAYER_PATH_LABEL": "Шлях да PotPlayer",
        "POTPLAYER_PATH": "Шлях да PotPlayer",
        "POTPLAYER_PATH_DESCRIPTION": "Усталюйце шлях да прайгравальніка PotPlayer у вашай сістэме. \nЁн будзе выкарыстоўваць прадастаўлены шлях да бінарнага файла PotPlayer замест шляху па змаўчанні."
```

How can I resolve this? If you propose a fix, please make it concise.

Last reviewed commit: "resolved more issues..."

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds PotPlayer as a new external video player option for the Electron desktop app, including IPC wiring, settings persistence defaults, and UI/i18n updates.

Changes:

  • Extend shared interfaces/settings to include PotPlayer and a configurable PotPlayer binary path.
  • Add new IPC commands + renderer/electron-backend handlers to launch streams in PotPlayer.
  • Update Settings UI and multiple locale files for the new PotPlayer path fields and player selection label.

Reviewed changes

Copilot reviewed 31 out of 32 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
libs/shared/interfaces/src/lib/settings.interface.ts Adds VideoPlayer.PotPlayer and potPlayerPath to the Settings model.
libs/shared/interfaces/src/lib/ipc-commands.ts Introduces OPEN_POTPLAYER and SET_POTPLAYER_PATH IPC command constants.
libs/shared/interfaces/src/lib/external-player-session.interface.ts Extends ExternalPlayerName union to include potplayer.
libs/services/src/lib/settings-store.service.ts Adds potPlayerPath to default settings.
libs/m3u-state/src/lib/effects.ts Sends OPEN_POTPLAYER IPC events when PotPlayer is selected in settings.
global.d.ts Extends window.electron typings with PotPlayer APIs.
apps/web/src/assets/i18n/zhtw.json Adds PotPlayer path strings (Traditional Chinese).
apps/web/src/assets/i18n/zh.json Adds PotPlayer path strings (Simplified Chinese).
apps/web/src/assets/i18n/tr.json Adds PotPlayer path strings (Turkish).
apps/web/src/assets/i18n/ru.json Adds PotPlayer path strings (Russian).
apps/web/src/assets/i18n/pt.json Adds PotPlayer path strings (Portuguese).
apps/web/src/assets/i18n/pl.json Adds PotPlayer path strings (Polish).
apps/web/src/assets/i18n/nl.json Adds PotPlayer path strings (Dutch).
apps/web/src/assets/i18n/ko.json Adds PotPlayer path strings (Korean).
apps/web/src/assets/i18n/ja.json Adds PotPlayer path strings (Japanese).
apps/web/src/assets/i18n/it.json Adds PotPlayer path strings (Italian).
apps/web/src/assets/i18n/fr.json Adds PotPlayer path strings (French).
apps/web/src/assets/i18n/es.json Adds PotPlayer player-name + path strings (Spanish).
apps/web/src/assets/i18n/en.json Adds PotPlayer player-name + path strings (English).
apps/web/src/assets/i18n/el.json Adds PotPlayer path strings (Greek).
apps/web/src/assets/i18n/de.json Adds PotPlayer path strings (German).
apps/web/src/assets/i18n/by.json Adds PotPlayer path strings and fixes trailing comma (Belarusian).
apps/web/src/assets/i18n/ary.json Adds PotPlayer path strings (Moroccan Arabic).
apps/web/src/assets/i18n/ar.json Adds PotPlayer path strings (Arabic).
apps/web/src/app/settings/settings.component.ts Adds PotPlayer as a selectable external player and adds potPlayerPath to the form model.
apps/web/src/app/settings/settings.component.html Adds PotPlayer path input shown when PotPlayer is selected.
apps/web/src/app/services/player.service.ts Adds PotPlayer external launch branch calling OPEN_POTPLAYER.
apps/web/src/app/services/player.service.spec.ts Updates embedded-player classification test to include PotPlayer.
apps/web/src/app/services/electron.service.ts Adds renderer-side handling for OPEN_POTPLAYER IPC event.
apps/electron-backend/src/app/services/store.service.ts Adds POTPLAYER_PATH key to electron-conf store typing/constants.
apps/electron-backend/src/app/events/player.events.ts Implements OPEN_POTPLAYER / SET_POTPLAYER_PATH IPC handlers and default path resolution.
apps/electron-backend/src/app/api/main.preload.ts Exposes openInPotPlayer and setPotPlayerPath via the preload bridge.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread libs/services/src/lib/settings-store.service.ts
Comment thread apps/web/src/app/settings/settings.component.ts Outdated
Comment thread apps/web/src/app/settings/settings.component.ts
Comment thread apps/web/src/app/settings/settings.component.ts Outdated
Comment thread apps/electron-backend/src/app/events/player.events.ts Outdated
Comment thread apps/electron-backend/src/app/events/player.events.ts Outdated
Comment thread apps/web/src/app/services/player.service.ts
Comment thread apps/web/src/assets/i18n/zhtw.json Outdated
@hendy643 hendy643 marked this pull request as draft March 19, 2026 22:12
@hendy643 hendy643 marked this pull request as ready for review March 19, 2026 22:12
@hendy643 hendy643 requested a review from Copilot March 19, 2026 22:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds PotPlayer as a supported external video player (Windows/Electron) across the shared contracts, renderer settings/player launch flow, and Electron main-process IPC handling.

Changes:

  • Extend shared settings + IPC contracts to include PotPlayer and its configurable binary path.
  • Add PotPlayer option to the Settings UI (Windows desktop only) and propagate the configured path to Electron.
  • Implement PotPlayer launch handling end-to-end (NgRx effects / PlayerService → renderer IPC routing → Electron preload + main-process spawn).

Reviewed changes

Copilot reviewed 32 out of 33 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
libs/shared/interfaces/src/lib/settings.interface.ts Adds VideoPlayer.PotPlayer and potPlayerPath to shared settings contract.
libs/shared/interfaces/src/lib/ipc-commands.ts Introduces OPEN_POTPLAYER and SET_POTPLAYER_PATH IPC command constants.
libs/shared/interfaces/src/lib/external-player-session.interface.ts Extends external player session name union to include potplayer.
libs/services/src/lib/settings-store.service.ts Adds default + persistence plumbing for potPlayerPath.
libs/playlist/m3u/feature-player/src/lib/video-player/video-player.component.ts Treats PotPlayer as an “external player” in player logic.
libs/m3u-state/src/lib/effects.ts Adds PotPlayer handling for “open in external player” flows.
global.d.ts Extends window.electron typing with PotPlayer APIs (open + set path).
apps/web/src/assets/i18n/zhtw.json Adds PotPlayer path labels/descriptions (zhtw).
apps/web/src/assets/i18n/zh.json Adds PotPlayer path labels/descriptions (zh).
apps/web/src/assets/i18n/tr.json Adds PotPlayer path labels/descriptions (tr).
apps/web/src/assets/i18n/ru.json Adds PotPlayer player label + path labels/descriptions (ru).
apps/web/src/assets/i18n/pt.json Adds PotPlayer path labels/descriptions (pt).
apps/web/src/assets/i18n/pl.json Adds PotPlayer path labels/descriptions (pl).
apps/web/src/assets/i18n/nl.json Adds PotPlayer path labels/descriptions (nl).
apps/web/src/assets/i18n/ko.json Adds PotPlayer path labels/descriptions (ko).
apps/web/src/assets/i18n/ja.json Adds PotPlayer path labels/descriptions (ja).
apps/web/src/assets/i18n/it.json Adds PotPlayer player label + path labels/descriptions (it).
apps/web/src/assets/i18n/fr.json Adds PotPlayer path labels/descriptions (fr).
apps/web/src/assets/i18n/es.json Adds PotPlayer player label + path labels/descriptions (es).
apps/web/src/assets/i18n/en.json Adds PotPlayer player label + path labels/descriptions (en).
apps/web/src/assets/i18n/el.json Adds PotPlayer path labels/descriptions (el).
apps/web/src/assets/i18n/de.json Adds PotPlayer player label + path labels/descriptions (de).
apps/web/src/assets/i18n/by.json Adds PotPlayer path labels/descriptions (by) and fixes JSON comma.
apps/web/src/assets/i18n/ary.json Adds PotPlayer path labels/descriptions (ary).
apps/web/src/assets/i18n/ar.json Adds PotPlayer path labels/descriptions (ar).
apps/web/src/app/settings/settings.component.ts Shows PotPlayer as a player option on Windows desktop; adds potPlayerPath control and saves it to Electron.
apps/web/src/app/settings/settings.component.html Adds PotPlayer path field UI when PotPlayer is selected.
apps/web/src/app/services/player.service.ts Adds PotPlayer external-launch branch via OPEN_POTPLAYER.
apps/web/src/app/services/player.service.spec.ts Extends embedded-player classification test to include PotPlayer.
apps/web/src/app/services/electron.service.ts Routes OPEN_POTPLAYER through preload openInPotPlayer and adds error handling.
apps/electron-backend/src/app/services/store.service.ts Adds POTPLAYER_PATH persistence key to Electron store.
apps/electron-backend/src/app/events/player.events.ts Implements OPEN_POTPLAYER spawn + SET_POTPLAYER_PATH handler; adds default path discovery.
apps/electron-backend/src/app/api/main.preload.ts Exposes openInPotPlayer and setPotPlayerPath in the preload bridge.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/web/src/app/services/player.service.ts
Comment thread libs/playlist/m3u/feature-player/src/lib/video-player/video-player.component.ts Outdated
…ayer.component.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants