mirror of
https://github.com/acedanger/shell.git
synced 2025-12-05 22:50:18 -08:00
feat: Update Plex Recent Additions script to use custom SQLite binary and improve query output
This commit is contained in:
@@ -42,6 +42,10 @@
|
||||
# Handle command line arguments
|
||||
DAYS=${1:-7}
|
||||
|
||||
# Plex SQLite path (custom Plex SQLite binary)
|
||||
PLEX_SQLITE="/usr/lib/plexmediaserver/Plex SQLite"
|
||||
|
||||
|
||||
# Show help if requested
|
||||
if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
|
||||
echo "Usage: $0 [DAYS]"
|
||||
@@ -69,20 +73,18 @@ if [ ! -f "$PLEX_DB" ]; then
|
||||
fi
|
||||
|
||||
# Query the database for items added in the specified number of days
|
||||
sqlite3 "$PLEX_DB" <<EOF
|
||||
"$PLEX_SQLITE" "$PLEX_DB" <<EOF
|
||||
.headers on
|
||||
.mode column
|
||||
SELECT
|
||||
date(meta.added_at, 'unixepoch', 'localtime') AS "added_at"
|
||||
, lib.name as "library_name"
|
||||
, trim(lib.name) as "library_name"
|
||||
, meta.year
|
||||
, meta.title
|
||||
, meta.original_title
|
||||
, trim(meta.title) as "title"
|
||||
FROM
|
||||
metadata_items meta
|
||||
join library_sections lib on meta.library_section_id = lib.id
|
||||
WHERE
|
||||
meta.added_at >= strftime('%s', 'now', '-$DAYS days')
|
||||
and meta.title is null
|
||||
ORDER BY meta.added_at DESC;
|
||||
ORDER BY lib.name, meta.added_at DESC;
|
||||
EOF
|
||||
|
||||
Reference in New Issue
Block a user