feat: Complete watchlist & auto-download system with UI
Implement comprehensive watchlist system with automatic episode detection
and downloading. Features include per-user watchlists, scheduler-based
periodic checks, and a modern web UI.
**Backend Components:**
- WatchlistManager: JSON-based storage with multi-tenant support
- EpisodeChecker: Detects and downloads new episodes automatically
- AutoDownloadScheduler: APScheduler-based periodic task execution
- Complete REST API for CRUD operations and scheduler control
**Frontend Components:**
- Modern watchlist page with dark theme and animations
- Real-time status updates and progress tracking
- Scheduler controls with next-run display
- Add anime directly from search results
**Models & Configuration:**
- WatchlistItem with status, quality, and auto-download settings
- WatchlistSettings for global configuration
- Per-user statistics and provider tracking
**API Endpoints:**
- GET/POST /api/watchlist - List and add items
- PUT/DELETE /api/watchlist/{id} - Update and delete
- POST /api/watchlist/{id}/check - Manual check trigger
- POST /api/watchlist/check-all - Check all due items
- GET/PUT /api/watchlist/settings - Global settings
- GET /api/watchlist/stats - Statistics
- GET/POST /api/watchlist/scheduler/* - Scheduler control
**Configuration Files:**
- config/watchlist.json - User watchlist data
- config/watchlist_settings.json - Global settings
Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+6
-4
@@ -54,15 +54,16 @@ class WatchlistManager:
|
||||
self.watchlist = {}
|
||||
|
||||
def _save_watchlist(self):
|
||||
"""Save watchlist to JSON file"""
|
||||
try:
|
||||
os.makedirs(os.path.dirname(self.db_file), exist_ok=True)
|
||||
data = {
|
||||
item_id: item.model_dump(mode='json')
|
||||
for item_id, item in self.watchlist.items()
|
||||
}
|
||||
with open(self.db_file, 'w', encoding='utf-8') as f:
|
||||
temp_file = f"{self.db_file}.tmp"
|
||||
with open(temp_file, 'w', encoding='utf-8') as f:
|
||||
json.dump(data, f, indent=2, ensure_ascii=False, default=str)
|
||||
os.replace(temp_file, self.db_file)
|
||||
logger.debug(f"Saved {len(self.watchlist)} items to watchlist")
|
||||
except Exception as e:
|
||||
logger.error(f"Error saving watchlist: {e}")
|
||||
@@ -84,11 +85,12 @@ class WatchlistManager:
|
||||
self.settings = WatchlistSettings()
|
||||
|
||||
def _save_settings(self):
|
||||
"""Save watchlist settings to JSON file"""
|
||||
try:
|
||||
os.makedirs(os.path.dirname(self.settings_file), exist_ok=True)
|
||||
with open(self.settings_file, 'w', encoding='utf-8') as f:
|
||||
temp_file = f"{self.settings_file}.tmp"
|
||||
with open(temp_file, 'w', encoding='utf-8') as f:
|
||||
json.dump(self.settings.model_dump(mode='json'), f, indent=2, ensure_ascii=False)
|
||||
os.replace(temp_file, self.settings_file)
|
||||
logger.debug("Saved watchlist settings")
|
||||
except Exception as e:
|
||||
logger.error(f"Error saving settings: {e}")
|
||||
|
||||
Reference in New Issue
Block a user