fix: queue issue
This commit is contained in:
@@ -83,6 +83,16 @@ This changelog follows [Keep a Changelog](https://keepachangelog.com/) principle
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Queue view blank after adding items**: `queue-init.js`'s `loadQueueData()` called
|
||||
`API.QUEUE_STATUS` directly, but `API` is a local variable inside
|
||||
`AniWorld.QueueAPI`'s IIFE — not accessible globally. Items added to the
|
||||
queue were persisted server-side but the queue page could not fetch them,
|
||||
leaving the view empty with an `API is not defined` console error. Fixed by
|
||||
replacing the inline `fetch` with `AniWorld.QueueAPI.loadQueueData()`, which
|
||||
already exists and correctly accesses the endpoint through its own closure.
|
||||
The same file already uses `AniWorld.QueueAPI.*` for all other queue
|
||||
operations (`startQueue`, `stopQueue`, `removeFromQueue`, etc.).
|
||||
|
||||
- **Bug**: `src/server/api/nfo.py` called the non-existent
|
||||
`anime_service.update_series_nfo_status(...)` method, which would
|
||||
raise `AttributeError` after a successful NFO repair. Renamed the
|
||||
@@ -118,17 +128,14 @@ This changelog follows [Keep a Changelog](https://keepachangelog.com/) principle
|
||||
|
||||
### Added
|
||||
|
||||
- **Encoding detection for HTML parsing** (`src/core/providers/aniworld_provider.py`):
|
||||
- **Encoding detection for HTML parsing** (`src/server/providers/aniworld_provider.py`):
|
||||
Added `_decode_html_content()` function that uses `chardet` to detect the actual
|
||||
encoding of HTML content before parsing. Falls back to UTF-8 with `errors='replace'`
|
||||
to handle pages with mismatched encoding declarations. Applied to all BeautifulSoup
|
||||
parsing calls to prevent "Some characters could not be decoded" warnings.
|
||||
- **chardet dependency**: Added `chardet>=5.2.0` to `requirements.txt` for encoding detection.
|
||||
|
||||
### Added
|
||||
|
||||
- **Temp file cleanup after every download** (`src/core/providers/aniworld_provider.py`,
|
||||
`src/core/providers/enhanced_provider.py`): Module-level helper
|
||||
- **Temp file cleanup after every download** (`src/server/providers/aniworld_provider.py`,
|
||||
`src/server/providers/enhanced_provider.py`): Module-level helper
|
||||
`_cleanup_temp_file()` removes the working temp file and any yt-dlp `.part`
|
||||
fragments after each download attempt — on success, on failure, and on
|
||||
exceptions (including `BrokenPipeError` and cancellation). Ensures that no
|
||||
@@ -145,37 +152,34 @@ This changelog follows [Keep a Changelog](https://keepachangelog.com/) principle
|
||||
|
||||
### Added
|
||||
|
||||
- **NFO tag completeness (`nfo_mapper.py`)**: All 17 required NFO tags are now
|
||||
- **NFO tag completeness (`src/server/nfo/nfo_mapper.py`)**: All 17 required NFO tags are now
|
||||
explicitly populated during creation: `originaltitle`, `sorttitle`, `year`,
|
||||
`plot`, `outline`, `tagline`, `runtime`, `premiered`, `status`, `imdbid`,
|
||||
`genre`, `studio`, `country`, `actor`, `watched`, `dateadded`, `mpaa`.
|
||||
- **`src/core/utils/nfo_mapper.py`**: New module containing
|
||||
- **`src/server/nfo/nfo_mapper.py`**: New module containing
|
||||
`tmdb_to_nfo_model()`, `_extract_rating_by_country()`, and
|
||||
`_extract_fsk_rating()`. Extracted from `NFOService` to keep files under
|
||||
500 lines and isolate pure mapping logic.
|
||||
`_extract_fsk_rating()`. Extracted to keep files under 500 lines and isolate
|
||||
pure mapping logic.
|
||||
- **`src/server/nfo/nfo_generator.py`**: XML serialiser for NFO files
|
||||
(`generate_tvshow_nfo`).
|
||||
- **US MPAA rating**: `_extract_rating_by_country(ratings, "US")` now maps the
|
||||
US TMDB content rating to the `<mpaa>` NFO tag.
|
||||
- **`NfoRepairService` (`src/core/services/nfo_repair_service.py`)**: New service
|
||||
that detects incomplete `tvshow.nfo` files and triggers TMDB re-fetch.
|
||||
Provides `parse_nfo_tags()`, `find_missing_tags()`, `nfo_needs_repair()`, and
|
||||
`NfoRepairService.repair_series()`. 13 required tags are checked.
|
||||
- **`perform_nfo_repair_scan()`
|
||||
(`src/server/services/folder_scan_service.py`)**: New async function
|
||||
that iterates every series directory, checks whether `tvshow.nfo` is missing
|
||||
required tags using `nfo_needs_repair()`, and queues the series for background
|
||||
reload via `asyncio.create_task`. Skips gracefully when `tmdb_api_key` or
|
||||
`anime_directory` is not configured.
|
||||
- **NFO repair wired into scheduled folder scan (`src/server/services/folder_scan_service.py`)**:
|
||||
`perform_nfo_repair_scan(background_loader=None)` is called during the
|
||||
scheduled daily folder scan, keeping startup fast while ensuring regular
|
||||
maintenance.
|
||||
- **`NfoScanService` (`src/server/services/nfo_scan_service.py`)**: New service
|
||||
that detects incomplete `tvshow.nfo` files and regenerates them from TMDB.
|
||||
Provides `scan_all()`, `_scan_series()`, `_create_nfo()`,
|
||||
`_update_nfo_if_needed()`, and `_regenerate_nfo()`. 17 NFO tags are written.
|
||||
- **`ScanService` (`src/server/services/scan_service.py`)**: New service for
|
||||
library rescans — detects new and removed episode files and syncs the
|
||||
`episodes` table accordingly.
|
||||
- **`FolderNamingService` (`src/server/services/folder_naming_service.py`)**:
|
||||
Renames series folders to the `Title (YYYY)` convention using the year from
|
||||
`tvshow.nfo`. Prevents double-year accumulation on repeated runs.
|
||||
|
||||
### Changed
|
||||
|
||||
- `NFOService._tmdb_to_nfo_model()` and `NFOService._extract_fsk_rating()` moved
|
||||
to `src/core/utils/nfo_mapper.py` as module-level functions
|
||||
`tmdb_to_nfo_model()` and `_extract_fsk_rating()`.
|
||||
- `src/core/services/nfo_service.py` reduced from 640 → 471 lines.
|
||||
- `src/server/nfo/nfo_mapper.py` and `src/server/nfo/nfo_generator.py`
|
||||
replaced the monolithic NFO logic from the previous service.
|
||||
- NFO generation moved to `src/server/nfo/nfo_generator.py`.
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user