PlexTrainingVideoScannerAndAgent
PlexTrainingVideoScannerAndAgent copied to clipboard
Issue with library not populating on linux
Thanks for the hard work on this, I have been looking for something exactly like this for a long time!
I believe everything is setup correctly but when adding the agents to a new library it does a scan for about 20 seconds and then stops without anything populating into the library.
The only error message I can find in the agent log files is CRITICAL (sandbox:298) - Function named 'ValidatePrefs' couldn't be found in the current environment
My media is named :
Course 1 Filename.mp4 Filenameother.mp4
Course2 Filenamea.mp4 Filenameb.mp4
Let me know if I can provide any additional log files and if so which ones.
I also tried renaming 1 course to exactly like you have it:
Lynda.com.Course1 .Welcome Filename.mp4
And that also doesn't seem to do the trick.
Here is a screenshot of how one of my courses is organized:
Also, did you enter your x-plex-token in the advanced tab on the edit screen of the library? If not you need to do that. There is also a checkbox there to turn on debug logging which may give us more info. The ValidatePrefs may be failing because the token is missing.
Just realised that my file names doesn't have 01_01 in them. Adding and testing quick.
Yes the token is in there and I've also had debug logging turned on since the start. Not all of my training is organised like that but I did it with one of them as a test and that didn't seem to do the trick.
I have attached a more complete log file below.
com.michas.plex.agents.personalmedia.log
Some more information : The library is sitting on Gdrive behind https://github.com/dweidenfeld/plexdrive. Not sure if that makes a difference but if so i'll try get some files locally to test as well.
In addition to the above. I added 01_01 to a filename and that didn't work. Also complete eliminated gdrive and plexdrive and that didn't work either.
Yeah, I will look at the logs but I am not a very experienced plex plugin developer so I'm not sure I can figure it out. Also, I have no way to test on Linux at this point so if it is something specific to maybe file paths in linux then I can't test it.
Thank you.
So, I looked through the logs and even though there is that critical error it still appears to scan and find matches. Do you have nothing listed in the library from within the Plex UI?
I think the ValidatePrefs thing must be specific to Plex on Linux because I do not have any references to that in my code and my logs don't contain it either.
Also, it looks like your directory structure might be too deep, you have Lynda/Lynda/Course Title/MediaFile.mp4. I assume the first Lynda is the library directory, the second Lynda will probably be treated as the course title, the third directory will be the season name instead of the course name.
So, the validate prefs issue and the scanning problem may be unrelated. It may just mean that we need to add in regular expression patterns that match how your media is organized.
Library stays empty. With folder view I can see all of the folders but also no files populated in the folders.
I created another folder with just 1 course with the the following naming /training/Lynda course 1/01.Welcome/filename.mp4 and added the /training directory as a library with the right scanner and agent.
Attached is that log file. Logfile.log
In the plex console under alerts I see this
10:41am Library scan complete: Extra information may still be downloading from the Internet 10:41am Scanning Lynda 100 Courses and Counting - David Rivers on Elearning
Here is the screenshot of the library after the scan using the folder view.
It seems like it's picking up the folder structure just fine but the actual .mp4 files are not getting scanned and added.
I'm going to install a test plex media server on windows later tonight nad use the exact same library files which will hopefully show whether the issue is on Linux or with me doing something stupid.
Forgot to mention I tried a different scanner and agent called "Extended personal media scanner" (also a plugin) which picks up all the files and adds them to the library it's obviously just a mess then because it doesn't know how this should be organised.
Ok so here is what I did. I installed a PMS server on Windows. Added the scanner and plugins and it seems like I get exactly the same behaviour. I even went so far as to copy your naming convention exactly as per the above.
Below is the screenshot of the library "folder view" after scan. Folder structure is there but no files in the library.
Log files looks clean with similar information as the Linux one.
And another update. the problem seems to be related to the scanner. I set the scanner to "plex series scanner" and the agent to training video agent" and files started populating.
Very interesting....can you try one more thing when you get a chance? I noticed in the logs that most, if not all, of the video files ended like .77s.mp4, .44s.mp4. Can you try with just one course and maybe just one file in that course to remove the .77s or whatever is before the mp4. I wonder if the scanner is picking the files up and seeing the .77s as the file extension and then it doesn't think its a video file so it ignores it.
If this is the case it may be an easy fix, since then its just creating regular expressions that match the pattern .XXy.mp4
So, I just want to add that I just tested this on my server with a new course and it worked fine. I was afraid maybe updates to Plex server may have broken something in my code.
That didn't seem to resolve the problem. If it works for you and everything else is equal I can only assume I must be doing something wrong. Not sure what though at this point in time.
Ok, I have one other thing we can try. Open the scanner py file in a text editor and find the line: loggingPath = 'P:\AppData\Plex Media Server\Logs' #os.path.expandvars(LOC_WIN) change the path there inside the '' to a path that exists on your server.
Then just below that a little bit you will find: #logging.debug(logMsg) and remove the # before it so it is uncommented.
The scanner logging is off and I wasn't able to figure out how to make it get toggled with the logging preference. The scanner runs in a different context than the agent apparently so it doesn't have access to all the same framework code.
This should give us a "training_video_scanner.log" in the path you specify with hopefully some clues as to what is not working in the scanner.
Ahah now we seem to be finding something new. Everything in scanner runs fine and it picks up the media etc and then at the end of the log file I get this.
2017-09-27 00:52:58,550 (7f47d97fa700) : CRITICAL (runtime:1128) - Exception in thread named '_handle_request' (most recent call last): File "/usr/lib/plexmediaserver/Resources/Plug-ins-c789b3fbb/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/runtime.py", line 1126, in _start_thread f(*args, **kwargs) File "/usr/lib/plexmediaserver/Resources/Plug-ins-c789b3fbb/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/interfaces/socketinterface.py", line 126, in _handle_request self.finish() File "/usr/lib/plexmediaserver/Resources/Plug-ins-c789b3fbb/Framework.bundle/Contents/Resources/Platforms/Shared/Libraries/tornado/web.py", line 565, in finish self.request.finish() File "/usr/lib/plexmediaserver/Resources/Plug-ins-c789b3fbb/Framework.bundle/Contents/Resources/Platforms/Shared/Libraries/tornado/httpserver.py", line 432, in finish self.connection.finish() File "/usr/lib/plexmediaserver/Resources/Plug-ins-c789b3fbb/Framework.bundle/Contents/Resources/Platforms/Shared/Libraries/tornado/httpserver.py", line 262, in finish self._finish_request() File "/usr/lib/plexmediaserver/Resources/Plug-ins-c789b3fbb/Framework.bundle/Contents/Resources/Platforms/Shared/Libraries/tornado/httpserver.py", line 285, in _finish_request self.stream.read_until("\r\n\r\n", self._on_headers) File "/usr/lib/plexmediaserver/Resources/Plug-ins-c789b3fbb/Framework.bundle/Contents/Resources/Platforms/Shared/Libraries/tornado/iostream.py", line 87, in read_until self._check_closed() File "/usr/lib/plexmediaserver/Resources/Plug-ins-c789b3fbb/Framework.bundle/Contents/Resources/Platforms/Shared/Libraries/tornado/iostream.py", line 241, in _check_closed raise IOError("Stream is closed") IOError: Stream is closed
Did you get any further with this? I'm thinking of looking into this when I get time as I'd love to use this plugin on my plex server.
It didin't work for me either. I am currently using plex media scan and will change it later to the plextraining scan that seems the only way to make it work with the test i did before.
I also noticed that not all posters are getting a img. Will look into it later.
Update*