mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 04:40:09 +00:00
Refactor indexer management and improve search logic
Refactors admin settings to use a new IndexersTab and card-based indexer management UI, supporting category selection and improved configuration. Updates backend and API routes to handle indexer categories, propagate ASIN for better search scoring, and group indexers by categories to optimize Prowlarr searches. Enhances documentation to clarify non-terminal request matching and auto-completion behavior. Adds new reusable components for indexer management and category selection.
This commit is contained in:
@@ -29,8 +29,8 @@ Manages background job queue using Bull (Redis-backed) for async tasks: searchin
|
||||
1. **search_indexers** - Search Prowlarr for torrents
|
||||
2. **monitor_download** - Poll progress (10s intervals)
|
||||
3. **organize_files** - Move to media library, set status to 'downloaded'
|
||||
4. **scan_plex** - Full scan of Plex library, match 'downloaded' requests
|
||||
5. **plex_recently_added_check** - Lightweight polling of recently added items (top 10)
|
||||
4. **scan_plex** - Full scan of library, match all non-terminal requests (excludes: available, cancelled)
|
||||
5. **plex_recently_added_check** - Lightweight polling of recently added items, match all non-terminal requests
|
||||
6. **match_plex** - Fuzzy match to Plex item (deprecated - now handled by scan_plex)
|
||||
|
||||
## Special Behaviors
|
||||
@@ -57,10 +57,18 @@ Manages background job queue using Bull (Redis-backed) for async tasks: searchin
|
||||
- No longer triggers immediate match_plex job
|
||||
|
||||
**scan_plex:**
|
||||
- Scans Plex library and populates plex_library table
|
||||
- After scan, checks for requests with status 'downloaded'
|
||||
- Fuzzy matches downloaded requests against Plex library (70% threshold)
|
||||
- Matched requests → 'available' status with plexGuid linked
|
||||
- Full library scan (Plex/Audiobookshelf) and populates plex_library table
|
||||
- Checks all non-terminal request statuses for matches (excludes: available, cancelled)
|
||||
- Fuzzy matches via ASIN/ISBN/title/author (70% threshold)
|
||||
- Matched requests → 'available' status with plexGuid/absItemId linked
|
||||
- Clears errorMessage and retry counters on match
|
||||
- Use case: Manual library imports automatically complete stuck requests
|
||||
|
||||
**plex_recently_added_check:**
|
||||
- Polls recently added items (top 10) every 5 minutes
|
||||
- Matches all non-terminal request statuses against new library items
|
||||
- Same matching logic as scan_plex (ASIN priority, fuzzy fallback)
|
||||
- Clears error state and retry counters on match
|
||||
|
||||
## Job Payloads
|
||||
|
||||
|
||||
@@ -80,6 +80,40 @@ API Docs: `/PlexMediaServerAPIDocs.json`
|
||||
**Benefits:** Lightweight polling for new items + comprehensive matching for downloaded requests
|
||||
**Note:** Requests transition: pending → searching → downloading → processing → downloaded → available (after detection)
|
||||
|
||||
## Auto-Completion of Stuck Requests
|
||||
|
||||
Library scans (full and incremental) now check **all non-terminal requests** for matches:
|
||||
|
||||
**Eligible statuses:**
|
||||
- pending, searching, downloading, processing, downloaded
|
||||
- failed, awaiting_search, awaiting_import, warn
|
||||
|
||||
**Excluded statuses:**
|
||||
- available (already completed)
|
||||
- cancelled (user cancelled)
|
||||
|
||||
**Use Case:**
|
||||
1. Request stuck in 'awaiting_search' or 'failed' status
|
||||
2. User manually imports audiobook to library (via Plex/ABS or external tool)
|
||||
3. Next library scan (manual trigger or scheduled recently-added check)
|
||||
4. Request auto-matches and marks as 'available'
|
||||
5. Error messages and retry counters cleared
|
||||
|
||||
**State Cleanup on Match:**
|
||||
- errorMessage → null
|
||||
- searchAttempts → 0
|
||||
- downloadAttempts → 0
|
||||
- importAttempts → 0
|
||||
- completedAt → scan timestamp
|
||||
|
||||
**Edge Cases:**
|
||||
- Active downloads/jobs continue but become no-ops (download completes, organize skips)
|
||||
- Torrent/NZB remains in download client (manual cleanup if desired)
|
||||
|
||||
**Logging:**
|
||||
- Transitions from non-downloaded statuses logged with original status: `Match found! "Book" → "Library Book" (was 'failed')`
|
||||
- Provides visibility into which stuck requests were auto-completed
|
||||
|
||||
## Data Models
|
||||
|
||||
```typescript
|
||||
|
||||
Reference in New Issue
Block a user