ginjaninja 537 Posted December 27, 2013 Share Posted December 27, 2013 (edited) Backup Collection prior to test The goal of this utility is to ensure Plex respects MB3's locally stored poster artwork for tv series and seasons. So that if you have spent time ensuring your local tv poster image data is correct for MB3..Plex will also respect your hard work. i still use this script to keep plex artwork aligned to mb3, when using Standard MB2/MB3 metdata formats. It could be useful for people with existing mb3 metadata who dont want to change to the MB3 compatable configuration for image metadata. I have been using for 3 months and its working well for me, plex is automatically staying in tune with MB3 image metadata without me having to manage plex. Background I run Plex alongside MB3 to support my Samsung TV, but found that Plex got confused with MB3's TV series and Season posters stored within a collection. This is because the Plex local media asset agent can not distinguish folder.jpg in series folder as Series poster from folder.jpg in season folder as Season poster. I did not want to go through my entire collection correcting Plex. I believe this is a solution albeit a bit (understatement) of a bodge, that others may find useful or perhaps even make a bit more sophisticated. Solution Overview Step 1 - Copy the Plex local media asset agent to a new agentname (necessary to prevent changes being overwritten) in the same plugins folder Step 2 - Edit your version of the agent to stop using folder.jpg for TV Step 3 - Configure Plex not to use the original local media asset agent on tv and use your instance. Step 4 - Prepare and Schedule a batch file to make copies of the current series and season poster artwork in a plex compatible format. Note the batch uses the bulk rename utility command line exe http://www.bulkrenameutility.co.uk/Download.php to process the filenames. The user will need to download this utility and reference the collection and BRC paths appropriately in the batchfile (below) for their environment. Download Link https://dl.dropboxusercontent.com/u/84611964/CreatePlexLocalArtwork.bat Step 2- Prevent Your instance of Plex Agent from referencing folder.jpg Edit your copy of the local media bundle (in appdata NOT program files - i don't know difference yet) Give bundle a unique name in C:\Users\Nicholas Bird\AppData\Local\Plex Media Server\Plug-ins\YourLocalMedia.bundle\Contents\info.plist <string>com.plexapp.agents.localmediaNew</string> In Plug-ins\YourLocalMedia.bundle\Contents\Code\localmedia.py Look for lines elif type == 'show': search_tuples += [['(show|poster|folder)-?[0-9]?', metadata.posters, config.IMAGE_EXTS, False]] change to elif type == 'show': search_tuples += [['(show|poster)-?[0-9]?', metadata.posters, config.IMAGE_EXTS, False]] (ie prevent agent referencing folder.jpg for tv) and in Plug-ins\YourLocalMedia.bundle\Contents\Code\ __init__.py change the name of all the functions with a new suffix (to ensure uniqueness) eg class localMediaMovie(Agent.Movies): name = 'Local Media Assets (Movies) New' and specifically class localMediaTV(Agent.TV_Shows): name = 'Local Media Assets (TV) New' restart plex after change. Step 3 - Edit the library agent config in Plex to remove original agent and instance your own on the tv collection. Step 4 - Prepare and Install Batch File Download Batch Rename Command Line Utility and the batch file itself Edit paths to suit your environment Run manually/schedule to create copies of series folder.jpgs as show.jpg and season folder.jpgs as Season-X.jpgs note the comments and examples in the batch file, there are a few gotchas. Comments Plex will update itself if you force a rescan on your tv collection after steps above Although the file copying could be made a lot more sophisticated (maybe you have can make a counter proposal), i think the Plex agent change is a necessary evil as it will never play fair with folder.jpg files. FWIW i am not currently using MB3 compatibility mode for metadata as i had an existing library of mb2/mb3 metadata, i just wanted plex to have the right tv artwork. Please let me know if you have any questions or find useful. Edited March 2, 2014 by ginjaninja Link to comment Share on other sites More sharing options...
JoshFink 19 Posted October 8, 2014 Share Posted October 8, 2014 I just found this topic after having the exact same problem. Are you still doing it this way? One problem I've found is that if I remove the folder.jpg from the Season XX folder I now have missing Season artwork for that TV series. One of the things I'm curious about is when you do an update does it change back your code and you have to redo it? Do you know what Plex does for two digit seasons? i.e. should the file be named show-10.jpg or does it stop at 9? Looks like from the code it goes 0-9 Thanks Josh Link to comment Share on other sites More sharing options...
JoshFink 19 Posted October 8, 2014 Share Posted October 8, 2014 Hey, I took the work you did and created some PowerShell scripts to do the work of the batch file. Hope this helps. Here is where it changes a little from what you did 3. Go into Plex - Settings -> Server -> Agent and change the TV providers to look towards your new agent rather than the existing Local Media Assets This sets up the groundwork to get the metadata working. Since I already had a bunch of folder.jpg files in there I needed a way to create a local file that is able to be used by the modified agent. I took this powershell script below and ran it on a schedule so that it would keep everything up to date. This looks in each folder for a file called show.jpg, if it finds it then it moves on. Otherwise it copies folder.jpg to show.jpg Make sure to change C:\Data to your TV folder directory. Get-ChildItem 'C:\Data\*\*' | Where-Object {$_.Name -eq 'folder.jpg'} | ForEach-Object { $CurrentFolder = $_.Directory if ((Test-Path "$CurrentFolder\show.jpg") -eq $false) {Copy-Item $_ "$CurrentFolder\show.jpg"} Remove-Variable CurrentFolder } I have a slightly modified version of the same script that doesn't look for show.jpg in the same directory and will just create/overwrite show.jpg regardless of whether it's there. Get-ChildItem 'C:\Data\*\*' | Where-Object {$_.Name -eq 'folder.jpg'} | ForEach-Object { $CurrentFolder = $_.Directory Copy-Item $_ "$CurrentFolder\show.jpg" Remove-Variable CurrentFolder } Link to comment Share on other sites More sharing options...
ginjaninja 537 Posted October 10, 2014 Author Share Posted October 10, 2014 I just found this topic after having the exact same problem. Are you still doing it this way? One problem I've found is that if I remove the folder.jpg from the Season XX folder I now have missing Season artwork for that TV series. One of the things I'm curious about is when you do an update does it change back your code and you have to redo it? Do you know what Plex does for two digit seasons? i.e. should the file be named show-10.jpg or does it stop at 9? Looks like from the code it goes 0-9 Thanks Josh I am still doing it this way. you shouldn't need to delete folder.jpgs from the file system if thats what you meant, (this is why the plex agent is modeified..ie to ignore MB3's and explorer's folder.jpgs) 2 digit seaason-XX.jpgs seem to picked up fine by Plex. an update to plex will reset any changes to the local media bundle code if you havent created your own instance of the local media bundle. hence why you must do that. the powershell looks like a big improvement. is your power shell script's scope confined to a certain folder depth? if "c:\data\*\*" results in copying only show's folder.jpgs (not seasons) (to show.jpg) then great presumably a 2nd element of the code could operate at 1 lower level to ensure only seasons's folder.jpg being copied to season-XX.jpg..but can you define the powershell to create the -XX suffix based on the folder name which might be 'Season X' or 'Season XX' Link to comment Share on other sites More sharing options...
JoshFink 19 Posted October 10, 2014 Share Posted October 10, 2014 Maybe I mispoke, let me go up and look and see. 1. I'm not deleting folder.jpg. Basically just creating a show.jpg and keeping the existing folder.jpg in the root of the TV Series 2. Not doing anything with Season-XX . Didn't see the need. 3. The powershell script is limited to top level of a series and not subfolders. Link to comment Share on other sites More sharing options...
ginjaninja 537 Posted October 10, 2014 Author Share Posted October 10, 2014 2) so how are you ensuring mb3 season images are inherited by plex.. what image file is plex using for season images? Link to comment Share on other sites More sharing options...
JoshFink 19 Posted October 10, 2014 Share Posted October 10, 2014 2) so how are you ensuring mb3 season images are inherited by plex.. what image file is plex using for season images? Good point. I guess the season images always showed up correctly and I never noticed a problem. Looking at the code, it looks like the season images should be fine using folder.jpg because the agent itself looks inside the season folder and doesn't look recursively down from the main series folder. Link to comment Share on other sites More sharing options...
ginjaninja 537 Posted October 12, 2014 Author Share Posted October 12, 2014 I dont think that is the case (that it should be ok).. if the plex agent still has folder.* within scope then plex season artwork will get confused by folder.jpg in the show root. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now