Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings model and structs #49

Open
Ivshti opened this issue Jun 5, 2019 · 1 comment
Open

Settings model and structs #49

Ivshti opened this issue Jun 5, 2019 · 1 comment
Assignees
Labels
enhancement New feature or request spec
Milestone

Comments

@Ivshti
Copy link
Member

Ivshti commented Jun 5, 2019

Settings can be stored in 4 places: localStorage, user, addonCollection, server

The Context model should only handle the ones that are in localStorage by default; settings that are specific to the environment (e.g. MPV settings) should be handled externally (in this example, by the player implementation) and hooked up on application level

ContextSettings: struct, stored in localStorage

Managed by the Context model, and indirectly by Settings model

It will contain:

  • language: preferred language
  • autoplay_next_vid: binge watching
  • server_url: default URL for the streaming server
  • use_external_player: use external player by default; perhaps this should be a device ID/type, so that it can work for Chromecast
  • player_esc_exits_fullscreen: this is not in the player settings cause it affects UI behavior in general
  • pause_on_lost_focus: whether to pause on minimize/lost focus; alternatively could be renamed to play_in_background
  • show_vid_overview: whether the video overview/synopsis will be readable by the user

ServerSettings: a struct filled with dynamic data, loaded/saved from/to the server

Managed by the Settings model

NOTE: because of the dynamic nature, we might not need a struct but rather a model that will load the settings types/values from the server

The server settings will be accessed from the server at URL ctx.settings.server_url

In practice, those settings are:

  • server_cache_location
  • server_cache_size
  • server_torrent_profile

However, those will be loaded dynamically from the server, along with the possible options, as they are in 4.x

WARNING: the ServerSettings may be replaced by streaming server as a protocol addon and addonSettings

PlayerSettings: struct, stored in localStorage

Managed by the Player model, which also manages PlayerPreferences and sends the settings/preferences to the implementation

The settings are:

  • subtitles_language: default subtitles language
  • subtitles_size
  • subtitles_fgcolor
  • subtitles_outline_color
  • subtitles_background

Those will be sent to the implementation through the Load player command. Not every implementation will support all of those

MPV settings

Managed (saved/loaded) by the mpv implementation:

  • player_mpv_hwdec
  • player_mpv_cache_size
  • player_mpv_separate_window

Addon settings

Managed by the Settings model

Auto play: this will be an autoplay flag for each addon in the collection; that, combined with the order of the addons in the collection, will determine autoplay behavior; the flag may contain details, such as { onlyGroups: ["hd"] } (more about groups: https://github.com/Stremio/stremio/issues/524)

Settings model

this model makes managing all settings convenient, including the server settings and add-on settings (preferred add-on and etc.)

This includes:

  • saving/loading ServerSettings to/from the server
  • managing add-on flags in order to set preferences

It might need to issue messages that will be handled in the Context model (e.g. UpdateSettings or ActionAddon::Install/ActionAddon::Update)

SettingsUI trait

A helper trait to describe a settings struct in the UI

The server settings are described dynamically by it. We may define this behavior as a trait so that player implementations can use this to enable the Settings model to easily control their settings too


To implement this, we can:

  • add a Settings struct to the Ctx under the settings property
  • Environment-specific settings: player implementations will manage their own settings OR this dynamic map would support nesting other maps into it, and we can use that for player-specific settings (e.g. player_mpv key) that will only be sent to the relative player implementation
  • the settings structs (ContextSettings, PlayerSettings) will have static properties (like autoplay settings) and if needed (see above), a field that holds everything else as a serde_json::Value or HashMap<String, Any>; serialize/deserialize will be done that way (see "capture additional fields")
@Ivshti Ivshti changed the title ContextM: settings Context: settings Jun 12, 2019
@Ivshti Ivshti added this to the v1.0 milestone Jul 27, 2019
@Ivshti Ivshti changed the title Context: settings Settings Aug 11, 2019
@Ivshti Ivshti self-assigned this Aug 11, 2019
@Ivshti Ivshti added the enhancement New feature or request label Aug 11, 2019
@Ivshti Ivshti changed the title Settings Settings model and structs Aug 11, 2019
@Ivshti Ivshti added the spec label Sep 17, 2019
@Ivshti Ivshti assigned nklhtv and unassigned Ivshti Jan 3, 2020
@nklhtv
Copy link
Contributor

nklhtv commented Jun 8, 2022

ContextSettings & PlayerSettings are added inside the ctx.profile and are managed by the Ctx
server settings are managed by separate model, StreamingServer
Addon & Mpv settings are not implemented

elpiel added a commit that referenced this issue Jun 14, 2024
ci: add linting and improve build/release times
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request spec
Projects
None yet
Development

No branches or pull requests

2 participants