From 7baccab0b18b2e8e9b41d6e076657072a08c5f48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C=E8=A7=82=E5=AF=9F=E6=97=A5=E5=BF=97?= Date: Wed, 25 Jun 2025 11:51:21 +0800 Subject: [PATCH] fix: wrong album region detection --- src/api.py | 9 ++++----- src/utils.py | 2 ++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/api.py b/src/api.py index e07122c..4fb342f 100644 --- a/src/api.py +++ b/src/api.py @@ -1,5 +1,4 @@ import asyncio -import logging from io import BytesIO from ssl import SSLError from typing import Type @@ -218,14 +217,14 @@ class WebAPI: async def exist_on_storefront_by_song_id(self, song_id: str, storefront: str, check_storefront: str): if storefront.upper() == check_storefront.upper(): return True - song = await self.song_exist(song_id, check_storefront) - return bool(song) + exist = await self.song_exist(song_id, check_storefront) + return exist async def exist_on_storefront_by_album_id(self, album_id: str, storefront: str, check_storefront: str): if storefront.upper() == check_storefront.upper(): return True - album = await self.album_exist(album_id, check_storefront) - return bool(album) + exist = await self.album_exist(album_id, check_storefront) + return exist class APICreator(AbstractCreator): diff --git a/src/utils.py b/src/utils.py index b42d3da..96bef03 100644 --- a/src/utils.py +++ b/src/utils.py @@ -241,6 +241,8 @@ async def check_album_existence(album_id: str, region: str): for m_region in (await it(WrapperManager).status()).regions: try: check = await it(WebAPI).exist_on_storefront_by_album_id(album_id, region, m_region) + if check: + break except ValidationError: pass return check