feat:added app icon and default images

This commit is contained in:
Benex254
2024-08-05 09:46:54 +03:00
parent 4896be5814
commit 853dc6e583
16 changed files with 29 additions and 14 deletions

View File

@@ -10,10 +10,16 @@ class AnimdlConfig(TypedDict):
default_provider: str
quality_string: str
print(os.getenv("LOCALAPPDATA"))
if local_data_path:=os.getenv("LOCALAPPDATA"):
config_dir = os.path.join(local_data_path,".config")
if not os.path.exists(config_dir):
os.mkdir(config_dir)
animdl_config_folder_location = os.path.join(config_dir, ".animdl")
else:
user_profile_path = plyer.storagepath.get_home_dir() # type: ignore
animdl_config_folder_location = os.path.join(user_profile_path, ".animdl")
user_profile_path = plyer.storagepath.get_home_dir() # type: ignore
animdl_config_folder_location = os.path.join(user_profile_path, ".animdl")
if not os.path.exists(animdl_config_folder_location):
os.mkdir(animdl_config_folder_location)

View File

@@ -216,7 +216,6 @@ class MediaCardDataLoader(object):
for i in range(stars):
media_card.stars[i] = 1
# TODO: ADD a default image if trailer not available
# Setting up trailer info to be gotten if available
if anime_item["trailer"]:
yt_watch_link = "https://youtube.com/watch?v=" + anime_item["trailer"]["id"]

View File

@@ -5,12 +5,13 @@ Contains Helper functions to read and write the user data files
from kivy.storage.jsonstore import JsonStore
from datetime import date, datetime
from kivy.logger import Logger
from kivy.resources import resource_find
today = date.today()
now = datetime.now()
user_data = JsonStore("user_data.json")
yt_cache = JsonStore("yt_cache.json")
user_data = JsonStore(resource_find("user_data.json"))
yt_cache = JsonStore(resource_find("yt_cache.json"))
# Get the user data

View File

@@ -42,8 +42,8 @@ class AnimeScreenView(BaseScreenView):
# update header
self.header.titles = f"{english_title}\n{jp_title}"
if banner_image := data["bannerImage"]:
self.header.banner_image = banner_image
# if banner_image := data["bannerImage"]:
self.header.banner_image = data["bannerImage"]
# -----side bar-----

View File

@@ -16,5 +16,5 @@
FitImage:
size_hint_y: None
height: dp(250)
source:root.banner_image
source: root.banner_image if root.banner_image else app.default_banner_image

View File

@@ -28,7 +28,7 @@
MediaPopupVideoPlayer:
id:player
source:root.caller.trailer_url
preview:root.caller.preview_image
preview:app.default_anime_image
state:"play" if root.caller.trailer_url else "stop"
fit_mode:"fill"
size_hint_y: None

BIN
app/assets/banner.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
app/assets/banner_1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 KiB

BIN
app/assets/default.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
app/assets/default_1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

BIN
app/assets/logo.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

BIN
app/assets/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

View File

@@ -1,4 +1,5 @@
import os
import random
os.environ["KIVY_VIDEO"] = "ffpyplayer"
@@ -10,10 +11,16 @@ import webbrowser
import plyer
from kivy.config import Config
from kivy.resources import resource_find,resource_add_path
resource_add_path("_internal")
resource_add_path("assets")
resource_add_path("configs")
resource_add_path("data")
Config.set("graphics","width","1000")
Config.set("graphics","minimum_width","1000")
# Config.set('kivy', 'window_icon', "logo.ico")
Config.set('kivy', 'window_icon', resource_find("logo.ico"))
Config.write()
# from kivy.core.window import Window
@@ -55,6 +62,8 @@ class AniXStreamApp(MDApp):
queue = Queue()
downloads_queue = Queue()
animdl_streaming_subprocess: Popen | None = None
default_anime_image = resource_find(random.choice(["default_1.jpg","default.jpg"]))
default_banner_image = resource_find(random.choice(["banner_1.jpg","banner.jpg"]))
def worker(self, queue: Queue):
while True:
@@ -76,6 +85,7 @@ class AniXStreamApp(MDApp):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.icon = resource_find("logo.png")
self.load_all_kv_files(self.directory)
self.theme_cls.theme_style = "Dark"
@@ -169,10 +179,10 @@ class AniXStreamApp(MDApp):
def build_settings(self, settings: Settings):
settings.add_json_panel(
"Settings", self.config, "./general_settings_panel.json"
"Settings", self.config, resource_find("general_settings_panel.json")
)
settings.add_json_panel(
"Animdl Config", self.config, "./animdl_config_panel.json"
"Animdl Config", self.config, resource_find("animdl_config_panel.json")
)
def on_config_change(self, config, section, key, value):

View File

@@ -1 +0,0 @@
{"user_anime_list": {"user_anime_list": [166531, 98437, 269, 104462, 21519, 150672, 104463, 21, 20631, 9756, 115230, 124194, 9253, 6702, 4654, 122671, 16049, 125367, 6213, 100185, 111322, 107226, 5081, 15583, 21857, 97889, 166372, 21745, 104051, 5114, 151806]}}