Plex media scanner via cmd

I dont really understand why the decision to have some commands only availible via command line when we have the web interface but… I’ve been looking at this https://support.plex.tv/articles/201242707-plex-media-scanner-via-command-line/ and thats all fine but how does one find the item id?

Perform analysis on two items (with Item IDs 21 and 22):

"C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" -- analyze --item 21,22

Who made this documentation?

Look at how theese commands gives us the info we need to perform the next command…

Sample Commands

List the Library Sections

To list the Library sections currently defined on the Plex Media Server:

/path/to/Plex Media Scanner --list

This returns a list of Libraries and their ID:

/path/to/Plex Media Scanner --list
   29: Movies
   31: Music
   30: TV Shows

List the items in a Library

To list the media items contained in a Library section:

/path/to/Plex Media Scanner --tree --section 29
* A Bug's Life [1998]
   * /Users/exampleuser/Movies/Media/Movies/A Bug's Life (1998).mkv
* Cars [2006]
   * /Users/exampleuser/Movies/Media/Movies/Cars (2006).mkv
* Enchanted [2007]
   * /Users/exampleuser/Movies/Media/Movies/Enchanted (2007).mkv
...

Refreshing an Entire Library

You can perform the same thing that occurs when you choose to “Refresh All” in the Plex Web App, which is to Refresh metadata for all items in the library:

  • Determine the Section ID to scan
  • For example, the Movies Library above has an ID=29
/path/to/Plex Media Scanner --refresh --force --section 29

And then look at this for comparison

Examples

Windows

In Windows, you perform these from the Command Prompt.

Tip!: You can drag-drop the “Plex Media Scanner.exe” file into your command prompt window to have the full path and filename automatically inserted.

Recreate the thumbnail and fanart images that get generated for media:

"C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --generate --section 2

Perform analysis on two items (with Item IDs 21 and 22):

"C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" -- analyze --item 21,22

Were did he pull thats ■■■■■ from? how are we getting the item ids?

One wonders, like were are the real documentation for this?

You can use --list, passing in a section id to get individual ids:

'Plex Media Scanner' --list --section 2
123456: Some Movie
123457: Another Movie
...

You could also navigate to the item in the web app, and the URL will include the item id (.../details?key=%2Flibrary%2Fmetadata%2F[[12345]]...).

The documentation is definitely sparse, and considering many commands are deprecated, you’re probably better off using the web API instead of the command line scanner (and using a wrapper like Python-PlexAPI will make the web API much easier to work with).

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.