#!/bin/bash # Define the path to the Plex database PLEX_DB="/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db" # Check if the database exists if [ ! -f "$PLEX_DB" ]; then echo "Plex database not found at $PLEX_DB" exit 1 fi # Query the database for items added in the last 7 days sqlite3 "$PLEX_DB" <= strftime('%s', 'now', '-7 days') ORDER BY meta.added_at DESC; EOF