Home > Guides/How To's, Technology > Fixing corrupt Plex thumbnails

Fixing corrupt Plex thumbnails

Plex is nothing short of fantastic!
It really brings TV and Movie collections to life and makes browsing and watching media so much better than any other system I have ever used.

I did however find a problem the other day, where the thumbnails for some movies were corrupt. For example, if you imagine the image is downloaded from the top down, only half the image is showing and the rest is just grey.

At the time of writing this article, there are no other fixes published online, other than deleting your entire Plex metadata! So if you  have this problem and want a reasonably quick fix, read on…..

This fix finds the location of the Plex metadata for the movie with the corrupt thumbnail, then simply removes it and forces Plex to download a new copy of the metadata. It is fairly straightforward, but a little tricky, so please read each step carefully and use copy and past on the provided commands to avoid typos.

This fix will also work for other content such as TV shows etc with a few very obvious tweeks.

1. Open up a terminal and run this command to change to the Plex DB directory (Notice the backslashes escaping the spaces in the directory names):

cd ~/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases

2. Connect to the Plex DB with sqlite by running this command in the terminal window:

sqlite3 com.plexapp.plugins.library.db

You will see something like this:
iMac:Databases nik$ sqlite3 com.plexapp.plugins.library.db
SQLite version 3.6.12Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>

3. Type this SQL query into the terminal window to find the GUID of the movie, this will help us find the movie metadata location:

Obviously replace ‘your movie name here’ with the movie you want to fix.

select title, guid from metadata_items where title like '%your movie name here%';

For example:

sqlite> select title, guid from metadata_items where title like '%school of rock%';

You should see the movie name and the guid, separated by a pipe (|)

My result:

The School of Rock|com.plexapp.agents.imdb://tt0332379?lang=en

4. Find the location (folder and bundle name) of the movie metadata. Close down the previous terminal window and run this command in the new window:

Obviously replacing everything in between the quotes with the guid you go when you ran your SQL query.

echo -n "com.plexapp.agents.imdb://tt0332379?lang=en" | shasum

This command will return a big long string, like this:

d616f6685a11c774befb391dc13b7c0558908acf

Which actually contains a folder name (The first character) and the name of the bundle file (The remaining characters).

Your string will be different, but the format is the same as the following:

(d) (616f6685a11c774befb391dc13b7c0558908acf)

Foldername: d
Bundle Name: 616f6685a11c774befb391dc13b7c0558908acf

5. Find the directory holding the Plex movie metadata:

In finder browse to the following directory:

~/Library/Application Support/Plex Media Server/Metadata/Movies

You will notice lots of directories named 0,1,2,3a,b,c etc.

Take the directory name (1st letter of the sha checksum) from step 4 and open that directory.

In my case this was the directory named “d”. Then find the bundle name in the folder, in my case this was “616f6685a11c774befb391dc13b7c0558908acf.bundle”

6. Move the bundle file found in step 5 to a temporary location, your desktop for example

7. Now we need to tell Plex to overwrite the cached metadata:

a) Open Plex Media Manager (Click the Plex icon at the top of the screen, then click Media Manager)

b) Find the Movie with the partially downloaded artwork, right click and choose ‘Fix Incorrect Match’

c) All you need to do in this step is select a different movie, it doesn’t matter what it is , as long as it is different. Also, make sure you remember what the correct match was!

Plex will now download the metadata for the dummy match we have just given it. Watch in Plex Media Manager for this to update.

8. Tell Plex to download the correct metadata for the Movie:

a) Find the Movie with the partially downloaded artwork in Media Manager,  right click and choose ‘Fix Incorrect Match’ again

c) Now select the correct movie, Plex will now re-download the correct metadata, including a new copy of the artwork! Replacing your corrupt thumbnail 🙂

A huge thanks to SolarPlex on the Plex forums for this article, which helped me connect to the Plex DB and find the correct metadata folder for the movie.

Here’s a link to the SolarPlex article:

http://forums2.plexapp.com/index.php/topic/31636-howto-query-data-from-plex-on-a-mac/

Advertisements
  1. ealmasy
    March 19, 2012 at 5:13 am

    Thanks for working this out! Here’s a bash script I wrote that performs steps 1-6 above:
    http://axisdata.com/FixPlexPosters

    It’s intended to be run from the command line in a terminal.

    • March 19, 2012 at 5:55 am

      Awesome! Thanks for providing the bash script. I wonder if there is a way to automate the Plex bit too….

      • ealmasy
        March 19, 2012 at 2:09 pm

        I did spend a while looking at automating the last few bits, diff’ing database dumps to try to figure out how to mark a title for reload, but without a clear and complete (at least with respect to this area) schema reference it just seemed too risky to modify the DB.

  2. March 20, 2012 at 4:38 am

    I agree that Plex DB mods are probably not the safest option here 🙂

    Also I suspect that Plex holds a 2nd copy of the metadata somewhere else, because if you just delete the bundle file, Plex creates a new one with the exact same data, including the corrupt thumbnail!

    I may have another look around at some stage to see if I can get around Step 7 somehow.

  3. January 11, 2013 at 8:15 pm

    For the ones who do not want to use the db to acquire the “bundle name”. you can just:
    >Find the Movie with the partially downloaded artwork and open it
    >Click on “edit”
    >Click on “Change Poster”
    >Right-click on the partially downloaded artwork and select “Copy Image Location”.*
    >Paste the image location in a text editor and look for movieposterdb_%someString%&
    >Search for %someString% in “~/Library/Application Support/Plex Media Server/Metadata/Movies”. usually you’ll find 3 results, delete only the files.
    >Follow Step 8

    *. This is for firefox, in other browsers you may find other options that does the same.

  4. Tony
    December 29, 2013 at 8:32 pm

    Do I need to change anything in these instructions or with this script in order for it to work on the TV Shows section? I also have a Home Movies section that is generating corrupt all grey thumbnails.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: