Add ASIN/ISBN fields to library and improve matching

Introduces `asin` and `isbn` fields to the PlexLibrary schema and database, with migration and indexing for fast lookups. Updates scan and recently-added processors to persist ASIN/ISBN from both Plex and Audiobookshelf backends. Enhances matching logic to prioritize exact ASIN matches using the new fields, improving match accuracy for Audiobookshelf users. Also includes minor improvements: fixes cover art handling for cached thumbnails, adds download URL validation in Prowlarr and qBittorrent integrations, and updates documentation to reflect these changes.
This commit is contained in:
kikootwo
2025-12-22 14:20:22 -05:00
parent a3381cba31
commit 1cefa437b7
12 changed files with 469 additions and 16 deletions
@@ -0,0 +1,9 @@
-- AlterTable
ALTER TABLE "plex_library" ADD COLUMN "asin" TEXT,
ADD COLUMN "isbn" TEXT;
-- CreateIndex
CREATE INDEX "plex_library_asin_idx" ON "plex_library"("asin");
-- CreateIndex
CREATE INDEX "plex_library_isbn_idx" ON "plex_library"("isbn");
+10 -3
View File
@@ -100,9 +100,10 @@ model AudibleCache {
}
// ============================================================================
// PLEX LIBRARY TABLE
// Pure Plex library content - What's actually in your Plex server
// No Audible data - just Plex metadata and file info
// LIBRARY CACHE TABLE (plex_library for backward compatibility)
// Universal library content - Works with Plex or Audiobookshelf backends
// Stores complete metadata including ASIN/ISBN for accurate matching
// No Audible data - just library backend metadata and file info
// ============================================================================
model PlexLibrary {
id String @id @default(uuid())
@@ -117,6 +118,10 @@ model PlexLibrary {
year Int?
userRating Decimal? @map("user_rating") @db.Decimal(3, 1) // User's rating (0-10 scale from Plex)
// Universal identifiers (works for both Plex and Audiobookshelf)
asin String? // Audible ASIN - extracted from Plex GUID or stored directly from ABS
isbn String? // ISBN (10 or 13) - for additional matching capability
// File information
filePath String? @map("file_path") @db.Text
thumbUrl String? @map("thumb_url") @db.Text // Plex thumbnail URL
@@ -133,6 +138,8 @@ model PlexLibrary {
@@index([title])
@@index([author])
@@index([plexLibraryId])
@@index([asin])
@@index([isbn])
@@map("plex_library")
}