Improve output and add json

This commit is contained in:
2026-02-08 13:33:04 +01:00
parent fc926052e0
commit 3a979086e4

26
scan.sh
View File

@@ -18,7 +18,7 @@
# Install:
# sudo apt install imagemagick poppler-utils sane tesseract-ocr tesseract-ocr-deu tesseract-ocr-eng unpaper
OUTPUT="scan.pdf"
OUTPUT="scan_$(date +%Y-%m-%d-%H-%M-%S).pdf"
HELP=0
VERBOSE=0
@@ -167,6 +167,30 @@ fi
if [[ -f "$OUTPUT" ]]; then
echo "Done. Output saved to: $OUTPUT"
# Create JSON metadata file
JSON_FILE="${OUTPUT%.pdf}.json"
cat > "$JSON_FILE" << EOF
{
"status": "success",
"pages": $num_pdf_files,
"mode": "$MODE",
"quality": $RESOLUTION
}
EOF
echo "Metadata saved to: $JSON_FILE"
else
echo "No scans found."
# Create JSON metadata file for failed scan
JSON_FILE="${OUTPUT%.pdf}.json"
cat > "$JSON_FILE" << EOF
{
"status": "failed",
"pages": 0,
"mode": "$MODE",
"quality": $RESOLUTION
}
EOF
echo "Metadata saved to: $JSON_FILE"
fi