# Aniworld Web Application Development Instructions This document provides detailed tasks for AI agents to implement a modern web application for the Aniworld anime download manager. All tasks should follow the coding guidelines specified in the project's copilot instructions. ## Project Overview The goal is to create a FastAPI-based web application that provides a modern interface for the existing Aniworld anime download functionality. The core anime logic should remain in `SeriesApp.py` while the web layer provides REST API endpoints and a responsive UI. ## Architecture Principles - **Single Responsibility**: Each file/class has one clear purpose - **Dependency Injection**: Use FastAPI's dependency system - **Clean Separation**: Web layer calls core logic, never the reverse - **File Size Limit**: Maximum 500 lines per file - **Type Hints**: Use comprehensive type annotations - **Error Handling**: Proper exception handling and logging ## Additional Implementation Guidelines ### Code Style and Standards - **Type Hints**: Use comprehensive type annotations throughout all modules - **Docstrings**: Follow PEP 257 for function and class documentation - **Error Handling**: Implement custom exception classes with meaningful messages - **Logging**: Use structured logging with appropriate log levels - **Security**: Validate all inputs and sanitize outputs - **Performance**: Use async/await patterns for I/O operations ## ๐Ÿ“ž Escalation If you encounter: - Architecture issues requiring design decisions - Tests that conflict with documented requirements - Breaking changes needed - Unclear requirements or expectations **Document the issue and escalate rather than guessing.** --- ## ๏ฟฝ Credentials **Admin Login:** - Username: `admin` - Password: `Hallo123!` --- ## ๏ฟฝ๐Ÿ“š Helpful Commands ```bash # Run all tests conda run -n AniWorld python -m pytest tests/ -v --tb=short # Run specific test file conda run -n AniWorld python -m pytest tests/unit/test_websocket_service.py -v # Run specific test class conda run -n AniWorld python -m pytest tests/unit/test_websocket_service.py::TestWebSocketService -v # Run specific test conda run -n AniWorld python -m pytest tests/unit/test_websocket_service.py::TestWebSocketService::test_broadcast_download_progress -v # Run with extra verbosity conda run -n AniWorld python -m pytest tests/ -vv # Run with full traceback conda run -n AniWorld python -m pytest tests/ -v --tb=long # Run and stop at first failure conda run -n AniWorld python -m pytest tests/ -v -x # Run tests matching pattern conda run -n AniWorld python -m pytest tests/ -v -k "auth" # Show all print statements conda run -n AniWorld python -m pytest tests/ -v -s #Run app conda run -n AniWorld python -m uvicorn src.server.fastapi_app:app --host 127.0.0.1 --port 8000 --reload ``` --- ## Implementation Notes 1. **Incremental Development**: Implement features incrementally, testing each component thoroughly before moving to the next 2. **Code Review**: Review all generated code for adherence to project standards 3. **Documentation**: Document all public APIs and complex logic 4. **Testing**: Maintain test coverage above 80% for all new code 5. **Performance**: Profile and optimize critical paths, especially download and streaming operations 6. **Security**: Regular security audits and dependency updates 7. **Monitoring**: Implement comprehensive monitoring and alerting 8. **Maintenance**: Plan for regular maintenance and updates --- ## Task Completion Checklist For each task completed: - [ ] Implementation follows coding standards - [ ] Unit tests written and passing - [ ] Integration tests passing - [ ] Documentation updated - [ ] Error handling implemented - [ ] Logging added - [ ] Security considerations addressed - [ ] Performance validated - [ ] Code reviewed - [ ] Task marked as complete in instructions.md - [ ] Infrastructure.md updated and other docs - [ ] Changes committed to git; keep your messages in git short and clear - [ ] Take the next task --- ## TODO List: fix: Failed to load NFO/images for the-dreaming-boy-is-a-realist: No results found for: The Dreaming Boy is a Realist (2023) โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Traceback (most recent call last) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚ /home/lukas/Volume/repo/Aniworld/src/server/services/background_loader_service.py:399 in โ”‚ โ”‚ \_load_nfo_and_images โ”‚ โ”‚ โ”‚ โ”‚ 396 โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ 397 โ”‚ โ”‚ โ”‚ # Use existing NFOService to create NFO with all images โ”‚ โ”‚ 398 โ”‚ โ”‚ โ”‚ # This reuses all existing TMDB API logic and image downloading โ”‚ โ”‚ โฑ 399 โ”‚ โ”‚ โ”‚ nfo_path = await self.series_app.nfo_service.create_tvshow_nfo( โ”‚ โ”‚ 400 โ”‚ โ”‚ โ”‚ โ”‚ serie_name=task.name, โ”‚ โ”‚ 401 โ”‚ โ”‚ โ”‚ โ”‚ serie_folder=task.folder, โ”‚ โ”‚ 402 โ”‚ โ”‚ โ”‚ โ”‚ year=task.year, โ”‚ โ”‚ โ”‚ โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ locals โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚ โ”‚ โ”‚ db = โ”‚ โ”‚ โ”‚ โ”‚ e = TMDBAPIError('No results found for: The Dreaming Boy is a Realist (2023)') โ”‚ โ”‚ โ”‚ โ”‚ self = โ”‚ โ”‚ โ”‚ โ”‚ task = SeriesLoadingTask( โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ key='the-dreaming-boy-is-a-realist', โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ folder='The Dreaming Boy is a Realist (2023)', โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ name='The Dreaming Boy is a Realist (2023)', โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ year=None, โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ status=, โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ progress={'episodes': True, 'nfo': False, 'logo': False, 'images': False}, โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ started_at=datetime.datetime(2026, 1, 19, 19, 37, 20, 540721, โ”‚ โ”‚ โ”‚ โ”‚ tzinfo=datetime.timezone.utc), โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ completed_at=None, โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ error=None โ”‚ โ”‚ โ”‚ โ”‚ ) โ”‚ โ”‚ โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ โ”‚ โ”‚ โ”‚ โ”‚ /home/lukas/Volume/repo/Aniworld/src/core/services/nfo_service.py:112 in create_tvshow_nfo โ”‚ โ”‚ โ”‚ โ”‚ 109 โ”‚ โ”‚ โ”‚ search_results = await self.tmdb_client.search_tv_show(serie_name) โ”‚ โ”‚ 110 โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ 111 โ”‚ โ”‚ โ”‚ if not search_results.get("results"): โ”‚ โ”‚ โฑ 112 โ”‚ โ”‚ โ”‚ โ”‚ raise TMDBAPIError(f"No results found for: {serie_name}") โ”‚ โ”‚ 113 โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ 114 โ”‚ โ”‚ โ”‚ # Find best match (consider year if provided) โ”‚ โ”‚ 115 โ”‚ โ”‚ โ”‚ tv_show = self.\_find_best_match(search_results["results"], serie_name, year) โ”‚ โ”‚ โ”‚ โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ locals โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚ โ”‚ โ”‚ download_fanart = True โ”‚ โ”‚ โ”‚ โ”‚ download_logo = True โ”‚ โ”‚ โ”‚ โ”‚ download_poster = True โ”‚ โ”‚ โ”‚ โ”‚ folder_path = PosixPath('/mnt/server/serien/Serien/The Dreaming Boy is a Realist โ”‚ โ”‚ โ”‚ โ”‚ (2023)') โ”‚ โ”‚ โ”‚ โ”‚ search_results = {'page': 1, 'results': [], 'total_pages': 1, 'total_results': 0} โ”‚ โ”‚ โ”‚ โ”‚ self = โ”‚ โ”‚ โ”‚ โ”‚ serie_folder = 'The Dreaming Boy is a Realist (2023)' โ”‚ โ”‚ โ”‚ โ”‚ serie_name = 'The Dreaming Boy is a Realist (2023)' โ”‚ โ”‚ โ”‚ โ”‚ year = None โ”‚ โ”‚ โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ TMDBAPIError: No results found for: The Dreaming Boy is a Realist (2023) 2026-01-19 20:37:37 [debug ] Message broadcast failed_count=0 message_type=series_loading_update recipient_count=0 2026-01-19 20:37:37 [info ] Successfully loaded all data for series: the-dreaming-boy-is-a-realist 2026-01-19 20:37:37 [info ] Processing loading task for series: bel-blatt 2026-01-19 20:37:37 [debug ] Message broadcast failed_count=0 message_type=series_loading_update recipient_count=0 INFO: Creating NFO for รœbel Blatt (2025) (year: None)