Limit bulk refresh to watching and planned
This commit is contained in:
@@ -1622,9 +1622,21 @@ class WatchlistStore:
|
||||
raise KeyError("Anime not found in watchlist.")
|
||||
return self._row_to_item(row)
|
||||
|
||||
def all_show_ids(self):
|
||||
def all_show_ids(self, categories=None):
|
||||
normalized_categories = []
|
||||
for category in categories or []:
|
||||
normalized = normalize_watchlist_category(category)
|
||||
if normalized not in normalized_categories:
|
||||
normalized_categories.append(normalized)
|
||||
with self.lock, self._connect() as conn:
|
||||
rows = conn.execute("SELECT show_id FROM watchlist ORDER BY title COLLATE NOCASE ASC").fetchall()
|
||||
if normalized_categories:
|
||||
placeholders = ", ".join("?" for _ in normalized_categories)
|
||||
rows = conn.execute(
|
||||
f"SELECT show_id FROM watchlist WHERE category IN ({placeholders}) ORDER BY title COLLATE NOCASE ASC",
|
||||
tuple(normalized_categories),
|
||||
).fetchall()
|
||||
else:
|
||||
rows = conn.execute("SELECT show_id FROM watchlist ORDER BY title COLLATE NOCASE ASC").fetchall()
|
||||
return [str(row["show_id"]).strip() for row in rows if str(row["show_id"]).strip()]
|
||||
|
||||
def add(self, payload):
|
||||
@@ -1840,7 +1852,7 @@ class WatchlistStore:
|
||||
|
||||
def refresh_all(self):
|
||||
refreshed = []
|
||||
for show_id in self.all_show_ids():
|
||||
for show_id in self.all_show_ids(categories=("watching", "planned")):
|
||||
item = self.refresh(show_id, include_thumbnail=False)
|
||||
if item is not None:
|
||||
refreshed.append(item)
|
||||
|
||||
Reference in New Issue
Block a user