Command Line Scanner and Partial Refresh

Ok, so what I want to do is to be able to force a refresh of a specific TV Show, not my whole TV Library

So I am trying to use the command line scanner on OS X,

On the command line scanner support page it shows there is a --directory flag. But even if I set that it still seems to refresh all the shows.

e.g:
/pathtoscanner/Plex\ Media\ Scanner -v -p --refresh --force --section 5 --directory /path/to/tv/shows/showtoscan
also tried
/pathtoscanner/Plex\ Media\ Scanner -v -p --refresh --section 5 --directory /path/to/tv/shows/showtoscan --force
Just in case the position of the flags made any difference, it did not seem to make any difference.

Both commands refresh my whole TV section

If I run --scan instead of --refresh then it does seem to scan just the specific show.

So is it possible to force a refresh of just a single TV Series?

(I know I could move the show out of the reach of plex, rescan, empty trash, re add the show again, but that’s a bit of a pita just to force a refresh of a single show)

Thanks

Did you ever resolve this, I’m seeing the same issue.

@eldon.mcguinness Afraid not, I gave up in the end, as everytime I tried anything it ended up scanning the whole library/section.
I think the number of people actually using the command line scanner must be very small as I got no response and very few views to this post :frowning:

Yea it seems like it… I wonder if there is some other way to get around this. The thing that really bites is the WebUI can force a refresh of a file/series/library so there would have to be a way to get this to work.

I have just tried it to see what the parameters that get used. I added a test folder named it Series 2 with an mp4 file named appropriately and with automatic updates and partial scanning, it started a job with these parameters

Oct 23, 2016 19:58:35.073 [17904] DEBUG - "C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section 3 --directory "C:\Users\Public\Plex-Tests\TV-Shows1\The Fosters\Series 2" 

and it just did that path

This was under 1.2.2

@sa2000 Are all of your tv series identified correctly? It seems to me that the only ones that get rescanned are ones that do not have proper metadata matches.

OS: Ubuntu 16.04
PMS: 1.2.2.2857

I ran the following command

/usr/lib/plexmediaserver/Plex\ Media\ Scanner -v -p -s -r -c 2 -d "/mnt/nt/Black Mirror/" --no-thumbs

The results were

GUI: Scanning Black Mirror
GUI: Matching 'Animated Tales of the World'
GUI: Matching 'Davina Mccall: Life at the Extreme'
GUI: Matching 'Booze Traveler: Best Bars'
GUI: Matching 'Criminally Funny'

As you can see it is not staying only in the folder. The contents of the folder are just a single file named appropriately.

Looks like it was reported as far back as 2014:
https://forums.plex.tv/discussion/127924/plex-media-scanner-commandline-directory-parameter

@mwuanno said:

MovieFan wrote on November 20 2014, 7:04 AM: »

Ok.  finally got around to testing this and yes the --directory keyword does work, but you need to specify the section as well.

“Plex Media Scanner.exe” --scan --refresh --section ## --directory “full path to folder”

I cannot get the file option to work.  Everything I try gives me an error.  I am thinking that the file option is not meant for scanning 1 file, but maybe for indexing, which I did not try.

MovieFan has saved the day, this syntax does work. If it refreshes more stuff than just that one directory, I would have a look at those items in question. In my own case, with 20.000+ episodes, I get about 8 individual episodes from several different folders refreshed in addition to the directory specified. But they are the same each time. So they will get a thorough thrashing once I find the time.

I think it is about time we get this fixed…please…pretty please! :smiley:

@eldon.mcguinness said:
Looks like it was reported as far back as 2014:
https://forums.plex.tv/discussion/127924/plex-media-scanner-commandline-directory-parameter

@mwuanno said:

MovieFan wrote on November 20 2014, 7:04 AM: »

Ok.  finally got around to testing this and yes the --directory keyword does work, but you need to specify the section as well.

“Plex Media Scanner.exe” --scan --refresh --section ## --directory “full path to folder”

I cannot get the file option to work.  Everything I try gives me an error.  I am thinking that the file option is not meant for scanning 1 file, but maybe for indexing, which I did not try.

MovieFan has saved the day, this syntax does work. If it refreshes more stuff than just that one directory, I would have a look at those items in question. In my own case, with 20.000+ episodes, I get about 8 individual episodes from several different folders refreshed in addition to the directory specified. But they are the same each time. So they will get a thorough thrashing once I find the time.

I think it is about time we get this fixed…please…pretty please! :smiley:

I thought the post you linked to does say that it works for directories - So together with the section number it would scan the specified directory - is this not working?

The parameters that were showing in my log for the automatic update partial scan when a TV Show series was added, was
--scan --refresh --section 3 --directory "C:\Users\Public\Plex-Tests\TV-Shows1\The Fosters\Series 2"

What is it that you are referring to about time we get this fixed ?

The naming convention does refer to having separate directory for each season
https://support.plex.tv/hc/en-us/articles/200220687-Naming-Series-Season-Based-TV-Shows

@sa2000 Perhaps I am not being clear with what exactly the issue is. So let me try to explain it again.

When I use the Plex Media Scanner application I specify what I want it to do as follows:
/usr/lib/plexmediaserver/Plex\ Media\ Scanner -p -s -r -c 2 -d "/mnt/nt/Black Mirror/" --no-thumbs

it would look like I am using the same switches as you.

Now the expected result would be for it to ONLY scan and refresh items in the “/mnt/nt/Black Mirror” folder, but instead it seems to “scan” that folder for new items and then refresh other things that have not been properly tagged outside of that directory. This is the output of the Plex Media Scanner command:

GUI: Matching 'Animated Tales of the World'
GUI: Matching 'Davina Mccall: Life at the Extreme'
GUI: Matching 'Booze Traveler: Best Bars'
GUI: Matching 'Criminally Funny'```

Now, you can see the correct folder is scanned, that being Black Mirror, however, the matching/refresh is where things are going haywire. There is no reason that the other shows mentioned, which are located in their own folder in /mnt/nt, should be refreshed as I'm specifically telling it to refresh with-in the scope of the specified directory. 

The big issue is this, if you are trying to scan 20 specific dirs for new files and refresh the metadata, this means that the specified folder along with *ALL* the other things Plex decides it needs to look for outside of the target directory are scanned 20 times. That is a huge waste of resources and calls.

The posts that I have referred to all contain people complaining about the exact same issue. The -d flag seems to be ignored by the -r flag.

If you need more information I am open to other forms of communication such as im/irc/ or the discord [/r/plex channel](https://discordapp.com/channels/183275319594188800/183275319594188800 "/r/plex channel"), which might allow for more rapid communication.


Here is the excerpt from the last post that is related:
> MovieFan has saved the day, this syntax does work. If it refreshes more stuff than just that one directory, I would have a look at those items in question. In my own case, with 20.000+ episodes, **I get about 8 individual episodes from several different folders refreshed in addition to the directory specified. But they are the same each time.** So they will get a thorough thrashing once I find the time.

Just tried these with the command line scanner on os x

I ran this command:

/Applications/Plex\ Media\ Server.app/Contents/MacOS/Plex\ Media\ Scanner --scan --refresh --section 61 --directory "/path/to/folders/testfolder1"

And this does seem to scan just the specified directory, but as soon as you try to add the --force flag it requests metadata for all the folders in the library:

/Applications/Plex\ Media\ Server.app/Contents/MacOS/Plex\ Media\ Scanner --scan --refresh --force --section 61 --directory "/path/to/folders/testfolder1"

GUI: Scanning testfolder1
GUI: Scanning testfolder1/Season 1
GUI: Requesting metadata for 'testfolder1'
GUI: Requesting metadata for 'testfolder2'
GUI: Requesting metadata for 'testfolder3'
GUI: Requesting metadata for 'testfolder4'

So in this example I only want it to get/refresh the metadata for testfolder1 but its requesting metadata for all items in the library

@blim5001 are all of your shows current matched with metadata? By this I mean do any of your shows not have an actual match. In my case I have a number of shows that do not have entries in tvdb, imdb, etc. I’m thinking that yours are either manually matched or have found matches on these services.

I think what you are seeing is the same thing, just an extension of it. In my case, Plex is trying to match things as they are not matched, I’m assuming this is seen as just too unbearable to be left alone to the scanner . If all your shows are matched then that would indeed explain the lack of matching, and why the force option kicked it in.

@eldon.mcguinness said:
@sa2000 Perhaps I am not being clear with what exactly the issue is. So let me try to explain it again.

When I use the Plex Media Scanner application I specify what I want it to do as follows:
/usr/lib/plexmediaserver/Plex\ Media\ Scanner -p -s -r -c 2 -d "/mnt/nt/Black Mirror/" --no-thumbs

it would look like I am using the same switches as you.

Plex Media Server was using the long hand notation. i have not tried -c 3 instead of --section 3

Why don’t you do a test with debug logging enabled and restarting server to get fresh logs created and then run it and get the scanner log as well as piping out from your command line and server log - but do try first with the long hand arguments as in the example in my log file, so try

--scan --refresh --section 2 --progress --directory "/mnt/nt/Black Mirror/"

and get the logs showing it going to paths outside the specified path and I will pass them on

When I originally started the thread some were not matched, but at this point all my files are now matched (I think by forced refreshes of the whole library, I found patience quite useful as even if Plex thinks its finished, it has not), but they are using embedded metadata rather than online sources (fwiw these are personal media, organised as a tv library) I found that sometimes it would not pick up the metadata, so what I wanted to do was to force a refresh of just the problematic files/series

@blim5001 I’m not sure if this is enough of an issue for you, but if you could do the debug bit as well I’m sure the extra logs might help get this situated. My library is scanning atm, but I will be doing it tonight if possible.

I can, at this point, confirm using the long version of the flags has the exact same result:
/usr/lib/plexmediaserver/Plex\ Media\ Scanner --progress --scan --refresh --section 2 --directory "/mnt/nt/Black Mirror/" --no-thumbs

Would love to see this get fixed.

This could be a OS X related issue, not for sure…

On windows it works perfectly fine
cd /d E:\Plex
“Plex Media Scanner.exe” --verbose --scan --refresh --section 8 --directory “G:\Media\TV Series\Arrow”

This causes the scanner to just scan that show arrow. Make sure the paths are correct and you have the correct section.

@“eldon.mcguinness” when providing logs, please also include zip of the xml you get from this request
http://localhost:32400/library/sections
If server is signed in then also need to add server token
http://localhost:32400/library/sections?X-Plex-Token=xxxxxxxxxxxxxx
https://support.plex.tv/hc/en-us/articles/204059436-Finding-your-account-token-X-Plex-Token

@sa2000 Sorry for the LONG delay, but I now have some free time to really look at this. Do you have a preferred place for me to send the log data and what not? I’d rather not post it here, just in case it has some plex related goodies that should not be in the wild.

Steps I took:

  • Enabled Debug Logging and Verbose Logging on the server and Saved the settings
  • Stopped Plex Service
  • Deleted all old logs
  • Started Plex Service
  • Got the Sections XML data you wanted
  • Ran a scan of a single folder as described
/usr/lib/plexmediaserver/Plex\ Media\ Scanner --verbose --scan --refresh --progress --no-thumbs --section 2 --directory /mnt/nt/J-M/Jamie\'s\ Great\ Italian\ Escape/
  • Zipped up logs and XML data

This is happening on two different machines:

  • Ubuntu 17.04 x64 - Plex Version 1.6.1.3722
  • Ubuntu 16.10 x64 - Plex Version 1.6.1.3722

I have the tarball waiting, just let me know where you want me to send it.

Please provide the logs here

@sa2000 you can get the logs here:
https://nextcloud.progressivethink.in/index.php/s/ORxxMDN1WnicvN8

I will pm you the password for the share.

@eldon.mcguinness said:
@sa2000 you can get the logs here:
https://nextcloud.progressivethink.in/index.php/s/ORxxMDN1WnicvN8

I will pm you the password for the share.

Could you see if adding the following parameters gives us a scanner log in addition to your command line GUI log lines

--verbose > "full path to log file"

Also please could you send me by private message your Preferences.xml file