[REL] Extended Personal Media Shows Agent

@Hathalud Did you also install the Scanner from here: https://bitbucket.org/mjarends/plex-scanners. I tried the path you posted in my test environment and the scanner/metadata agent added the show, season and episode as expected to Plex.

If you did install both the scanner and metadata agent can you provide the logs for the metadata agent. The logs can be obtained by following the instructions under the Plug-in Logs Location section on this page: https://bitbucket.org/mjarends/extendedpersonalmedia-agent.bundle

If I see the log I should be able to quickly determine where the issue is.

@mjarends That did it! I didn’t realize that I had to install a scanner too
 May I humbly suggest that you edit the first post to this thread to be a bit more clear
 pointing to both of your projects instead of just the agent would have got me started in the right direction sooner.

I will note that I had to create a whole new library for the title names to be populated from the file system, but that was a minor detail for me in this case. Telling the server to refresh the existing library didn’t change any of the data there. Not sure why, but I’m happy as can be!

Thank you so very much for your help and this awesome set of plugins!

@Hathalud You are welcome. Just happy others find the plugins as useful as I do. Also thanks for the suggestion - I will update the first post to both plugins.

Hi mjarends, I’ve installed the scanner and bundle after following the advice on this other page http://diyfuturism.com/index.php/2017/12/14/auto-downloading-youtube-videos-for-plex-media-server/ to check but I still can’t seem to get it to pick up my files. My settings match what is in the screenshots (I have both the scanner and agent set to Extended Personal Media Scanner).

I know Plex is scanning the folders as I can see in the activity history the files it scans, yet I see nothing in my Library [Log removed in edit].

What am I doing wrong?

I’m on Ubuntu 16.04. Log attached, I see it is using the Movie scanner even though I’ve selected yours.

Thanks

Ignore me, I had the naming convention wrong :S Thanks again for making this useful tool.

Is there any way for the agent to pick up the poster image (e.g. folder.jpg or poster.jpg) in the media folder during scanning? Thanks.

Thanks for the wonderful plug in. But I am tearing my hair out a bit trying to understand what’s not working.

Firstly, I think the scanner is working because it is bringing up the episode name correctly. I’m on Windows and didn’t previously have a Scanners folder and so created one. Don’t know if that’s normal but if so you might want to update the instructions.

F:/Plex Media Server/Scanners/Series/Extended Personal Media Scanner.py

Secondly, most files are ok when first loaded, but a metadata refresh then combines those with the same date. This is what I have as file names.

Running the Game\S2016E01 - 2016-02-21 - Intro - Running the Game.mkv
Running the Game\S2016E02 - 2016-02-21 - Your First Adventure, Running the Game #1.mkv
Running the Game\S2016E03 - 2016-02-21 - Your First Session, Running the Game #2.mkv
Running the Game\S2016E04 - 2016-02-21 - Running your First Dungeon, Running the Game #3.mkv
Running the Game\S2016E05 - 2016-02-28 - Making Characters, Running the Game #4.mkv

Currently I’m seeing episodes 1, 2 and 4 combined. 3 is separate though on the same date. 5 is by itself.

I see the same with other variations of the naming allowed eg Running the Game - 2016-02-21_1 - Intro


It’s likely something I’m missing but I can’t for the life of me find it. Server version is 1.12.0.4829 and your plugin/scanner were newly installed today.

UPDATE:
I picked up on the files all having “Running the Game” in the title. When I removed that, it all cleaned up perfectly. :slight_smile: Looks like an issue where the program name is repeated in the episode title and it only occurs when they are on the same date.

It does not work with Running the Game\Running the Game - 2016-02-21_02 - Your First Adventure.mkv format. They all combine as previously.

UPDATE to my UPDATE:
No, wrong. Same date = combined episode.

So sorry. Completely my error in the end. The library was not using your scanner but instead the plex scanner.

I’d love to have poster support at some point. I have lots of different lessons added via the agent, and would not want to change the poster one by one.

Edit: Oh yeah, I forgot this sits on top of Local Media Asset agent, meaning you can just name your poster poster.jpg and such. Nevermind.

@StillAzure :slight_smile: glad you found the answer. I was just going to post that you need to follow the Local Media Asset agent naming standards.

I am not the best programmer in the world but I was trying to have a hack around to get something working and this is as far as I have got before I realised that I don’t seem to be able to change the programming. Does anybody have any idea why I can’t change the programming in the "Extended Personal Media Scanner.py " file?

I can change the Regex without any problems e.g.

# Iphone Videos - My naming - Almost working still need work
#e.g. YYYY\MM\yyyy-mm-dd HH.MM.ss Episode Title,pm4
r'(?P<showTitle>[^\\/]+)[\\/](?P<seasonNumber>[0-9]{2})([-\. ]+(?P<seasonTitle>[^\\/]+)){0,1}[\\/][^\\/]*?(?P<episodeYear>[0-9]{4})[-\. ](?P<episodeMonth>[0-9]{2})[-\. ](?P<episodeDay>[0-9]{2})[ ]*(?P<episodeIndex>[0-9]+){0,6}[ ]*[-\.]{0,1}[ ]*(?P<episodeTitle>.*)\.(?P<ext>.+)$'

But if I try to change any of the coding to test things

e.g.
dayOfYear = str(self.episodeReleaseDate.timetuple().tm_yday)
to
dayOfYear = ‘20’

then plex will not find anything.

I thought I may be programming Pythons syntax incorrectly at first but I have tried ‘20’, “20” and 20.
I have also tried adding a log function e.g.

dayOfYear = str(self.episodeReleaseDate.timetuple().tm_yday)
log(‘setValues’, ‘episode date: %s’, str(self.episodeReleaseDate.timetuple().tm_yday))

but again plex will then not find anything.

I have tried deleting the library, stopping Plex starting Plex and adding the library again but no plex will not show me anything if I change any of the programing except the Regex.

Any ideas please?

Does anybody have any idea why I can’t change the programming in the "Extended Personal Media Scanner.py " file?

I can change the Regex without any problems e.g.

#DC - Iphone Videos - My naming - Almost working
#e.g. YYYY\MM\yyyy-mm-dd HH.MM.ss Episode Title,pm4
 r'(?P<showTitle>[^\\/]+)[\\/](?P<seasonNumber>[0-9]{2})([-\. ]+(?P<seasonTitle>[^\\/]+)){0,1}[\\/][^\\/]*?(?P<episodeYear>[0-9]{4})[-\. ](?P<episodeMonth>[0-9]{2})[-\. ](?P<episodeDay>[0-9]{2})[ ]*(?P<episodeIndex>[0-9]+){0,6}[ ]*[-\.]{0,1}[ ]*(?P<episodeTitle>.*)\.(?P<ext>.+)$'

But if I try to change any of the coding to test things

e.g.
dayOfYear = str(self.episodeReleaseDate.timetuple().tm_yday)
to
dayOfYear = '20'

then plex will not find anything.

I thought I may be programming the Python syntax incorrectly at first but I have tried ‘20’, “20” and 20.
I have also tried adding a log function e.g.

dayOfYear = str(self.episodeReleaseDate.timetuple().tm_yday)
log('setValues', 'episode date: %s', str(self.episodeReleaseDate.timetuple().tm_yday))

but whatever I do, unless I revert to the orignal code OR hash/comment out the coding I have put in, then plex finds nothing.

Any ideas please? - Thanks

@kwakers The plugins already have regexes to parse the season title and they are already setting the season summary data. I had removed setting the season title because it doesn’t work thru the metadata plugins. There is a bug in the Plex plug-in API that prevents the season title or summary data from being saved in the database. If you save the season title or summary from the web application it works. I confirmed this again in my local test environment with the latest version of Plex. You are free to try for yourself and if you find differently please share back.

The changes that you are making above look correct. There are .pyc (compiled python files) in the same directory as the .py files you are editing. A new .pyc file is created when Plex calls the plugin and the .py file is changed. You can verify that your changes have been compiled into the newest .pyc file by comparing the timestamps. Additionally the Plex scanner and Metadata Agent plugins are called with you select “Update Library” in the plex web applications. If you want to only execute the Metadata Agent plugin then select “Refresh Metadata” in the Plex web app.

I am looking at the following: from an iphone video, auto populate as follows, Show Tile=Year, Season=Month, EpisodeNumber=HHMMSS EpisodeTitle=The rest of the filename. I may want to change it around or mess in some other way so I was hoping to play with the .py file, but can’t!! Arghhh


OK, so I always run everything as a user (username User) and let windows 10 tell me if it needs admin rights and I put in the password when required (all for security). I am also never signed into plex (either server or user) as I run everything locally. I usually run uMatrix on my FF browser, but can test on Chrome and ME/IE.

So my plex client, that works fine, is running under account User, and your plugin works fine under account User unless I try to change anything. What is interesting is that in C:\Users\User\AppData\Local\Plex Media Server\Scanners\Series I can happily see the .py file but NO .pyc files. Also as I said if I change the .py file it stops working, but again no .pyc files.

Also the C:\Users\User\AppData\Local\Plex Media Server\Plug-ins\extendedpersonalmedia-agent.bundle\Contents\Code has NO .pyc files either.

So could this be a Plex / Windows User account issue? I have tried deleting the library, stopping plex, changing the .py and restarting but still no joy.

Even so I can change the Regex and it happily reads the changes to the .py and I can add any number of comments e.g. #Mystuff, but not a change to the actual code!!

I’m using notepad++ and the Encoding is “UTF-8 without BOM”, I assume that is correct?

Oh
this guy has written some code to auto pop Season Tiles, but I can’t get it to work - I guess because I have not set my X-Plex-Token as I do not log into Plex. I think he has used some of your code or you some of his. Anyway this is the link.

github.com/jmichas/PlexTrainingVideoScannerAndAgent

Not sure if you would want to try it or not and if I have to log into plex I probably won’t use it.

Thanks for the link to the agent/scanner. I should be able to replicate the same code in my metadata agent plugin. jmichas plugin is calling the web API in order to set the season summary and title values. It would require setting your Plex Auth Token in the plugin configuration properties in order for it work (which would require a one-time login).

OK. Without logging out of my User account I logged into the Admin account and opened Explorer, chose “This PC” and searched for “Extended Personal Media Scanner.pyc” 
 NOTHING, not a thing


I’m running Plex Version 1.12.1.4885 on updated Windows 10. Have they change the .pyc to run in memory or something?

Perhaps a tick box in the config for the web API would be good if you could please. Thanks

Test on my vb box using just the Admin and using notepad (as best I could) and it all worked OK. Then I notice my PC had new windows updates it wanted to install. So I let them install and rebooted


and



where has the scanner selection gone???

Driving me nuts now!!!

Right
 got it back. Whilst trying to test and reinstall I accidentally removed the Series directory so the .py files were directly under Scanners.

So


Why does this not work:-
# dayOfYear = str(self.episodeReleaseDate.timetuple().tm_yday)
dayOfYear =‘111’

But this does
dayOfYear =‘111’
# dayOfYear = str(self.episodeReleaseDate.timetuple().tm_yday)

Am I missing something?

I have tried all different encoding in Notepad++ and have also looked at all the “show Symbol-> Show all characters”. What please am I missing? Is Python that difficult a language that you cannot comment out things without it not reading the next piece of code? (or is it the way Plex is reading it?)

Please Help !!