Last active
April 3, 2024 22:48
-
-
Save Lucent/63d91941aca7d4c440abee96a2cc010f to your computer and use it in GitHub Desktop.
View Plex watch history by user on Synology
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
db_loc="/volume1/Plex/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db" | |
names=$(sqlite3 "$db_loc" "SELECT name from accounts;") | |
counter=0 | |
while read -r name; do | |
let counter++ | |
echo "$counter : $name" | |
nameArray[counter]=$name | |
done <<< "$names" | |
read index | |
sqlite3 "$db_loc" "SELECT a.name, l.name, v.grandparent_title, v.parent_index, v.'index', v.title FROM metadata_item_views v JOIN accounts a ON v.account_id = a.id JOIN library_sections l ON v.library_section_id = l.id WHERE a.name='${nameArray[$index]}' ORDER BY l.name, v.grandparent_title, v.parent_index, v.'index' ASC;" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment