Open Ivshti opened 5 years ago
All of the redirects that stremio-models/utils/open.js
is responsible for must be handled using the deep_links mod. The only one thats not handled yet is the binge watching redirect. If there are others that are still not handled they must be listed here.
recommend_open_url should be a model. Possible structure of this model could be:
pub enum OpenUrlResult {
DeepLink(Url),
Addon(DescriptorLoadable),
Stream(Stream),
}
pub struct OpenUrl {
pub selected: Option<Url>,
pub content: OpenUrlResult,
}
if the selected url starts with stremio:// protocol, it resolves as OpenUrlResult::DeepLink if fetching the selected url returns an addon manifest, it resolves as OpenUrlResult::Addon if none of the above matches then we interpred it as stream and we try to play it.
will result in:
Event::RecommendedAction{ origin: Action, recommendation: Action }
orEvent::RecommendationFailed
Useful for Open and TryOpenURL
Should be defined in a separate module as Effects
recommend_open(args, addons, settings)
- equivalent ofstremio-models/utils/open.js
- needs addons to get streams, and settings cause of bingeing; args should be a sum type of libItem/metaPreview/notifItem, along with intent, prevStreamBinge and videorecommend_open_url(url, ctx)
, equivalent ofopen-files.js
:ctx.addons
(local addon must be there);ctx.settings
are also required to know the URL of the streaming serverIn recommend_open_item, To get the last played stream, which is normally managed by the player, we will just read the storage directly We should pull the libaddon item from the API; if it’s newer, we should start playing the newer version
Opening subtitles must be handled by recommending a player action that will load them (addExtraSubtitles); the playerM will see this and remember them in PlayerPreferences, so it can add them again on next load
NOTE: we may drop the
recommend_
from the name; just having this in the resulting actions will be OKNOTE: because this has a loading state, it might need to be a Model
NOTE: streams will be auto-selected if there's one
video.streams
or ifbehaviorHints.bingeGroup
matches withprevStreamBinge
or ifinfoHash
matches withprevStreamBinge
as you can see here https://github.com/Stremio/stremio-models/blob/master/utils/open.js#L96IMPORTANT: this is the code that will have to generate a temporary
libItem
, so make sure that the data is anonymized (a file name/path is not included)