OpenRoadCode
Public API reference for OpenRoadCode
Loading...
Searching...
No Matches
video.netflix_player.NetflixPlayer Class Reference

Own a dedicated retained browser lifecycle for Netflix presentation. More...

Public Member Functions

None __init__ (self, *, str|Path profile_path=DEFAULT_NETFLIX_PROFILE_PATH, tuple[str,...] browser_candidates=("google-chrome", "google-chrome-stable", "chromium", "chromium-browser",), bool software_rendering=False, bool dark_mode=False)
 Configure a Netflix player.
bool play (self, str url, *, str display, tuple[int, int]|None window_position=None, tuple[int, int]|None window_size=None)
 Open a Netflix URL on the requested display.
None stop (self)
 Stop the browser process owned by this player.
bool is_active (self)
 Return whether the owned Netflix browser process is running.
"NetflixPlayer" __enter__ (self)
 Return this player for context-managed lifecycle.
None __exit__ (self, exception_type, exception, traceback)
 Stop playback when leaving a context-managed lifecycle.

Static Public Member Functions

str validate_url (str url)
 Validate a direct Netflix HTTPS URL.

Detailed Description

Own a dedicated retained browser lifecycle for Netflix presentation.

Constructor & Destructor Documentation

◆ __init__()

None video.netflix_player.NetflixPlayer.__init__ ( self,
* ,
str | Path profile_path = DEFAULT_NETFLIX_PROFILE_PATH,
tuple[str, ...] browser_candidates = (             "google-chrome",             "google-chrome-stable",             "chromium",             "chromium-browser",         ),
bool software_rendering = False,
bool dark_mode = False )

Configure a Netflix player.

Parameters
profile_pathPersistent browser profile used for Netflix sessions.
browser_candidatesBrowser executables in preference order.
software_renderingDisable GPU paths for compatibility when true.
dark_modeRequest browser dark presentation when true.

Member Function Documentation

◆ play()

bool video.netflix_player.NetflixPlayer.play ( self,
str url,
* ,
str display,
tuple[int, int] | None window_position = None,
tuple[int, int] | None window_size = None )

Open a Netflix URL on the requested display.

Parameters
urlDirect Netflix HTTPS URL.
displayX11 display used by the browser.
window_positionOptional initial X/Y position.
window_sizeOptional initial width/height.
Returns
True after the browser launch request succeeds.

◆ validate_url()

str video.netflix_player.NetflixPlayer.validate_url ( str url)
static

Validate a direct Netflix HTTPS URL.

Parameters
urlCandidate Netflix URL.
Returns
Trimmed validated URL.
Exceptions
ValueErrorWhen the URL is non-HTTPS or outside Netflix.

The documentation for this class was generated from the following file:
  • controllers/video/netflix_player.py