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

Resolve suggested stream in meta details model #527

Merged
merged 9 commits into from
Nov 7, 2023

Conversation

TheBeastLT
Copy link
Contributor

This PR adds a new field to meta details model - suggested_stream. This field finds a stream from addon responses, which should be highlighted or played if binge watching.
The logic is that we find the latest StreamItem stored based on last 30 videos from current video (ie. we're in E4, so we're going to check E4, E3, E2, E1 in this order until we hit a stored StreamItem). Then with the stream item we try to find a stream from addon responses (including the streams inside the meta itself meta_streams) - we find the responses from the addon based on StreamItem.stream_transport_url, then first we try to find the stream based on equality (as otherwise stored stream might be expired/no longer valid), if not found we try to find a stream based on it's bingeGroup.
One note, why we cannot return StreamItem.stream directly if it's for the same episode, is that user might have played a stream from an addon which he no longer has due to some constrains (ie p2p addon), that's why we have to try to find it first and verify that's it's still available.

@TheBeastLT TheBeastLT requested a review from elpiel September 26, 2023 15:34
Copy link
Member

@elpiel elpiel left a comment

Choose a reason for hiding this comment

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

LGTM so far, I need to run some tests - a suitable test case scenario would be appreciated.

Just to confirm what is expected with this change:
In a nutshell, suggested stream tries to find a StreamItem for the past 30 episodes and if it find one it tries to find the same Base url (or simply put, stream from the same Addon) in the meta_streams & streams of the MetaDetails.

Can you briefly share what is the usecase for this suggested stream?

src/models/meta_details.rs Show resolved Hide resolved
src/models/meta_details.rs Show resolved Hide resolved
Copy link
Member

@elpiel elpiel left a comment

Choose a reason for hiding this comment

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

Code looks good to me, I will make sure to figure out a test-case to test it.

@elpiel elpiel mentioned this pull request Oct 13, 2023
Copy link
Member

@elpiel elpiel left a comment

Choose a reason for hiding this comment

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

Tested and works on web.
When there's an older episode with different stream - it chooses it.
For new and older episodes which are not watched it chooses (given the right binge watching ground and a stream for a full season) the correct suggested stream

@elpiel elpiel merged commit 9cac832 into development Nov 7, 2023
1 check passed
@elpiel elpiel deleted the feature/suggested-stream-for-meta-details branch November 7, 2023 06:54
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