Metadata agents for exported XBMC library

I’m posting this particularly for those looking to get Cast Artwork working while still using the NFO import function. The info is more or less here, but I’m a step-by-step type of person, so for others who have a similar setup to mine and would like to know exactly what works, here’s the steps. I also want to point out that your Cast Artwork can be of this format:
http://location/location2/location3,etc/A/Adam Sandler/folder.jpg
So there’s no need to go in and rip out each individual artwork, rename with an underscore, etc. Just let the scraper do what it does, and keep the existing file structure in place.

Setup:
Metadata Scraper: Media Center Master (Generating Kodi/XBMC compatible NFO metadata)
Movies/TV Shows Location: Synology NAS
Plex Media Server (PMS): Currently running on a Windows PC, but will be moving to my NAS soon

Assumptions:

  1. You’ve scraped all of your media using MCM (or whatever your scraper is)
  2. You’re Cast Artwork is stored in a central location (not with each movie in a .actors folder)
    • For me, MCM stores them in a central directory, then by first letter, then by Actor Name, then inside that folder is “folder.jpg”

Step 1 - Setting up the Web Server, giving permissions, and moving your artwork

  • Log into your Synology, and install Web Station
  • That’s it, you don’t need to install phpMyAdmin or MariaDB
  • From the DSM Admin web interface, open up Control Panel, select Shares, and you should see a new folder called “web”
  • Highlight it, select Edit, then select Permissions
  • Give a proper account Read/Write permissions to this new share
  • This account will need to be one that your Media Scraper can access as it will need to create new folders and files in this directory
  • Now open File Station and go into the “web” folder
  • Move all of your Cast Artwork from wherever it is now, to this directory
  • So afterwards you should have something like this:
    • \mynas\web\ImageName\People\A\Adam Sandler\folder.jpg
  • For my purpose, I just created a new folder under “web” called “ActorImages”, then dropped all of the “letter” folders out of People and placed them into ActorImages
  • So my final resting place looks like this:
    • \mynas\ActorImages"letters"“ActorNames”\etc…
  • Test now that you can access an actors image from the web server:
  • Open a web browser, and put a FULL link to an actors image in your web browser. For example:
    http://“IP-Address-Of-NAS”/ActorImages/A/Adam Sandler/folder.jpg
  • It should open to the actors image if everything is properly set up. If not, you likely have a permissions issue.
  • Now you need to go back to your Media Scraper, and change the location of where it stores Cast Artwork for future scrapes
  • For MCM, this is under Settings & Preferences → Artwork → Store actor and crew thumbnails in:
  • In that field simply put \mynas\web\ActorImages
  • If you use multiple profiles in MCM, you will need to update this setting for EACH profile

Step 2 - Configure XBMCnfoMoviesImporter in Plex

  • Open Plex, go to Settings, select Agents, then select the XBMCnfoMoviesImporter
  • Scroll down to the bottom, change Actor Thumb Location to LINKED
  • In the Path to Move Library file…, put:
    http://“IP-Address-Of-NAS”/ActorImages

Step 3 - The Fun…
So, I tried MediaCompanion and MCM for these tasks, and couldn’t get either of them to store the Cast Artwork in the actual web address location. They would only store to a local location, or a network “file” location. As such, the info they are putting in the NFO references those file locations…which of course won’t work with Plex…it needs to be an HTTP address. So this is where “the fun” comes in.

For me, I’m OCD about my collection, so I already had a PowerShell script written that performs various functions on the movies.xml and movie_name.nfo file after the scraper generates them, so it was somewhat easy for me to add an additional step to do a find and replace within my NFOs throughout my collection. There are many ways to handle this, but I’m comfortable with PowerShell, and I already had a post processing action in place, so it was logical for me. You may find a different method that works for you. Also, I don’t consider myself a PowerShell expert, and there are many ways to execute actions in PS that can be “compressed” to how I’ve written, but I prefer to write things so they are “readable” by all. But for those that want to replicate something similar, here’s something to get you started. The below will reference your “movies” folder, store the values of each movie name folder under the movies folder, find NFO files in each movie folder, change the path of the Cast Artwork in the NFO, store it in a “new” NFO, delete the old NFO, and rename the new one to the movie title. So I assume your movie collection will look like this:
\mynas\share\movies\Avatar\Avatar.avi
\mynas\share\movies\Avatar\Avatar.nfo

