Skip to content

Commit c5697e6

Browse files
fix: catalog names reset to default after update
1 parent fc71e7e commit c5697e6

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

app/services/catalog_updater.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77

88
from app.core.config import settings
99
from app.core.security import redact_token
10-
from app.core.settings import UserSettings, get_default_settings
10+
from app.core.settings import UserSettings
1111
from app.services.catalog import DynamicCatalogService
1212
from app.services.stremio.service import StremioBundle
1313
from app.services.token_store import token_store
1414
from app.services.translation import translation_service
15+
from app.utils.catalog import get_catalogs_from_config
1516

1617

1718
def get_config_id(catalog) -> str | None:
@@ -114,12 +115,13 @@ async def refresh_catalogs_for_credentials(
114115
return False
115116

116117
# 2. Extract settings and refresh
117-
user_settings = get_default_settings()
118+
user_settings = None
118119
if credentials.get("settings"):
119120
try:
120121
user_settings = UserSettings(**credentials["settings"])
121122
except Exception as e:
122123
logger.exception(f"[{redact_token(token)}] Failed to parse user settings: {e}")
124+
return True # if user doesn't have setting, we can't update the catalogs. so no need to try again.
123125

124126
# Fetch fresh library
125127
library_items = await bundle.library.get_library_items(auth_key)
@@ -132,6 +134,15 @@ async def refresh_catalogs_for_credentials(
132134
library_items=library_items, user_settings=user_settings
133135
)
134136

137+
# now add the default catalogs
138+
if user_settings:
139+
catalogs.extend(get_catalogs_from_config(user_settings, "watchly.rec", "Top Picks for You", True, True))
140+
catalogs.extend(
141+
get_catalogs_from_config(
142+
user_settings, "watchly.creators", "From your favourite Creators", False, False
143+
)
144+
)
145+
135146
# Translate catalogs
136147
if user_settings and user_settings.language:
137148
for cat in catalogs:

0 commit comments

Comments
 (0)