renamed app to anixstream

This commit is contained in:
Benedict Xavier Wanyonyi
2024-05-31 18:12:02 +03:00
parent f24912fd1c
commit 7e9060bb2d
126 changed files with 47 additions and 57 deletions

View File

@@ -0,0 +1,28 @@
#:import color_text Utility.kivy_markup_helper.color_text
<TaskText@MDLabel>:
adaptive_height:True
max_lines:0
shorten:False
markup:True
font_style: "Label"
role: "large"
bold:True
<TaskCard>:
adaptive_height:True
radius:8
padding:"20dp"
md_bg_color:self.theme_cls.surfaceContainerHighColor
TaskText:
size_hint_x:.8
text:color_text(root.anime_task_name,root.theme_cls.primaryColor)
TaskText:
size_hint_x:.2
# color:self.theme_cls.surfaceDimColor
theme_text_color:"Secondary"
text:color_text(root.episodes_to_download,root.theme_cls.secondaryColor)
MDIcon:
icon:"download"

View File

@@ -0,0 +1,12 @@
from kivy.properties import StringProperty
from kivymd.uix.boxlayout import MDBoxLayout
# TODO: add a progress bar to show the individual progress of each task
class TaskCard(MDBoxLayout):
anime_task_name = StringProperty()
episodes_to_download = StringProperty()
def __init__(self, anime_title:str, episodes:str, *args, **kwargs):
super().__init__(*args, **kwargs)
self.anime_task_name = f"{anime_title}"
self.episodes_to_download = f"Episodes: {episodes}"

View File

@@ -0,0 +1,58 @@
#:import get_color_from_hex kivy.utils.get_color_from_hex
#:import StringProperty kivy.properties.StringProperty
<DownloadsScreenLabel@MDLabel>:
adaptive_height:True
max_lines:0
shorten:False
markup:True
font_style: "Label"
role: "large"
bold:True
<DownloadsScreenView>
md_bg_color: self.theme_cls.backgroundColor
main_container:main_container
download_progress_label:download_progress_label
progress_bar:progress_bar
MDBoxLayout:
NavRail:
screen:root
MDAnchorLayout:
anchor_y: 'top'
MDBoxLayout:
orientation: 'vertical'
SearchBar:
MDScrollView:
size_hint:.95,1
MDBoxLayout:
id:main_container
orientation:"vertical"
padding:"40dp"
pos_hint:{"center_x":.5}
spacing:"10dp"
adaptive_height:True
HeaderLabel:
text:"Download Tasks"
halign:"left"
MDIcon:
padding:"10dp"
pos_hint:{"center_y":.5}
icon:"clock"
MDBoxLayout:
size_hint_y:None
height:"40dp"
spacing:"10dp"
padding:"10dp"
md_bg_color:self.theme_cls.secondaryContainerColor
DownloadsScreenLabel:
id:download_progress_label
size_hint_x: .6
text:"Try Downloading sth :)"
pos_hint: {'center_y': .5}
MDLinearProgressIndicator:
id: progress_bar
size_hint_x: .4
size_hint_y:None
height:"10dp"
type: "determinate"
pos_hint: {'center_y': .5}

View File

@@ -0,0 +1,32 @@
from kivy.clock import Clock
from kivy.properties import ObjectProperty
from kivy.logger import Logger
from kivy.utils import format_bytes_to_human
from View.base_screen import BaseScreenView
from .components.task_card import TaskCard
class DownloadsScreenView(BaseScreenView):
main_container = ObjectProperty()
progress_bar = ObjectProperty()
download_progress_label = ObjectProperty()
def on_new_download_task(self, anime_title: str, episodes: str | None):
if not episodes:
episodes = "All"
Clock.schedule_once(
lambda _: self.main_container.add_widget(TaskCard(anime_title, episodes))
)
def on_episode_download_progress(
self, current_bytes_downloaded, total_bytes, episode_info
):
percentage_completion = round((current_bytes_downloaded / total_bytes) * 100)
progress_text = f"Downloading: {episode_info['anime_title']} - {episode_info['episode']} ({format_bytes_to_human(current_bytes_downloaded)}/{format_bytes_to_human(total_bytes)})"
if (percentage_completion % 5) == 0:
self.progress_bar.value = max(min(percentage_completion, 100), 0)
self.download_progress_label.text = progress_text
def update_layout(self, widget):
self.user_anime_list_container.add_widget(widget)