From c8975f81863b3a3c543c367ac0c56eea1e6f27ff Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Tue, 10 Mar 2026 12:56:22 -0700 Subject: [PATCH] Make iTunes country setting apply immediately without restart --- core/itunes_client.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/core/itunes_client.py b/core/itunes_client.py index 5309aebe..64c3c10e 100644 --- a/core/itunes_client.py +++ b/core/itunes_client.py @@ -232,19 +232,24 @@ class iTunesClient: FALLBACK_COUNTRIES = ['US', 'GB', 'FR', 'DE', 'JP', 'AU', 'CA', 'BR', 'KR', 'SE'] def __init__(self, country: str = None): - if country is None: - try: - from config.settings import config_manager - country = config_manager.get('itunes.country', 'US') - except Exception: - country = 'US' - self.country = country.upper() if country else "US" + self._fixed_country = country.upper() if country else None self.session = requests.Session() self.session.headers.update({ 'User-Agent': 'SoulSync/1.0', 'Accept': 'application/json' }) logger.info(f"iTunes client initialized for country: {self.country}") + + @property + def country(self): + """Read country from config dynamically so settings changes take effect immediately.""" + if self._fixed_country: + return self._fixed_country + try: + from config.settings import config_manager + return (config_manager.get('itunes.country', 'US') or 'US').upper() + except Exception: + return 'US' def is_authenticated(self) -> bool: """