I pick my movies on SensCritique, the French film rating site, and I wanted its rankings right on my Plex server’s home screen. With Claude, that became a Python script feeding Kometa every night: 8 collections, in the exact ranking order, updated on their own.
The problem
Kometa can build collections from IMDb, Trakt or TMDb lists, but not from SensCritique. And the SensCritique rankings are the ones I care about: best movies of 2026, best French movies of the year, best movies of the 90s, 2000s, 2010s and 2020s.
What Claude built
A 150-line script, run every night at 3 am right before Kometa:
- Read the ranking of each SensCritique top.
- Find each movie on TMDb from its original title and year.
- Write the collections file that Kometa then reads: 15 movies per top, in
syncmode (a movie that leaves the top leaves the collection). - Fix the order in Plex, with a second script run after Kometa.
Movies from the top I don’t have yet are requested through Overseerr. They slot into their rank as soon as they come out on video.
What broke
The page stops at 15 movies. A top’s web page only shows the first 15, which leaves no room once some movies are excluded. Claude went through the GraphQL API the site itself uses, which returns the full ranking.
Homonyms. “The Brutalist” matched a recent movie with the same name on TMDb. So the script only keeps identical titles within one year, and among them the best known. Multi-part titles (“De Gaulle – Part 2: …”) are rewritten before searching.
The order. Kometa refuses a custom order when a collection is defined by a list of IDs. And Plex mishandles “move after this movie”: it creates duplicate positions. “Move to the top”, however, always works. So the second script moves each movie to the top, from last to first. The result follows the ranking.
Animated movies. They live in a separate library, for the kids. An exclusion list removes them from the Movies tops, and the 16th movie in the ranking takes their place.
Automatic cleanup. Maintainerr deletes movies not watched for 90 days. Left alone, it would have emptied the tops. A third script excludes from Maintainerr every movie in a SensCritique collection.
Finished years
For 2025, the ranking won’t move much anymore. Those tops are frozen in the script as a list of TMDb IDs: no need to query SensCritique, and I could manually remove movies duplicated across two tops.
Get the scripts
I’m sharing the scripts freely under the MIT license. They reuse the Plex and TMDb keys already in your Kometa config.yml: all you have to do is pick your tops. Their comments are in French.
- senscritique_top.py: reads the tops and writes the collections file;
- ordre_collections.py: restores the ranking order in Plex;
- run_kometa.sh: sample nightly job chaining the three steps.
Setup:
- Copy the files into your Kometa folder, then install the dependencies:
pip install requests ruamel.yaml. - At the top of
senscritique_top.py, set your movie library name and your tops. A top’s address is on SensCritique, “Résultats” tab: the number at the end is what matters. - Test without writing anything:
python senscritique_top.py --dry-run. The script prints each movie and its TMDb match: check none is “INTROUVABLE” (not found) or mismatched. - Declare the generated file in Kometa’s
config.yml, under your library:libraries: Films: collection_files: - file: config/collections/senscritique.yml - Run
run_kometa.shonce, then schedule it every night with cron.
To leave a movie out (an animated movie kept in another library, for instance), add its TMDb ID to EXCLUDE. To freeze the top of a finished year, replace its lookup with a fixed list of IDs. If you use Maintainerr, remember to exclude the top movies from its deletion rules: I’m not sharing that script, it’s too tied to my setup.
An unofficial API
The script queries the API the SensCritique site itself uses. It’s undocumented and can change overnight. Be reasonable: one read per top per night is plenty.
Takeaway
Claude’s work wasn’t writing the script in one go, it was checking collection by collection what actually showed up in Plex, and tracing each gap back to its cause: truncated page, homonym, sorting bug, movie in the wrong library. Today the nightly job runs in one minute and the log says “order already correct” for every top.