[REL] Extended Personal Media Shows Agent

Kevin,

I looked at the log and the log shows that the file name is being parsed correctly by the metadata agent. You could also try send me the scanner log to see if that shows anything. The file you would need to attach is Library/Application Support/Plex Media Server/Logs/Plex Media Scanner.log.

In the first screen shot you show there are a lot of titles for shows in Plex that I don't see in the screen shot of the file browser above it. Is that the expected results with your media library?

edit: The ".summary" files were in ANSI with foreign characters. I encoded them in UTF-8 and everything went well :) Ignore the content below (i'm leaving it in case someone else runs into the same problem).  

[spoiler]

Hi!
 
I can't seem to get the ".summary" to work. Is there a bug with the agent and the latest PMS release?

The log (below) seems to indicate that the files are found by the scanner but can't be read by the agent because of Unicode characters (or am I misinterpreting it?) . 

2014-03-02 19:15:05,742 (26d4) :  INFO (logkit:16) - update :: episode: 15012014-03-02 19:15:05,743 (26d4) :  INFO (logkit:16) - update :: episode metadata: 
2014-03-02 19:15:05,743 (26d4) :  INFO (logkit:16) - update :: episode file path: D:\hemmedia\video\Inga och Arnes kamera\1997\Inga och Arnes kamera - 1997-05-30 - Inga 40.mp4
2014-03-02 19:15:05,743 (26d4) :  INFO (logkit:16) - unicodize :: before unicodizing: D:\hemmedia\video\Inga och Arnes kamera\1997\Inga och Arnes kamera - 1997-05-30 - Inga 40.mp4
2014-03-02 19:15:05,743 (26d4) :  INFO (logkit:16) - unicodize :: after unicodizing: D:\hemmedia\video\Inga och Arnes kamera\1997\Inga och Arnes kamera - 1997-05-30 - Inga 40.mp4
2014-03-02 19:15:05,743 (26d4) :  INFO (logkit:16) - update :: absolute file path: D:\hemmedia\video\Inga och Arnes kamera\1997\Inga och Arnes kamera - 1997-05-30 - Inga 40.mp4
2014-03-02 19:15:05,743 (26d4) :  INFO (logkit:16) - update :: parser <__code__.SeriesDateBasedMediaParser object at 0x02DC7470> contains match - parsing file path
2014-03-02 19:15:05,744 (26d4) :  INFO (logkit:16) - parse :: regex [\\/](?P[^\\/]+?)[ ]*[-\.]{0,1}[ ]*(?P[0-9]{4})[-\. ](?P[0-9]{2})[-\. ](?P[0-9]{2})(_(?P[0-9]+)){0,1}[ ]*[-\.]{0,1}[ ]*(?P.*)\.(?P.+)$ - matches: <_sre.SRE_Match object at 0x02F70368>
2014-03-02 19:15:05,744 (26d4) :  INFO (logkit:16) - parse :: found matches
2014-03-02 19:15:05,744 (26d4) :  INFO (logkit:16) - scrubString :: original: [Inga 40] scrubbed: [Inga 40]
2014-03-02 19:15:05,746 (26d4) :  INFO (logkit:16) - setValues :: file name without extension D:\hemmedia\video\Inga och Arnes kamera\1997\Inga och Arnes kamera - 1997-05-30 - Inga 40
2014-03-02 19:15:05,746 (26d4) :  INFO (logkit:16) - setValues :: looking for summary file D:\hemmedia\video\Inga och Arnes kamera\1997\Inga och Arnes kamera - 1997-05-30 - Inga 40.summary
2014-03-02 19:15:05,746 (26d4) :  INFO (logkit:16) - setValues :: summary file exists - reading contents
2014-03-02 19:15:05,746 (26d4) :  INFO (logkit:16) - update :: before setting season.summary: None
2014-03-02 19:15:05,746 (26d4) :  INFO (logkit:16) - update :: season.summary: None
2014-03-02 19:15:05,749 (26d4) :  CRITICAL (core:561) - Exception in the update function of agent named 'Extended Personal Media Shows', called with guid 'com.arendshome.plex.agents.personalmedia://32894?lang=sv' (most recent call last):
  File "C:\Users\Stefan\AppData\Local\Plex Media Server\Plug-ins\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\api\agentkit.py", line 972, in _update
    agent.update(obj, media, lang)
  File "C:\Users\Stefan\AppData\Local\Plex Media Server\Plug-ins\mjarends-extendedpersonalmedia-agent.bundle\Contents\Code\__init__.py", line 277, in update
    episodeMetadata.summary = parser.getEpisodeSummary()
  File "C:\Users\Stefan\AppData\Local\Plex Media Server\Plug-ins\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\modelling\attributes.py", line 31, in __setattr__
    self._attributes[name]._setcontent(value)
  File "C:\Users\Stefan\AppData\Local\Plex Media Server\Plug-ins\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\modelling\attributes.py", line 166, in _setcontent
    content = unicode(content)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe5 in position 15: invalid continuation byte

2014-03-02 19:15:05,782 (26d4) :  DEBUG (model:218) - Serializing to C:\Users\Stefan\AppData\Local\Plex Media Server\Metadata\TV Shows\a\32f90f06949dc369f73198bafca97aebf23a230.bundle\Contents\com.arendshome.plex.agents.personalmedia\Info.xml
2014-03-02 19:15:05,786 (26d4) :  DEBUG (runtime:915) - Response: [200] str, 16 bytes

The content of the ".summary" file is simply 

Inga fyller 40 år och får besök från släkt och vänner.

[/spoiler]

schteff,

What version of Plex are you using? Was this particular file working on a previous version of Plex? Could you send me a copy of the file so that I can test in my test environment?

Thanks - Mitch

schteff,

What version of Plex are you using? Was this particular file working on a previous version of Plex? Could you send me a copy of the file so that I can test in my test environment?

Thanks - Mitch

I am currently using the latest version (0.9.9.5) but the same problem happened in the previous version. 

An example file that has the same (encoding) problem is linked here: http://ge.tt/22MggQO1/v/0?c

As i wrote, the problem is that the file is encoded in ANSI instead of UTF-8, when changing the encoding in notepad++ (and cleaning up the encoding errors in the resulting text) the error goes away. 

It would probably be solved by reading the file using the correct encoding. The problem i guess is figuring out what encoding the file is using :)

http://stackoverflow.com/questions/436220/python-is-there-a-way-to-determine-the-encoding-of-text-file

Thanks for an otherwise awesome plugin!

Thanks for all of the great details. I will look into it this weekend. I'll let you know when the changes are up.

The plug-in has been updated to handle utf-8 decoding errors only. I was not able to work on adding support for determining the encoding of a file. For now the plug-in will just ignore decoding errors and the characters will not be present in the final string. It will take a little more time to determine whether I can add in one of the libraries in the included post. Please test and let me know if you have any issues.

Hi Mjarends, its been a while since I have had a play with this. I have noticed when trying once and for all to organise my home movies that your scanner does not appear to pick up MTS video files. The "Plex video files scanner" does seem to pick up these files. So all my mov and MP4 files seem to be getting picked up when configured as the first attachment, but with the same conventions but MTS file names in the second screen grab nothing shows up?
 
Is this something you are aware of?
 
Thanks
 
Kevin

I really like what you've done and have installed the metadata agent into my iMac Plex and using this to manage home videos.  The metadata agent is not picking up the titles embedded into the filenames and is instead using the "Episode N" format.  A forced refresh has no effect either.
 
I create a TV Show library using the Plex Series Scanner and your Extended Personal Media Shows metadata agent.  It's pointing to my HomeMovies folder (see attachments).    What do I need to change to make this work? 

(BTW, I tried using the Externded Personal Media Scanner with your metadata agent but could not make heads/tails on how it determined naming with respect to folders... so I gave up and reverted back to the standard scanner with your metadata agent).

Really hoping to make this work with your help.  Thank you.
 

Kevin,

Could you send me the logs from the scanner and the metadata agent and/or the full path of one of the files that is failing. I use .MTS files on my own media server without issue. More than likely it's that the file path and name you are using is not being matched by one of the regular expressions and therefore it's being ignored.

KenJ,

I would recommend using both the scanner and metadata agent together. Both plug-ins support the same set of regular expressions when matching files. This set of regular expressions is different that the default Plex scanner and will eventually cause issues within your media library. The reason why the file was not showing up in your library was because the Extended Personal Media scanner was not matching the file paths you are using. I will add support but if you want to get it working immediately you could change the paths to /HomeMovies/Groton Dunstable Plays/01/11 - GD_Annie Jr 2003.m4v or /HomeMovies/Groton Dunstable Plays/01/e11 - GD_Annie Jr 2003.m4v. I know people are very particular on how they name their media so I would understand if you didn't want to change. I will add support for the following format: /HomeMovies/Groton Dunstable Plays/Season01/s01e11 - GD_Annie Jr 2003.m4v this evening. I will let you know when the update is available.

Thank you mjarends for the quick response and help.  I can change the folder format to match the format you suggest but I named the files according to the standard TV Shows format.

UPDATE:  Good news!  I changed to use your scanner and metadata agent and only changed the folder from "Season01" to "01" (leaving the filenames as is) and they now show up in Plex using the embedded titles.  I do appreciate you changing the format to include the "Season01" format (for compatibility with the standard TV Show naming convention) but I'm okay with using the "01" approach too.

UPDATE 2:  I've noticed that the scanner/metadata does not pick up folder name changes dynamically or even when forced refresh.  For example, I originally had the folder structure as /HomeMovies/Bekah Plays/Wells of Fancy Dry/S2012E01 - First run.mp4 and changed it to /HomeMovies/Bekah Plays/2012/S2012E01 - First run.mp4.  However, it still shows up as 'Wells of Fancy Dry' and not the new '2012' name.  I'll try a few more things to see if I can get it to work.

UPDATE 3: It seems like there's residual effect if the database is already aware of the folder structure such that it does not pickup dynamic changes nor even if forced refresh.  That is, I had the same HomeMovies folder in different variations of scanner and metadata agents to try to get this to work.  I deleted all of the variations, changed my folder naming to your format, ran the top level Plex cleanup (bundle cleanup, empty trash, optimize), re-added the HomeMovies (as TV Shows with your scanner and agent) AND it all shows up fine now.  Prior to doing all of this, any changes made to the folder naming were not picked up.  Leaving the filenames with the SnnEnn format is working fine too.  I'm happy.

Many thanks!

Ken

Hi mjarends.  I found a problem in the matching algorithm with respect to determining episode number.  It seems that a digit at the end of the embedded title in the filename confuses the episode numbering in the regex matching.  For example, I have 3 files all in the same 1992 directory:

e2 - Aug Jackson Hole Rodeo.m4v

s1992e3 - Aug Yellowstone.m4v

e11 - Leominster Outdoors Take2.mp4

The matching algorithm identified the first and third files as episode 2.  I confirmed this problem by changing the "Take2" to "Take3" in the third file and now the matching algorithm matched the second and third episodes as being the same.

Ken

I really like how this works.  However, I did discover another issue (maybe already known?)

I have 2 files with different episodes but identical titles.

e8 - Leominster Outdoors.mp4

e11 - Leominster Outdoors.mp4

Only the first one (e8) shows up in Plex properly.  The other is completely missed.  I assumed the uniqueness was in the combination of episode number and title.  Is that true or the uniqueness is only in the title?

I'm planning on making this work!  Thank you for your hard work and putting this together.  It's really quite good and i'm finding some corner cases as I work thru it.

Ken

Thank you mjarends for the quick response and help.  I can change the folder format to match the format you suggest but I named the files according to the standard TV Shows format.

UPDATE:  Good news!  I changed to use your scanner and metadata agent and only changed the folder from "Season01" to "01" (leaving the filenames as is) and they now show up in Plex using the embedded titles.  I do appreciate you changing the format to include the "Season01" format (for compatibility with the standard TV Show naming convention) but I'm okay with using the "01" approach too.

UPDATE 2:  I've noticed that the scanner/metadata does not pick up folder name changes dynamically or even when forced refresh.  For example, I originally had the folder structure as /HomeMovies/Bekah Plays/Wells of Fancy Dry/S2012E01 - First run.mp4 and changed it to /HomeMovies/Bekah Plays/2012/S2012E01 - First run.mp4.  However, it still shows up as 'Wells of Fancy Dry' and not the new '2012' name.  I'll try a few more things to see if I can get it to work.

UPDATE 3: It seems like there's residual effect if the database is already aware of the folder structure such that it does not pickup dynamic changes nor even if forced refresh.  That is, I had the same HomeMovies folder in different variations of scanner and metadata agents to try to get this to work.  I deleted all of the variations, changed my folder naming to your format, ran the top level Plex cleanup (bundle cleanup, empty trash, optimize), re-added the HomeMovies (as TV Shows with your scanner and agent) AND it all shows up fine now.  Prior to doing all of this, any changes made to the folder naming were not picked up.  Leaving the filenames with the SnnEnn format is working fine too.  I'm happy.

Many thanks!

Ken

Ken - Thanks for the feedback. The issues that you described in Update 3 are actually native to Plex itself and not part of the logic from the plug-ins that I created. I have noticed the same behavior as well. Plex tracks when file names are changed and sometimes this leads to the file names not being updated in the web interface. I have found that either refreshing the web interface works and if that doesn't work, removing the files, performing a clean, and then adding the files back in and refreshing Plex resolve the issues.

Hi mjarends.  I found a problem in the matching algorithm with respect to determining episode number.  It seems that a digit at the end of the embedded title in the filename confuses the episode numbering in the regex matching.  For example, I have 3 files all in the same 1992 directory:

e2 - Aug Jackson Hole Rodeo.m4v

s1992e3 - Aug Yellowstone.m4v

e11 - Leominster Outdoors Take2.mp4

The matching algorithm identified the first and third files as episode 2.  I confirmed this problem by changing the "Take2" to "Take3" in the third file and now the matching algorithm matched the second and third episodes as being the same.

Ken

Great find :). I will get that bug fixed.

Kevin,

Could you send me the logs from the scanner and the metadata agent and/or the full path of one of the files that is failing. I use .MTS files on my own media server without issue. More than likely it's that the file path and name you are using is not being matched by one of the regular expressions and therefore it's being ignored.

KenJ,

I would recommend using both the scanner and metadata agent together. Both plug-ins support the same set of regular expressions when matching files. This set of regular expressions is different that the default Plex scanner and will eventually cause issues within your media library. The reason why the file was not showing up in your library was because the Extended Personal Media scanner was not matching the file paths you are using. I will add support but if you want to get it working immediately you could change the paths to /HomeMovies/Groton Dunstable Plays/01/11 - GD_Annie Jr 2003.m4v or /HomeMovies/Groton Dunstable Plays/01/e11 - GD_Annie Jr 2003.m4v. I know people are very particular on how they name their media so I would understand if you didn't want to change. I will add support for the following format: /HomeMovies/Groton Dunstable Plays/Season01/s01e11 - GD_Annie Jr 2003.m4v this evening. I will let you know when the update is available.

Could you remind me where to get the logs so I can send over to you?

Thanks

Kevin

Could you remind me where to get the logs so I can send over to you?

Thanks

Kevin

Found it, please see attached a full file path name to the folder "Capital Summertime Ball" which has 33 videos; then there's the screen grab of how it looks in Plex, and then theres the log file. Let me know if theres anything else you need.

Thanks again for all your help.

Regards

Kevin

Ps: Ive tried another collection but using the Plex series scanner with your agent and it picks up all the videos perfectly, it just doesn't work out episode numbers. See final screen grab.

I really like how this works.  However, I did discover another issue (maybe already known?)

I have 2 files with different episodes but identical titles.

e8 - Leominster Outdoors.mp4

e11 - Leominster Outdoors.mp4

Only the first one (e8) shows up in Plex properly.  The other is completely missed.  I assumed the uniqueness was in the combination of episode number and title.  Is that true or the uniqueness is only in the title?

I'm planning on making this work!  Thank you for your hard work and putting this together.  It's really quite good and i'm finding some corner cases as I work thru it.

Ken

I will have to look at this later. It looks to me like they are being stacked by Plex.

Kevin - the log file didn't have any references to the "Capital Summertime Ball" folder. Can you re-add the files so that they show up in the log. Thanks.

Kevin - the log file didn't have any references to the "Capital Summertime Ball" folder. Can you re-add the files so that they show up in the log. Thanks.

I have just forced a rescan, see attached. I have also added the folder specifically as well as it being a sub folder of the main Home movies folder that was previously selected. 

As a further example there is another folder called Hunters which the attached screen grab shows, and this folder is not being picked up at all in Plex.

Thanks

Kevin

Hi mjarends.  I found a problem in the matching algorithm with respect to determining episode number.  It seems that a digit at the end of the embedded title in the filename confuses the episode numbering in the regex matching.  For example, I have 3 files all in the same 1992 directory:

e2 - Aug Jackson Hole Rodeo.m4v

s1992e3 - Aug Yellowstone.m4v

e11 - Leominster Outdoors Take2.mp4

The matching algorithm identified the first and third files as episode 2.  I confirmed this problem by changing the "Take2" to "Take3" in the third file and now the matching algorithm matched the second and third episodes as being the same.

Ken

I will have to look at this later. It looks to me like they are being stacked by Plex.

I wasn't able to reproduce this. When I created files with these two exact same names I got two different entries in Plex. Are you using the Extended Media Scanner and Extended Metadata Agent in combination?