mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 12:50:09 +00:00
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:
@@ -217,6 +217,15 @@ export class ProwlarrService {
|
||||
// Extract metadata from title
|
||||
const metadata = this.extractMetadata(item.title || '');
|
||||
|
||||
// Extract download URL
|
||||
const downloadUrl = item.link || item.enclosure?.['@_url'] || '';
|
||||
|
||||
// Skip torrents without a valid download URL
|
||||
if (!downloadUrl || typeof downloadUrl !== 'string' || downloadUrl.trim() === '') {
|
||||
console.warn(`[Prowlarr] Skipping torrent "${item.title || 'Unknown'}" - missing download URL`);
|
||||
continue;
|
||||
}
|
||||
|
||||
const result: TorrentResult = {
|
||||
indexer: item.prowlarrindexer?.['#text'] || item.prowlarrindexer || 'Unknown',
|
||||
title: item.title || '',
|
||||
@@ -224,7 +233,7 @@ export class ProwlarrService {
|
||||
seeders,
|
||||
leechers,
|
||||
publishDate: item.pubDate ? new Date(item.pubDate) : new Date(),
|
||||
downloadUrl: item.link || item.enclosure?.['@_url'] || '',
|
||||
downloadUrl: downloadUrl.trim(),
|
||||
infoHash: getAttr('infohash'),
|
||||
guid: item.guid || '',
|
||||
format: metadata.format,
|
||||
@@ -274,6 +283,12 @@ export class ProwlarrService {
|
||||
*/
|
||||
private transformResult(result: ProwlarrSearchResult): TorrentResult | null {
|
||||
try {
|
||||
// Validate download URL
|
||||
if (!result.downloadUrl || typeof result.downloadUrl !== 'string' || result.downloadUrl.trim() === '') {
|
||||
console.warn(`[Prowlarr] Skipping result "${result.title}" - missing download URL`);
|
||||
return null;
|
||||
}
|
||||
|
||||
// Extract metadata from title
|
||||
const metadata = this.extractMetadata(result.title);
|
||||
|
||||
@@ -284,7 +299,7 @@ export class ProwlarrService {
|
||||
seeders: result.seeders,
|
||||
leechers: result.leechers,
|
||||
publishDate: new Date(result.publishDate),
|
||||
downloadUrl: result.downloadUrl,
|
||||
downloadUrl: result.downloadUrl.trim(),
|
||||
infoHash: result.infoHash,
|
||||
guid: result.guid,
|
||||
format: metadata.format,
|
||||
|
||||
@@ -136,6 +136,12 @@ export class QBittorrentService {
|
||||
* Add torrent (magnet link or file URL) - Enterprise Implementation
|
||||
*/
|
||||
async addTorrent(url: string, options?: AddTorrentOptions): Promise<string> {
|
||||
// Validate URL parameter
|
||||
if (!url || typeof url !== 'string' || url.trim() === '') {
|
||||
console.error('[qBittorrent] Invalid download URL:', url);
|
||||
throw new Error('Invalid download URL: URL is required and must be a non-empty string');
|
||||
}
|
||||
|
||||
// Ensure we're authenticated
|
||||
if (!this.cookie) {
|
||||
await this.login();
|
||||
@@ -242,7 +248,7 @@ export class QBittorrentService {
|
||||
responseType: 'arraybuffer',
|
||||
maxRedirects: 0,
|
||||
validateStatus: (status) => status >= 200 && status < 300, // Only 2xx is success
|
||||
timeout: 10000,
|
||||
timeout: 30000, // 30 seconds - public indexers can be slow
|
||||
});
|
||||
|
||||
console.log(`[qBittorrent] Got 2xx response, size=${torrentResponse.data.length} bytes`);
|
||||
|
||||
Reference in New Issue
Block a user