mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 04:40:09 +00:00
Implement file hash-based library matching and remove fuzzy ASIN matching
Adds file hash-based matching for Audiobookshelf library items to ensure 100% accurate ASIN assignment for RMAB-organized content. Removes fuzzy matching from library availability checks, making all matching ASIN-only to eliminate false positives and race conditions. Updates database schema, processors, and matcher utilities; adds new tests and documentation for the new matching strategy. Removes obsolete scripts, Dockerfile, and related tests; updates docker-compose for test environments.
This commit is contained in:
@@ -775,6 +775,44 @@ export class PlexService {
|
||||
return ratingsMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a library item by ratingKey
|
||||
* Note: Deletion must be enabled in Plex under Settings > Server > Library
|
||||
*
|
||||
* @param serverUrl - The Plex server URL
|
||||
* @param authToken - Authentication token
|
||||
* @param ratingKey - The ratingKey of the item to delete
|
||||
*/
|
||||
async deleteItem(
|
||||
serverUrl: string,
|
||||
authToken: string,
|
||||
ratingKey: string
|
||||
): Promise<void> {
|
||||
try {
|
||||
await this.client.delete(
|
||||
`${serverUrl}/library/metadata/${ratingKey}`,
|
||||
{
|
||||
headers: {
|
||||
'X-Plex-Token': authToken,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
logger.info(`Deleted Plex library item with ratingKey ${ratingKey}`);
|
||||
} catch (error: any) {
|
||||
if (error.response?.status === 404) {
|
||||
logger.warn('Item not found in Plex library', { ratingKey });
|
||||
// Don't throw - item might already be deleted
|
||||
return;
|
||||
}
|
||||
logger.error('Failed to delete Plex library item', {
|
||||
ratingKey,
|
||||
error: error instanceof Error ? error.message : String(error)
|
||||
});
|
||||
throw new Error('Failed to delete item from Plex library');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of Plex Home users/profiles
|
||||
* Returns all managed users and home members for the authenticated account
|
||||
|
||||
Reference in New Issue
Block a user