mirror of
https://github.com/acedanger/shell.git
synced 2025-12-06 04:30:13 -08:00
scraping the plex database
This commit is contained in:
23
plex-recent-additions.sh
Executable file
23
plex-recent-additions.sh
Executable file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/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" <<EOF
|
||||||
|
.headers on
|
||||||
|
.mode column
|
||||||
|
SELECT
|
||||||
|
datetime(added_at, 'unixepoch', 'localtime') AS "Added On",
|
||||||
|
title AS "Title",
|
||||||
|
(SELECT name FROM library_sections WHERE library_sections.id = library_section_id) AS "Library"
|
||||||
|
FROM metadata_items
|
||||||
|
WHERE added_at >= strftime('%s', 'now', '-7 days')
|
||||||
|
ORDER BY added_at DESC;
|
||||||
|
EOF
|
||||||
Reference in New Issue
Block a user