mygramps/check_gramps_logs.sh
Daniel Viegas 7119aedd3d Add portrait display to timeline and tooltips, add portrait generation to demo family
- Add small portraits (24px) next to timeline events for person events
- Add larger portraits (120px) in tooltips when hovering over events
- Implement portrait loading from Gramps media_list using media_path_full
- Add portrait drawing using Cairo with circular clipping and border
- Update demo family generator to create portraits using DiceBear Avatars API
- Generate portraits considering age and gender for appropriate appearance
- Add media objects to XML with proper IDs and gallery references
- Use relative paths for media files in demo family XML
- Add helper scripts for debugging Gramps log files
- Fix deprecation warnings for XML element truth value checks
2025-11-30 11:31:25 +01:00

122 lines
3.4 KiB
Bash
Executable File

#!/bin/bash
# Script to check Gramps logs for media import errors
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
echo "=== Gramps Log File Checker ==="
echo ""
# Determine log directory
LOG_DIR="$HOME/snap/gramps/11/.config/gramps/gramps60/logs"
LOG_FILE="$LOG_DIR/Gramps60.log"
echo "Checking for log directory: $LOG_DIR"
# Create logs directory if it doesn't exist
if [ ! -d "$LOG_DIR" ]; then
echo -e "${YELLOW}Logs directory doesn't exist. Creating it...${NC}"
mkdir -p "$LOG_DIR"
echo -e "${GREEN}Created: $LOG_DIR${NC}"
else
echo -e "${GREEN}Logs directory exists: $LOG_DIR${NC}"
fi
echo ""
echo "Checking for log file: $LOG_FILE"
# Check if log file exists
if [ -f "$LOG_FILE" ]; then
echo -e "${GREEN}Log file found!${NC}"
echo ""
echo "=== Log File Info ==="
ls -lh "$LOG_FILE"
echo ""
echo "Last modified: $(stat -c %y "$LOG_FILE" 2>/dev/null || stat -f %Sm "$LOG_FILE" 2>/dev/null || echo "Unknown")"
echo ""
# Count lines
LINE_COUNT=$(wc -l < "$LOG_FILE")
echo "Total lines in log: $LINE_COUNT"
echo ""
# Search for media-related errors
echo "=== Searching for Media-Related Messages ==="
echo ""
# Check for errors
ERROR_COUNT=$(grep -i "error\|exception\|traceback\|failed" "$LOG_FILE" | wc -l)
if [ "$ERROR_COUNT" -gt 0 ]; then
echo -e "${RED}Found $ERROR_COUNT error/exception entries${NC}"
echo ""
echo "Recent errors:"
grep -i "error\|exception\|traceback\|failed" "$LOG_FILE" | tail -20
echo ""
else
echo -e "${GREEN}No errors found in log file${NC}"
echo ""
fi
# Check for media-related entries
MEDIA_COUNT=$(grep -i "media\|portrait\|file\|import" "$LOG_FILE" | wc -l)
if [ "$MEDIA_COUNT" -gt 0 ]; then
echo -e "${YELLOW}Found $MEDIA_COUNT media-related entries${NC}"
echo ""
echo "Recent media-related messages:"
grep -i "media\|portrait\|file\|import" "$LOG_FILE" | tail -30
echo ""
else
echo -e "${YELLOW}No media-related entries found${NC}"
echo ""
fi
# Show last 50 lines
echo "=== Last 50 Lines of Log ==="
tail -50 "$LOG_FILE"
else
echo -e "${YELLOW}Log file not found yet.${NC}"
echo ""
echo "To create the log file, run Gramps with debug logging enabled:"
echo ""
echo " gramps --debug=all"
echo ""
echo "Or specifically for media import:"
echo ""
echo " gramps --debug=gramps.gen.lib.media --debug=gramps.plugins.import.importxml"
echo ""
echo "After running Gramps and attempting to import, run this script again to check for errors."
echo ""
fi
# Also check for other possible log locations
echo ""
echo "=== Checking Alternative Log Locations ==="
ALTERNATIVE_LOCATIONS=(
"$HOME/.gramps/Gramps60.log"
"$HOME/.gramps/Gramps51.log"
"$HOME/.gramps/logs/Gramps60.log"
"$HOME/snap/gramps/common/.gramps/Gramps60.log"
"./gramps_debug.log"
"$HOME/gramps_debug.log"
)
for loc in "${ALTERNATIVE_LOCATIONS[@]}"; do
if [ -f "$loc" ]; then
echo -e "${GREEN}Found log file: $loc${NC}"
ls -lh "$loc"
echo ""
echo "Media-related entries in $loc:"
grep -i "media\|portrait\|file\|import\|error" "$loc" | tail -20
echo ""
fi
done
echo ""
echo "=== Script Complete ==="