A PHP script to take a list of films and collate some stats, such as popular genres, actors, directors, eras and ratings.
- PHP 5.2.x or higher
- cURL
- TMDb API-key
- Acquire an API key for TMDb, following the instructions on http://api.themoviedb.org/2.1/ (it's usually pretty fast).
- Put API key into
collate.php
in the constants. - Get a big ol' list of films, and provide them one per line to
collate.php
viastdin
.- An example list (
movies.txt
) is provided - The script will use the best match, so if you have an ambiguous title, add the year in brackets, for example "True Grit (2010)".
- For best results, use the US title of the film
- An example list (
- Once done, a
movies.json
file will be output with all the generated statistics - You can run this through
analyse.php
to get an overview, or do something else entirely with the data!
I'm particularly interested to see any additional stats generated, but bugfixes and optimisations are also welcome. For me it was important to get something together quickly so I could spend more time making pretty infographics with the output ;)
You can find out more about the API methods available here: http://docs.themoviedb.apiary.io/
Remember that anything you develop using this code should abide by the TMDb terms and conditions.
- TheMovieDb.org for the excellent free data.
- Jonas De Smet (glamorous) for the TMDb API class.
TMDb.php is under the BSD license, as provided by glamorous: https://github.com/glamorous/TMDb-PHP-API