feat(anime screen):add auto play and auto select server

This commit is contained in:
Benex254
2024-08-05 09:46:57 +03:00
parent e6873bd590
commit 128d2429d3
3 changed files with 8 additions and 1 deletions

View File

@@ -1,4 +1,3 @@
from requests.models import StreamConsumedError
from ..libs.anilist import AniList
from .base_model import BaseScreenModel
from ..libs.anime_provider.allanime_api import anime_provider

View File

@@ -18,6 +18,7 @@
<AnimeScreenView>:
md_bg_color: self.theme_cls.backgroundColor
episodes_container:episodes_container
video_player:video_player
MDBoxLayout:
padding:"10dp"
orientation: 'vertical'
@@ -29,6 +30,7 @@
MDBoxLayout:
VideoPlayer:
id:video_player
source:root.current_link
AnimeBoxLayout:
padding: "20dp"

View File

@@ -25,6 +25,7 @@ class AnimeScreenView(BaseScreenView):
episodes_container = ObjectProperty()
total_episodes = 0
current_episode = 1
video_player = ObjectProperty()
def __init__(self, **kwargs):
super().__init__(**kwargs)
@@ -58,11 +59,16 @@ class AnimeScreenView(BaseScreenView):
def on_current_anime_data(self, instance, value):
self.current_episode = int("1")
self.update_current_video_stream("dropbox")
self.video_player.state = "play"
data = value["show"]
self.update_episodes(data["availableEpisodesDetail"]["sub"][::-1])
def update_current_episode(self, episode):
self.controller.fetch_streams(self.current_title, episode)
self.update_current_video_stream("dropbox")
self.video_player.state = "play"
def update_current_video_stream(self, server, is_dub=False):
for link in self.current_links: