Command Line Scanner and Partial Refresh

@sa2000 I re-ran the command
/usr/lib/plexmediaserver/Plex\ Media\ Scanner --verbose --scan --refresh --progress --no-thumbs --section 2 --directory /mnt/nt/J-M/Jamie\'s\ Great\ Italian\ Escape/ > /tmp/scan.log 2>&1
and have attached it here:
https://nextcloud.progressivethink.in/index.php/s/PXSDAeegmjNfVLS
the password is the same as the last archive.

The output of the command can be found in scan.log

For what it is worth, I did run the previous command with --verbose and --progress in the last batch of logs. I did not see much of a difference between the output I copied and pasted before and what was logged this go around, but meh. \o/

@eldon.mcguinness said:
@sa2000 I re-ran the command
/usr/lib/plexmediaserver/Plex\ Media\ Scanner --verbose --scan --refresh --progress --no-thumbs --section 2 --directory /mnt/nt/J-M/Jamie\'s\ Great\ Italian\ Escape/ > /tmp/scan.log 2>&1
and have attached it here:
https://nextcloud.progressivethink.in/index.php/s/PXSDAeegmjNfVLS
the password is the same as the last archive.

The output of the command can be found in scan.log

For what it is worth, I did run the previous command with --verbose and --progress in the last batch of logs. I did not see much of a difference between the output I copied and pasted before and what was logged this go around, but meh. \o/

I need to know the time of start and end of the scan. The scan.log does not tell me what time it started and what time it finished. And the named media items in the the scan.log, what are the actual paths for them?

The scan.log shows one path being scanned
GUI: Scanning Jamie's Great Italian Escape
and then within that, I presume, there are 40+ items being scanned / matched.
Any of these outside the Jamie's Great Italian Escape directory?

PS: There have been significant changes to how the scanner runs in recent versions and the environment for the scanner jobs need to bet set to allow access to codecs libraries. So even if we get to the bottom of what the issue is with regards to the partial directory scanning, there will be other issues and I am not sure at this stage if this command line interface will continue to be supported

I need to know the time of start and end of the scan. The scan.log does not tell me what time it started and what time it finished. And the named media items in the the scan.log, what are the actual paths for them?

I don’t have the times the scan ran, though I can tell you that is a fresh restart of Plex with empty logs so the stamps IN the log should be spot on. As for the scan ending, I waiting for the log file to quit being appended to and then stopped the service, so the approximately seven (7) minute window in the logs should contain the information needed. I can’t imagine much outside noise got into the logs.