{
#Change this location to the root folder of your movies
$basePathToMovies = “\mynas\share\movies”
$movieTitles = Get-ChildItem $basePathToMovies | Sort-Object Name

#Looping through each movie folder
foreach ($movieTitle in $movieTitles) {

    #Defining where the old NFO is with the current movie
    $oldNFOPath = $basePathToMovies + "\" + $movieTitle + "\" + $movieTitle + ".nfo"
    #Defining where the newly written NFO will be
    $newNFOPath = $basePathToMovies + "\" + $movieTitle + "\" + "newnfo.nfo"
    #Getting content of the existing NFO
    $movieNFOContents = Get-Content $oldNFOPath

    #Testing to make sure the newnfo.nfo doesn't already exist, if it does, removing it
    if (Test-Path $newNFOPath) {

        Remove-Item -Path $newNFOPath
    }
    #Creating new NFO to write to
    New-Item -Path $newNFOPath -ItemType File | Out-Null

    foreach ($nfoLine in $movieNFOcontents) {

        if ($nfoLine.Contains("\\mynas\web\ActorImages")) {

            $newNFOLine = $nfoLine
            $newNFOLine = $newNFOLine.Replace("\\mynas\web\ActorImages", "http://YOUR-NAS-IP/ActorImages")
            $newNFOLine = $newNFOLine.Replace("\", "/")
            Add-Content -Path $newNFOPath -Value $newNFOLine
        }
        else {

            #Writing the existing contents in the line to the NFO (lines that are not modified)
            Add-Content -Path $newNFOPath -Value $nfoLine
        }
        #Deleting the old NFO
        Remove-Item -Path $oldNFOPath
        #Renaming the new NFO with the proper name
        Rename-Item -Path $newNFOPath -NewName $oldNFOPath
        Write-Host -ForegroundColor Green $movieTitle "nfo updated"
        }
}

}
I couldn’t figure how to get this script above to display properly, so make sure you get it all from “#Change this location…” down to the last bracket. I included some extra brackets to try to get it to group as much as possible, but it still broke it apart a little.

Step 4 - Updating your existing library
So you will have likely already scraped a large part of your collection, and it will likely have incorrect references to where the Cast Artwork is located
Now that you’ve updated your Cast Artwork location in MCM (or whatever scraper you’re using), load up your collection in your scraper and Fetch Metadata again. This should overwrite any existing NFOs with the new Cast Artwork path, and then you can run the PowerShell script above to post process the NFO with the “web address” pointing to the web server
And lastly - I couldn’t get any existing libraries to recognize this change. In order for Plex to pull the changes in, I had to do the PlexDance (Remove library - add library back with proper settings)

Once you get all of this set up, it’s as simple as Fetching metadata with your scraper like you normally would, running this post processing script (which runs through 100 movies in about 2 min or less - depends on your computer), then move your movies to their final resting place (I tag and organize in a “temp” directory before putting into my collection). In MCM you can even put post processing script actions to be automatically performed for you - if you desire.

Sorry this was so long. I spent the better part of 2 days trying to figure out how to make this work “for me”, and thought some specific info might help others that are trying to do this, or are just starting out down this path. I also realize there are possibly other, better, ways to do this, so if you have a variation of how you are handling modifying your NFO’s, or the Scraper you’re using allows to create Cast Artwork to the web directory directly, I’m all ears.

Thanks again to the creator of this NFO importer! Has saved me thousands of hours - and my sanity. Now if I could just figure out how to put the IMDB “image” next to the rating instead of the generic star - I think I’d be all done :slight_smile: