Command line scanner doesn't import cast or ratings anymore

Server Version#: 1.21.0.3616 (Ubuntu 18.04)
Scanner: Plex Movie
Agent: Plex Movie

I recently switched to the new non-legacy Plex Movie agent/scanner and noticed that when I scan via the command line, the movie is detected and matched but not all the metadata is populated. Specifically the cast information, rotten tomato ratings, reviews, and related movies on Plex Web

Once the movie is scanned via command line you can hit the “Refresh Metadata” button and they’ll populate. Under the old agent all the information would populate with the initial command line scan

Here is the command I use:

/usr/lib/plexmediaserver/Plex\ Media\ Scanner -v -s -r -c 2 -d "/path/to/Movies/New Movie (2020)"

Any tips or suggestions? I also just noticed there’s a “Plex Movie Scanner” scanner (in addition to “Plex Movie”) that I’ll give a try when I have some more time to troubleshoot [Edit: Nevermind that scanner is only available in conjunction with the “Personal Media” agent]

Edit: I haven’t tested it myself but looks like it’s fixed in the latest version of PMS (1.21.1.3766):

(Scanner) New movies would have incomplete metadata if the scan was invoked from the command line (#12156)

I feel like I’ve had problems when trying to combine -r with -s, or -r with -d.

Does it work if you first scan, and then use -r with -o and the specific item ID?

I’ve moved to using the URL commands or the python PlexAPI whenever possible.

Thanks for the feedback Volts! It does seem like maybe the -r part is not being invoked in my original command. I tired invoking it via the item ID using /usr/lib/plexmediaserver/Plex\ Media\ Scanner -r -o 71835 and I get the following error:

****** PLEX MEDIA SCANNER CRASHED, CRASH REPORT WRITTEN: /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Crash Reports/1.21.0.3616-(redacted)/PLEX MEDIA SCANNER/(redacted).dmp
Segmentation fault

Many of the Plex executables want a couple of environment variables set before they’ll run; are you doing that?

See the start.sh script that comes with Plex. Or see comments in this thread:

Media scanner cli is crashing [fixed] - needed env variable set

But also, really, consider using the web requests API or the Python PlexAPI.

Yeah I set the following environmental variables before running any commands

export LD_LIBRARY_PATH=/usr/lib/plexmediaserver
export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/var/lib/plexmediaserver/Library/Application\ Support

I’d looked into the web API in the past but at the time it could not scan individual directories (only whole libraries). But it looks like they might have added the functionality. I’ll definitely give that and the Python API a look when I have some time, thanks!

1 Like

I think you still need to specify the section, even when giving an item ID.

This works for me to force a metadata refresh:

/usr/local/share/plexmediaserver/Plex\ Media\ Scanner -c 54 -o 153625 -rx

1 Like

Good catch! It works for me when I specify the section and also use the -x option, which also seems to be required:

/usr/lib/plexmediaserver/Plex\ Media\ Scanner -c 2 -o 71835 -rx

It just seems to be a bit broken when invoked with the -s -d options like you originally suspected

1 Like

It even gets an initial “Summary” when scanning with -s, and then updates it after the second command with -rx. Maybe the logic just uses two passes. First to match & identify the movie, getting Title and Summary. And then a second call for “full” metadata.

At first I thought you could do this, but it actually refreshes Metadata for the entire Library. I don’t think -r is compatible with -d.

Don’t do this:
/usr/local/share/plexmediaserver/Plex\ Media\ Scanner -c 54 -rx -d "/path/to/movies/Ghostbusters"

1 Like

Yeah I noticed the same when I used -rx with the -s -d options. It definitely seems to invoke a full library scan. I agree that at the moment the options seem incompatible but I’ve been using the same command (without the -x option) for the past three years without issue. I only started having the issue of no cast/ratings metadata for the last month or so, seemingly right around the time I switched to the new Plex Movie metadata agent. Hopefully just a small easy to fix bug :slight_smile:

@Volts Thanks for the suggestion regarding giving the URL command a second look. Glad they finally added individual directory scanning to that and after a bit of trial and error I was able to use the following command to scan individual movie directories AND it picks up all of the metadata

curl "https://$ip_address:32400/library/sections/$movies_section/refresh?path=${movie_path// /%20}&X-Plex-Token=$plex_token"

I appreciate you always taking the time to respond and help out. Thanks again!

1 Like

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