Skip to content

Instantly share code, notes, and snippets.

@garlandkr
Created April 27, 2026 21:16
Show Gist options
  • Select an option

  • Save garlandkr/9bb5d8d7fbdf5269bd8bd6dac8754a2c to your computer and use it in GitHub Desktop.

Select an option

Save garlandkr/9bb5d8d7fbdf5269bd8bd6dac8754a2c to your computer and use it in GitHub Desktop.
Wrapper for fixing Jellyfin Episode Metadata
#!/bin/bash
# Relies on https://gist.github.com/garlandkr/256fa5b691dca1960e8c441c5fc2074f
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[0;33m'
NC='\033[0m' # no color
SCRIPT="~/update_jellyfin_metadata_from_nfo.py"
# How many days back to check for new episode data
DATE_DAYS=2
# Uses NFO or MKV as the date of truth for ${DATE_DAYS}
DATE_FILE="mkv"
echo -e "${RED}[✖] Stopping Jellyfin...${NC}"
sudo systemctl stop jellyfin
if systemctl is-active --quiet jellyfin; then
echo -e "${RED}[✖] Jellyfin failed to stop. Aborting.${NC}"
exit 1
fi
echo -e "${RED}[✖] Jellyfin stopped.${NC}"
echo ""
echo -e "${BLUE}[→] Running metadata fix script (--date ${DATE_DAYS} --datefile ${DATE_FILE})...${NC}"
echo ""
sudo python3 "$SCRIPT" --date "$DATE_DAYS" --datefile "$DATE_FILE"
if [ $? -ne 0 ]; then
echo ""
echo -e "${YELLOW}[!] Python script exited with errors. Starting Jellyfin anyway...${NC}"
fi
echo ""
echo -e "${GREEN}[✔] Starting Jellyfin...${NC}"
sudo systemctl start jellyfin
if systemctl is-active --quiet jellyfin; then
echo -e "${GREEN}[✔] Jellyfin is running.${NC}"
else
echo -e "${YELLOW}[!] Jellyfin may not have started correctly. Check: sudo systemctl status jellyfin${NC}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment