Home Page
  • October 03, 2024, 06:47:26 pm *
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

News:

Official site launch very soon, hurrah!


Author Topic: Some useful Plex commands  (Read 631 times)

Dakusan

  • Programmer Person
  • Administrator
  • Hero Member
  • *****
  • Posts: 543
    • View Profile
    • Dakusan's Domain
Some useful Plex commands
« on: September 15, 2024, 10:24:45 pm »

Original post for Some useful Plex commands can be found at https://www.castledragmire.com/Posts/Some_useful_Plex_commands.
Originally posted on: 09/16/24

The below commands are tailored for Linux, as file paths are different for Windows. They need to be ran with the sudo -u plex prefix for proper user access permissions.

Get list of libraries
'/usr/lib/plexmediaserver/Plex Media Scanner' --list

Force library intro dection
'/usr/lib/plexmediaserver/Plex Media Scanner' --analyze --manual --server-action intros --section LIBRARY_ID

Force library credit dection
'/usr/lib/plexmediaserver/Plex Media Scanner' --analyze --manual --server-action credits --section LIBRARY_ID

Export media list

sqlite3 '/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db' '
SELECT MDI.id, file, title, MDI."index", hints, GROUP_CONCAT(T.text) AS taggings
FROM media_parts AS MP
INNER JOIN media_items AS MI ON MI.id=MP.media_item_id
INNER JOIN metadata_items AS MDI ON MDI.id=MI.metadata_item_id
LEFT JOIN taggings as T ON T.metadata_item_id=MDI.id AND T.text IN ("credits", "intro")
GROUP BY MDI.id
'
This outputs the following (column separated by pipe “|”) for each individual media item:
  1. Metadata item ID
  2. File path
  3. Title
  4. Episode Number
  5. Hints (e.x. =&episode=1&episodic=1&season=1&show=Ninja%20Turtles&show_name=Ninja%20Turtles&year=2002)
  6. “credits” and “intros” tags (if the credits and intros timestamps have been calculated)
Logged