As for the file locations:

  • /mnt/nt/J-M/Jamies Great Italian Escape (Folder I'm scanning)
  • /mnt/nt/A-C/Absolute Genius Monster Builds
  • /mnt/nt/T-V/The After Party 2017
  • /mnt/nt/A-C/Beachin Rvs
  • /mnt/nt/A-C/Bikinis and Ski Slopes
  • /mnt/nt/A-C/Biq Digits
  • /mnt/nt/A-C/Bitchin Rides: High Octane
  • /mnt/nt/A-C/Britain at War Imperial War Museum At
  • /mnt/nt/A-C/Celebrities: In Therapy
  • /mnt/nt/D-F/Everyday Innovators
  • /mnt/nt/D-F/Flame Halfworlds
  • /mnt/nt/D-F/Flog It Trade Secrets
  • /mnt/nt/D-F/Fonejacker Christmas Special
  • /mnt/nt/G-I/Gareth Wyn Jones Milk Man
  • /mnt/nt/G-I/Hairspray Live
  • /mnt/nt/G-I/Hayley Bikinis Bars and Benidorm
  • /mnt/nt/G-I/History Channel Leonardo Da Vincis Book of Secrets
  • /mnt/nt/G-I/Holland Casino Met De Kaarten Op Tafel
  • /mnt/nt/G-I/Hotel Impossible 5 Star Secrets
  • /mnt/nt/G-I/How to Live Mortgage Free With Sarah Beeny
  • /mnt/nt/J-M/Kirsties Handmade Treasures
  • /mnt/nt/A-C/A League of Their Own Uk Us Road Trip
  • /mnt/nt/J-M/Lego Nexo Knights: The Book of Monsters
  • /mnt/nt/J-M/Matthew Evans for the Love of Meat
  • /mnt/nt/J-M/Mind Over Money With Nigel Latta
  • /mnt/nt/J-M/Mission Critical
  • /mnt/nt/N-P/Pop Quiz 2016
  • /mnt/nt/Q-S/Reggie Yates Hidden Australia
  • /mnt/nt/Q-S/Roaring With Pride
  • /mnt/nt/Q-S/Ross Kemp Libyas Migrant Hell
  • /mnt/nt/Q-S/Saved at the Heart of the Health Service
  • /mnt/nt/Q-S/Sicily Wonder of the Mediterranean
  • /mnt/nt/Q-S/Sicily Wonder of the Mediterranean 2017
  • /mnt/nt/Q-S/Spymasters
  • /mnt/nt/Q-S/Survive the Wild
  • /mnt/nt/T-V/Te Radars Chequered Past
  • /mnt/nt/T-V/Tequilas History and Culture
  • /mnt/nt/T-V/Toppers Wild West Thuis Best
  • /mnt/nt/W-Z/Wild on Water
  • /mnt/nt/W-Z/Wolfblood Secrets
  • ​/mnt/nt/T-V/the Railway​: Inside Kings Cross'
The scan.log shows one path being scanned

GUI: Scanning Jamie’s Great Italian Escape

and then within that, I presume, there are 40+ items being scanned / matched.

Any of these outside the Jamie’s Great Italian Escape directory?

YES, that really is the key to the issue. ALL of them are in their correspondingly named folders in the /mnt/nt/ folder, clearly outside of the folder being scanned.

PS: There have been significant changes to how the scanner runs in recent versions and the environment for the scanner jobs need to bet set to allow access to codecs libraries. So even if we get to the bottom of what the issue is with regards to the partial directory scanning, there will be other issues and I am not sure at this stage if this will continue to be available

I can’t imagine this will make many people happy as the alternative is a complete scan of the entire root node for those of us who use network locations for our media. Without this we are going to be thrashing our hdds and putting undue load on the servers and network due to the fact that most network storage do not have inotify et. al. Please tell me I’m misunderstanding what you mean by “this may not be available in the future.” What capacity/tool will be made available to trigger a partial scan or a scan of a particular directory like we, we being myself and other plex users, are trying to achieve if this is no longer available?

@eldon.mcguinness said:
@sa2000 I re-ran the command
/usr/lib/plexmediaserver/Plex\ Media\ Scanner --verbose --scan --refresh --progress --no-thumbs --section 2 --directory /mnt/nt/J-M/Jamie\'s\ Great\ Italian\ Escape/ > /tmp/scan.log 2>&1

Have you tried without some of those options. I would try with just the basic then add the others 1 at a time.

/usr/lib/plexmediaserver/Plex\ Media\ Scanner --scan --refresh --section 2 --directory /mnt/nt/J-M/Jamie\'s\ Great\ Italian\ Escape/ > /tmp/scan.log 2>&1

@“MovieFan.Plex” Well, I’m going to assume we can agree that at a minimum the --scan, --section, and --directory options would be kept as without those we would not be scanning the desired directory and we would not be specifying to what section the media should be added.

–scan
I started with:
/usr/lib/plexmediaserver/Plex\ Media\ Scanner --scan --section 2 --directory SOMEDIRECTORY

This stays IN the desired directory and DOES NOT trigger the extra files, which are outside of the folder specified as the directory to scan. However, this also does not result in any tagging or art working being fetched.

–refresh
/usr/lib/plexmediaserver/Plex\ Media\ Scanner --scan --refresh --section 2 --directory SOMEDIRECTORY

Seeing that issue I proceeded to add the --refresh option, which results in the files in the specified directory being scanned AND tagged, but it also results in the UNMATCHED media OUTSIDE of the specified directory to attempt to be matched.

–no-thumbs
The --no-thumbs option was added later, in both cases, in an attempt to try and stop thumbs from being generated as I don’t require them. In either case:
/usr/lib/plexmediaserver/Plex\ Media\ Scanner --scan --no-thumbs --section 2 --directory SOMEDIRECTORY
OR
/usr/lib/plexmediaserver/Plex\ Media\ Scanner --scan --refresh --no-thumbs --section 2 --directory SOMEDIRECTORY

–progress and --verbose
These tags were added to try and get a better picture as to what is going on and to provide error/logging information here.

For what it is worth, I have tried both the letter and word forms of these options and they result in the same thing.

–refresh
/usr/lib/plexmediaserver/Plex\ Media\ Scanner --scan --refresh --section 2 --directory /mnt/nt/J-M/Jamie\'s\ Great\ Italian\ Escape/
Seeing that issue I proceeded to add the --refresh option, which results in the files in the specified directory being scanned AND tagged, but it also results in the UNMATCHED media OUTSIDE of the specified directory to attempt to be matched.

That doesn’t sound right. It should stay in that folder and subfolders, unless it’s the subfolders you mean. There isn’t a way to restrict scanning to ONLY a folder (it’s the folder and all subfolders). If the above is scanning other folders, that’s wrong.

I gave the following a try with the same results:
/usr/lib/plexmediaserver/Plex\ Media\ Scanner --scan --refresh --section 2 --directory /mnt/nt/J-M/Jamie\'s\ Great\ Italian\ Escape/

  • GUI: Scanning Jamie’s Great Italian Escape
  • GUI: Matching ‘Absolute Genius Monster Builds’
  • GUI: Requesting metadata for ‘Absolute Genius Monster Builds’
  • GUI: Matching ‘The After Party 2017’
  • GUI: Requesting metadata for ‘The After Party 2017’
  • GUI: Matching ‘Beachin’ Rv’s’
  • GUI: Requesting metadata for ‘Beachin’ Rv’s’
  • GUI: Matching ‘Bikinis and Ski Slopes’
  • GUI: Requesting metadata for ‘Bikinis and Ski Slopes’
  • GUI: Matching ‘Biq Digits’
  • GUI: Requesting metadata for ‘Biq Digits’
  • GUI: Matching ‘Bitchin’ Rides: High Octane’
  • GUI: Requesting metadata for ‘Bitchin’ Rides: High Octane’
  • GUI: Matching ‘Britain at War Imperial War Museum At’
  • GUI: Requesting metadata for ‘Britain at War Imperial War Museum At’
  • GUI: Matching ‘Celebrities: In Therapy’
  • GUI: Requesting metadata for ‘Celebrities: In Therapy’
  • GUI: Matching ‘Everyday Innovators’
  • GUI: Requesting metadata for ‘Everyday Innovators’
  • GUI: Matching ‘Flame Halfworlds’
  • GUI: Requesting metadata for ‘Flame Halfworlds’
  • GUI: Matching ‘Flog It Trade Secrets’
  • GUI: Requesting metadata for ‘Flog It Trade Secrets’
  • GUI: Matching ‘Fonejacker Christmas Special’
  • GUI: Requesting metadata for ‘Fonejacker Christmas Special’
  • GUI: Matching ‘Gareth Wyn Jones Milk Man’
  • GUI: Requesting metadata for ‘Gareth Wyn Jones Milk Man’
  • GUI: Matching ‘Hairspray Live’
  • GUI: Requesting metadata for ‘Hairspray Live’
  • GUI: Matching ‘Hayley Bikinis Bars and Benidorm’
  • GUI: Requesting metadata for ‘Hayley Bikinis Bars and Benidorm’
  • GUI: Matching ‘History Channel Leonardo Da Vincis Book of Secrets’
  • GUI: Requesting metadata for ‘History Channel Leonardo Da Vincis Book of Secrets’
  • GUI: Matching ‘Holland Casino Met De Kaarten Op Tafel’
  • GUI: Requesting metadata for ‘Holland Casino Met De Kaarten Op Tafel’
  • GUI: Matching ‘Hotel Impossible 5 Star Secrets’
  • GUI: Requesting metadata for ‘Hotel Impossible 5 Star Secrets’
  • GUI: Requesting metadata for ‘The House of Muscle’
  • GUI: Matching ‘How to Live Mortgage Free With Sarah Beeny’
  • GUI: Requesting metadata for ‘How to Live Mortgage Free With Sarah Beeny’
  • GUI: Matching ‘Kirsties Handmade Treasures’
  • GUI: Requesting metadata for ‘Kirsties Handmade Treasures’
  • GUI: Matching ‘A League of Their Own Uk Us Road Trip’
  • GUI: Requesting metadata for ‘A League of Their Own Uk Us Road Trip’
  • GUI: Requesting metadata for ‘The Legend of Master Legend’
  • GUI: Matching ‘Lego Nexo Knights: The Book of Monsters’
  • GUI: Requesting metadata for ‘Lego Nexo Knights: The Book of Monsters’
  • GUI: Matching ‘Matthew Evans for the Love of Meat’
  • GUI: Requesting metadata for ‘Matthew Evans for the Love of Meat’
  • GUI: Matching ‘Mind Over Money With Nigel Latta’
  • GUI: Requesting metadata for ‘Mind Over Money With Nigel Latta’
  • GUI: Matching ‘Mission Critical’
  • GUI: Requesting metadata for ‘Mission Critical’
  • GUI: Matching ‘Pop Quiz 2016’
  • GUI: Requesting metadata for ‘Pop Quiz 2016’
  • GUI: Matching ‘Reggie Yates Hidden Australia’
  • GUI: Requesting metadata for ‘Reggie Yates Hidden Australia’
  • GUI: Matching ‘Roaring With Pride’
  • GUI: Requesting metadata for ‘Roaring With Pride’
  • GUI: Matching ‘Ross Kemp Libyas Migrant Hell’
  • GUI: Requesting metadata for ‘Ross Kemp Libyas Migrant Hell’
  • GUI: Requesting metadata for ‘Sacred Sites’
  • GUI: Matching ‘Saved at the Heart of the Health Service’
  • GUI: Requesting metadata for ‘Saved at the Heart of the Health Service’
  • GUI: Matching ‘Sicily Wonder of the Mediterranean’
  • GUI: Requesting metadata for ‘Sicily Wonder of the Mediterranean’
  • GUI: Matching ‘Sicily Wonder of the Mediterranean 2017’
  • GUI: Requesting metadata for ‘Sicily Wonder of the Mediterranean 2017’
  • GUI: Matching ‘Spymasters’
  • GUI: Score for ‘60 Minutes’ (1968) is 78
  • GUI: Requesting metadata for ‘Spymasters’
  • GUI: Matching ‘Survive the Wild’
  • GUI: Requesting metadata for ‘Survive the Wild’
  • GUI: Matching ‘Survivor New Zealand’
  • GUI: Score for ‘wild new zealand’ (2016) is 80
  • GUI: Requesting metadata for ‘Wild New Zealand’
  • GUI: Matching ‘Te Radars Chequered Past’
  • GUI: Requesting metadata for ‘Te Radars Chequered Past’
  • GUI: Matching ‘Tequilas History and Culture’
  • GUI: Requesting metadata for ‘Tequilas History and Culture’
  • GUI: Requesting metadata for ‘The Tick’
  • GUI: Matching ‘Toppers Wild West Thuis Best’
  • GUI: Requesting metadata for ‘Toppers Wild West Thuis Best’
  • GUI: Matching ‘Wild on Water’
  • GUI: Requesting metadata for ‘Wild on Water’
  • GUI: Matching ‘Wolfblood Secrets’
  • GUI: Requesting metadata for ‘Wolfblood Secrets’
  • GUI: Matching ‘​the Railway​: Inside King’s Cross’
  • GUI: Requesting metadata for ‘​the Railway​: Inside King’s Cross’

As you can see it is scanning the desired folder and then proceeding to try to match files that were not previously matched, ALL of which are NOT in the /mnt/nt/J-M/Jamie\'s\ Great\ Italian\ Escape/ folder. You can see where many of these files are by looking at this previous post.

Try removing the last “/”. I don’t use Linux, but on my Windows system, adding the last “” makes it not work.

@MovieFan.Plex said:
Try removing the last “/”. I don’t use Linux, but on my Windows system, adding the last "" makes it not work.

Just tried it and I get the same result.

As I said before, it just seems like the --refresh option forces Plex to not only refresh the file in the directory, but also to try to match/tag anything that it has not been able to match/tag before. All of the shows that are showing as “matching” as shows that have not been “matched” in Plex. I hope what I’m trying to get across here is making sense. The expected behaviour would be for the refresh to be limited to the files/folders specified by the --directory option. If you are not seeing this on your side, try to create a show that does not have a match via the Plex/TVDB/TMDB scanners and see if that helps to reproduce it. I have been able to reproduce this on every machine/vps I’ve tried it on and the only time I do not see this is when I have ALL of the shows in my library properly matched.

Sorry, nothing to add.
Just need to make a post to get rid of the stupid forum message about unanswered questions pop up even when there are no posts to accept or reject. afaik it happens when you have clicked no, then the post gets edited and the forum thinks something needs an answer but does not display the yes no button. Its a problem that has been around for a long time


@sa2000 said:
PS: There have been significant changes to how the scanner runs in recent versions and the environment for the scanner jobs need to bet set to allow access to codecs libraries. So even if we get to the bottom of what the issue is with regards to the partial directory scanning, there will be other issues and I am not sure at this stage if this command line interface will continue to be supported

Could the environment settings be the root of my problem here. All I have set currently, is:

PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR='/var/lib/plexmediaserver/Library/Application Support'
LD_LIBRARY_PATH=/usr/lib/plexmediaserver

Cheers.

@EddieA said:

@sa2000 said:
PS: There have been significant changes to how the scanner runs in recent versions and the environment for the scanner jobs need to bet set to allow access to codecs libraries. So even if we get to the bottom of what the issue is with regards to the partial directory scanning, there will be other issues and I am not sure at this stage if this command line interface will continue to be supported

Could the environment settings be the root of my problem here. All I have set currently, is:

PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR='/var/lib/plexmediaserver/Library/Application Support'
LD_LIBRARY_PATH=/usr/lib/plexmediaserver

Cheers.

Could be - not sure. Need to look into it.
But you may be able to help here - you appear to have got a real Plex Media Scanner log file for your command line job whereas @“eldon.mcguinness” did not. This too could be environment variable related !

The scanner process when invoked internally by Plex Media Server does have additional environment variables introduced recently. The ones that specify paths are

EAE_ROOT
FFMPEG_EXTERNAL_LIBS

and there is also environment variable for the server token X_PLEX_TOKEN

As the syntax for the path varies from platform to platform and also may be different for different versions of Plex Media Server, I am not going to try and tell you what these extra environment variables should be set to but best to get a scan fired by Plex Media Server and then look at the Plex Media Server.log to see what the paths are set to for the scanner job logged line

This is an example of what the log file entry would look like

May 11, 2017 10:54:11.704 [19568] DEBUG - Job running: EAE_ROOT='\\?\C:\Users\plex\AppData\Local\Plex Media Server\Transcoder\EasyAudioEncoder' FFMPEG_EXTERNAL_LIBS='\\\\?\\C\:\\Users\\plex\\AppData\\Local\\Plex\ Media\ Server\\Codecs\\e96c1d3-1208-windows-i386\\' X_PLEX_TOKEN='xxxxxxxxxxxx' C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe --scan --refresh --section 28 --directory C:\Users\Public\Plex-Tests\Home-Video-Tests 

The environment variables would be set to the text within the ' characters showing in the log line

@sa2000 I found another log file in another location that might be what you’re looking for, I have included it in the archive below with all the other data collected again as well:

nextcloud.progressivethink.in/index.php/s/U61ZKuNnq5OSida

Just for clarification:

  • Plex Media Scanner.Log is from /var/lib/plexmediaserver/Library/Logs
  • Plex Media Server.Log is from /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs

As for environmental variables, the only one that I am setting when I switch to the plex user vi su is LD_LIBRARY_PATH=/usr/lib/plexmediaserver

I found a section of the new log file very interesting, you can see on line 33 it finished scanning the specified folder, then on line 34 it starts a “Refreshing section 2 of type: 2”. Now, while I am not a developer here, it sounds to me like it is not telling the service to stay inside the directory and instead performs a refresh of the entire section.

@eldon.mcguinness said:
@sa2000 I found another log file in another location that might be what you’re looking for, I have included it in the archive below with all the other data collected again as well:

nextcloud.progressivethink.in/index.php/s/U61ZKuNnq5OSida

Just for clarification:

  • Plex Media Scanner.Log is from /var/lib/plexmediaserver/Library/Logs
  • Plex Media Server.Log is from /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs

As for environmental variables, the only one that I am setting when I switch to the plex user vi su is LD_LIBRARY_PATH=/usr/lib/plexmediaserver

I found a section of the new log file very interesting, you can see on line 33 it finished scanning the specified folder, then on line 34 it starts a “Refreshing section 2 of type: 2”. Now, while I am not a developer here, it sounds to me like it is not telling the service to stay inside the directory and instead performs a refresh of the entire section.

Very useful log - thank you

@eldon.mcguinness said:

I found a section of the new log file very interesting, you can see on line 33 it finished scanning the specified folder, then on line 34 it starts a “Refreshing section 2 of type: 2”. Now, while I am not a developer here, it sounds to me like it is not telling the service to stay inside the directory and instead performs a refresh of the entire section.

That is exactly what is happening after scanning the directory path. It is doing a refresh without restricting it to the specified directory

Now that we have the log confirming this, I am raising it with the development team

Do you have “Autoupdate library” enabled? I’m wondering if the command line is then triggering that.

@“MovieFan.Plex” said:
Do you have “Autoupdate library” enabled? I’m wondering if the command line is then triggering that.

No it is not.
We have FSEventLibraryUpdatesEnabled="0"

@“eldon.mcguinness” Could you do me a directory test when the directory is below the root of that location.
The library has multiple locations and you are scanning a whole location using the --directory parameter

Could you try adding a TV Show below the root of that location and having the directory of that TV Show as the parameter and let me know the outcome

@sa2000 said:
Could you try adding a TV Show below the root of that location and having the directory of that TV Show as the parameter and let me know the outcome

Tell me if this is what you mean, I used to have my TV library arranged in this manner:
/mnt/nt/showname/showname.s01e01.ts
but recently I changed it to
/mnt/nt/Q-S/showname/showname.s01e01.ts

During both times I’ve had /mnt/nt as the directory that is scanned by Plex. In the former case I would scan /mnt/nt/showname instead of the current location format which is /mnt/nt/Q-S/showname.

It sounds to me like you want to to try the way I used to have it organized, is that correct? If so then I can tell you now that I had the same issue at that time as well. If that is not what you mean then could you give me an example?

@eldon.mcguinness said:

@sa2000 said:
Could you try adding a TV Show below the root of that location and having the directory of that TV Show as the parameter and let me know the outcome

Tell me if this is what you mean, I used to have my TV library arranged in this manner:
/mnt/nt/showname/showname.s01e01.ts
but recently I changed it to
/mnt/nt/showname/Q-S/showname.s01e01.ts

During both times I’ve had /mnt/nt as the directory that is scanned by Plex. In the former case I would scan /mnt/nt/showname

It sounds to me like you want to to try the way I used to have it organized, is that correct? If so then I can tell you now that I had the same issue at that time as well. If that is not what you mean then could you give me an example?

At the moment it is a theory

Actually you are already specifying a TV Show name as a parameter

At the moment you have this as a location /mnt/nt/J-M/ and you are specifying the path
/mnt/nt/J-M/Jamie's Great Italian Escape/

Lets change the test to adding a Season folder
/mnt/nt/J-M/Jamie's Great Italian Escape/Season 01
and move the episodes below that
and the command line to try

/usr/lib/plexmediaserver/Plex\ Media\ Scanner --scan --refresh --section 2 --directory /mnt/nt/J-M/Jamie\'s\ Great\ Italian\ Escape/Season\ 01`

I am going to also ask you to give me list directory showing all files and links info - you can send by private message

Whilst I can see where it may be going wrong, I have not been able to reproduce the problem

@eldon.mcguinness said:

@sa2000 said:
Could you try adding a TV Show below the root of that location and having the directory of that TV Show as the parameter and let me know the outcome

Tell me if this is what you mean, I used to have my TV library arranged in this manner:
/mnt/nt/showname/showname.s01e01.ts
but recently I changed it to
/mnt/nt/showname/Q-S/showname.s01e01.ts

During both times I’ve had /mnt/nt as the directory that is scanned by Plex. In the former case I would scan /mnt/nt/showname instead of the current location format which is /mnt/nt/Q-S/showname.

Could the Q-S be the problem. That is where you would normally see a SEASON folder. Is this even supported?