# Index movies destination
curl -X POST http://localhost:3000/maintenance/index/destination \
-H "Content-Type: application/json" \
-d '{"dataset": "movies", "destination": "/media/movies"}'
# Index TV shows destination
curl -X POST http://localhost:3000/maintenance/index/destination \
-H "Content-Type: application/json" \
-d '{"dataset": "tvshows", "destination": "/media/tvshows"}'
# Scan uses database automatically if indexed
curl -X POST http://localhost:3000/maintenance/duplicates/scan
# Get duplicate statistics
curl http://localhost:3000/maintenance/index/stats
# List duplicate groups
curl http://localhost:3000/maintenance/duplicates
| Method | Endpoint | Description |
|---|---|---|
| POST | /maintenance/index/destination |
Index destination files |
| GET | /maintenance/index/stats |
Get duplicate statistics |
| GET | /maintenance/index/count |
Get indexed file count |
| DELETE | /maintenance/index/:dataset |
Clear index for dataset |
| POST | /maintenance/duplicates/scan |
Scan for duplicates (uses DB) |
| GET | /maintenance/duplicates |
List duplicate groups |
curl -X POST http://localhost:3000/maintenance/index/destination \
-H "Content-Type: application/json" \
-d '{
"dataset": "movies",
"destination": "/media/movies",
"reindex": true,
"batchSize": 200
}'
# Get stats for specific dataset
curl "http://localhost:3000/maintenance/index/stats?dataset=movies"
# Count all indexed files
curl "http://localhost:3000/maintenance/index/count?dataset=movies"
# Count for specific destination
curl "http://localhost:3000/maintenance/index/count?dataset=movies&destination=/media/movies"
# Clear index
curl -X DELETE "http://localhost:3000/maintenance/index/movies"
# Rebuild
curl -X POST http://localhost:3000/maintenance/index/destination \
-H "Content-Type: application/json" \
-d '{"dataset": "movies", "destination": "/media/movies"}'
# If this returns 0 or a low number, you need to index
curl "http://localhost:3000/maintenance/index/count?dataset=movies"
# Option 1: Full re-index (clears and rebuilds)
curl -X POST http://localhost:3000/maintenance/index/destination \
-H "Content-Type: application/json" \
-d '{"dataset": "movies", "destination": "/media/movies", "reindex": true}'
# Option 2: Incremental (only indexes new files)
curl -X POST http://localhost:3000/maintenance/index/destination \
-H "Content-Type: application/json" \
-d '{"dataset": "movies", "destination": "/media/movies", "reindex": false}'
// Using Node.js
const response = await fetch(
"http://localhost:3000/maintenance/index/stats?dataset=movies"
);
const { duplicatesByDataset } = await response.json();
duplicatesByDataset.forEach((dup) => {
console.log(`Found ${dup.file_count} copies of file with hash ${dup.hash}`);
console.log("Files:", dup.files);
});
If you need to query the database directly:
-- Find all duplicates
SELECT * FROM file_duplicates;
-- Find duplicates for a specific dataset
SELECT * FROM file_duplicates WHERE dataset = 'movies';
-- Find files with a specific hash
SELECT * FROM files WHERE hash = 'abc123...';
-- Count indexed files
SELECT COUNT(*) FROM files WHERE destination_path IS NOT NULL;
-- Find files needing indexing
SELECT * FROM files
WHERE destination_path IS NOT NULL
AND hash IS NULL;
Recommended maintenance:
GET /maintenance/index/countPOST /maintenance/duplicates/scanGET /maintenance/index/statscurl -X DELETE "http://localhost:3000/maintenance/index/movies"
curl -X POST http://localhost:3000/maintenance/index/destination \
-H "Content-Type: application/json" \
-d '{"dataset": "movies", "destination": "/media/movies", "reindex": true}'