[Rel] TheMovieDB Collection Data Retriever (Summary/Images)

I recently noticed that free users have access to collections now as well. After a first review, I wasn’t all that excited to manually edit potentially hundreds of collections. So I thought it can’t be that hard to automatically fetch the needed information from TheMovieDB. I realize a lot of people probably have updated their collections already, but maybe this will be helpful to someone else. Right now, only the python script exists, so you’ll need a python/dev environment to execute.
#TMDB Collection Data Retriever

How does it work?

The script collects all collections from your movie library that do not have a summary yet. It then checks the movies within the collection to find if these movies belong to a TheMovieDB collection. If a valid collection can be found it will pull the summary as well as download posters/background images (and use the same web calls as if you were manually updating it over the web interface).

A sample on a small test library looks like this:

Attention

Currently this has only been tested with a couple of libraries, so I would recommend doing a database backup before starting the process (even though I don’t think the script can do any real harm).

All images will be fully downloaded, this might increase the size of your metadata folder significantly if you have a lot of collections.

I wonder if this be worked into https://forums.plex.tv/discussion/38402/metadata-agents-for-exported-xbmc-library/p1 so the import is automatic

I am trying to use this script, however I get the following error:

[plex@XXXX TMDB-Collection-Data-Retriever-master]$ python collection_updater.py

Metadata retriever for TMDB collections

Your movie libraries are:

ID: 7 Name: XXXX
ID: 15 Name: XXXX
ID: 1 Name: XXXX
ID: 19 Name: XXXX

Enter a whitespace separated list of library IDs to work on (e.g: 3 5 8 13):
1
Traceback (most recent call last):
File “collection_updater.py”, line 308, in
main()
File “collection_updater.py”, line 104, in main
for section_id in input_sections:
TypeError: ‘int’ object is not iterable
[plex@XXXX TMDB-Collection-Data-Retriever-master]$ python collection_updater.py

Metadata retriever for TMDB collections

Your movie libraries are:

ID: 7 Name: XXXX
ID: 15 Name: XXXX
ID: 1 Name: XXXX
ID: 19 Name: XXXX

Enter a whitespace separated list of library IDs to work on (e.g: 3 5 8 13):
1 15
Traceback (most recent call last):
File “collection_updater.py”, line 308, in
main()
File “collection_updater.py”, line 99, in main
input_sections = input(’\r\nEnter a whitespace separated list of library IDs to work on (e.g: 3 5 8 13):\r\n’)
File “”, line 1
1 15
^
SyntaxError: unexpected EOF while parsing

Any idea what is wrong?

Hello rfagnoni,

my Python knowledge goes as far as this script, but I’ll try to help.

I just tested the current code and it works fine for me on Windows 10 / Py3.6 when executed from commandline or from within Visual Studio Code.

On what kind of system / environment are you executing the script?

Thank you for taking the time to look, I don’t have any Python knowledge either :frowning:

I am running a Linux CentOS server.

Ah, I already assumed it was Linux.

I don’t have CentOS here, but I just tried with the latest Ubuntu version.

By default, only Python 2.x was installed, so I had to install the latest Python and pip version. Then get all the dependencies and after that, it worked on Linux as well.

You are using the same version of the script that is on GitHub?

Yes, I downloaded it from github on my Ubuntu machine.

Alright well thank you for taking a look. I’ll ask if someone at work knows Python at all and would be able to help.

Did you check which version of Python is installed? If I had to guess 2.x and not 3.x.

This was exactly it. I have python 3.6.4 installed, but “python” was still pointing to 2.7 so I ran it with python3 and it worked.

Great to hear, hope it helped you /saved you some work.

It did, the script is awesome! So much better to have everything in the UI instead of having to search the internet for a good cover.

Thanks zo1d - this has been super helpful. Just running it for the second time today–I didn’t realize you did some optimizing as well to skip things on follow up runs. Great job!

Hi, can I use this on a Windows installation of Plex?

L.E. Working perfectly, thanks a lot, doing this manually was driving me crazy.

Great script! If someone could build this into an Plugin/Agent it would be very nice