mirror of
https://github.com/Benexl/FastAnime.git
synced 2026-01-10 04:05:13 -08:00
fix: correct typing issues
This commit is contained in:
@@ -15,7 +15,7 @@ def completed(config: Config):
|
||||
print("Please run: fastanime anilist loggin")
|
||||
exit_app()
|
||||
anime_list = AniList.get_anime_list("COMPLETED")
|
||||
if not anime_list:
|
||||
if not anime_list or not anime_list[1]:
|
||||
return
|
||||
if not anime_list[0]:
|
||||
return
|
||||
|
||||
@@ -17,7 +17,7 @@ def dropped(config: Config):
|
||||
anime_list = AniList.get_anime_list("DROPPED")
|
||||
if not anime_list:
|
||||
return
|
||||
if not anime_list[0]:
|
||||
if not anime_list[0] or not anime_list[1]:
|
||||
return
|
||||
media = [
|
||||
mediaListItem["media"]
|
||||
|
||||
@@ -12,6 +12,7 @@ from ....constants import (
|
||||
APP_CACHE_DIR,
|
||||
APP_DATA_DIR,
|
||||
APP_NAME,
|
||||
ICON_PATH,
|
||||
NOTIFICATION_BELL,
|
||||
PLATFORM,
|
||||
)
|
||||
@@ -27,6 +28,7 @@ def notifier(config: Config):
|
||||
notified = os.path.join(APP_DATA_DIR, "last_notification.json")
|
||||
anime_image = os.path.join(APP_CACHE_DIR, "notification_image")
|
||||
notification_duration = config.notification_duration * 60
|
||||
app_icon = ""
|
||||
|
||||
if not config.user:
|
||||
print("Not Authenticated")
|
||||
@@ -55,6 +57,15 @@ def notifier(config: Config):
|
||||
time.sleep(timeout * 60)
|
||||
continue
|
||||
data = result[1]
|
||||
if not data:
|
||||
print(result)
|
||||
logger.warning(
|
||||
"Something went wrong this could mean anilist is down or you have lost internet connection"
|
||||
)
|
||||
logger.info("sleeping...")
|
||||
time.sleep(timeout * 60)
|
||||
continue
|
||||
|
||||
# pyright:ignore
|
||||
notifications = data["data"]["Page"]["notifications"]
|
||||
if not notifications:
|
||||
@@ -86,7 +97,9 @@ def notifier(config: Config):
|
||||
if resp.status_code == 200:
|
||||
with open(anime_image, "wb") as f:
|
||||
f.write(resp.content)
|
||||
ICON_PATH = anime_image
|
||||
app_icon = anime_image
|
||||
else:
|
||||
app_icon = ICON_PATH
|
||||
|
||||
past_notifications[f"{id}"] = notification_["episode"]
|
||||
with open(notified, "w") as f:
|
||||
@@ -96,9 +109,9 @@ def notifier(config: Config):
|
||||
title=title,
|
||||
message=message,
|
||||
app_name=APP_NAME,
|
||||
app_icon=ICON_PATH,
|
||||
app_icon=app_icon,
|
||||
hints={
|
||||
"image-path": ICON_PATH,
|
||||
"image-path": app_icon,
|
||||
"sound-file": NOTIFICATION_BELL,
|
||||
},
|
||||
timeout=notification_duration,
|
||||
|
||||
@@ -17,7 +17,7 @@ def paused(config: Config):
|
||||
anime_list = AniList.get_anime_list("PAUSED")
|
||||
if not anime_list:
|
||||
return
|
||||
if not anime_list[0]:
|
||||
if not anime_list[0] or not anime_list[1]:
|
||||
return
|
||||
media = [
|
||||
mediaListItem["media"]
|
||||
|
||||
@@ -17,7 +17,7 @@ def planning(config: Config):
|
||||
anime_list = AniList.get_anime_list("PLANNING")
|
||||
if not anime_list:
|
||||
return
|
||||
if not anime_list[0]:
|
||||
if not anime_list[0] or not anime_list[1]:
|
||||
return
|
||||
media = [
|
||||
mediaListItem["media"]
|
||||
|
||||
@@ -17,7 +17,7 @@ def rewatching(config: Config):
|
||||
anime_list = AniList.get_anime_list("REPEATING")
|
||||
if not anime_list:
|
||||
return
|
||||
if not anime_list[0]:
|
||||
if not anime_list[0] or not anime_list[1]:
|
||||
return
|
||||
media = [
|
||||
mediaListItem["media"]
|
||||
|
||||
@@ -17,7 +17,7 @@ def watching(config: Config):
|
||||
anime_list = AniList.get_anime_list("CURRENT")
|
||||
if not anime_list:
|
||||
return
|
||||
if not anime_list[0]:
|
||||
if not anime_list[0] or not anime_list[1]:
|
||||
return
|
||||
media = [
|
||||
mediaListItem["media"]
|
||||
|
||||
@@ -586,7 +586,7 @@ def anilist_options(config, anilist_config: QueryDict):
|
||||
default=False,
|
||||
):
|
||||
success, data = AniList.delete_medialist_entry(selected_anime["id"])
|
||||
if not success:
|
||||
if not success or not data:
|
||||
print("Failed to delete", data)
|
||||
elif not data.get("deleted"):
|
||||
print("Failed to delete", data)
|
||||
@@ -800,7 +800,7 @@ def handle_animelist(anilist_config, config: Config, list_type: str):
|
||||
exit(1)
|
||||
anilist(config, anilist_config)
|
||||
return
|
||||
if not anime_list[0]:
|
||||
if not anime_list[0] or not anime_list[1]:
|
||||
print("Sth went wrong", anime_list)
|
||||
if not config.use_rofi:
|
||||
input("Enter to continue")
|
||||
|
||||
Reference in New Issue
Block a user