Clone wiki

django-tmdb / Home


Develop movie websites using the API:

django-tmdb provides useful commands making it easy to sync TMDB with your django project's db.

Read the terms of use of the api before developing.


$ hg clone
$ ./ install

or simply put the package directory /tmdb/ anywhere accessible.

Add 'tmdb' to your INSTALLED_APPS.

Set your TMDB_API_KEY in

Using commands

Add results from query

$ ./ tmdb_sync --query="order_by=rating&order=desc&countries=dz,tn,ly&order_by=id&order=desc"
$ ./ tmdb_sync --query="order_by=rating&order=desc&genres=18&min_votes=5&page=1&per_page=10"

See for building queries.

Update a movie

$ ./ tmdb_sync --update=TMDB_ID_OF_MOVIE

It will check if there's a newer version in the api. If yes, the movie will be updated.

If you want to force update regardless of new version (f.ex. you messed up with the record in the db), use --force-update.

Update all movies in db

$ ./ tmdb_sync --update-all

Works as above.

I'm working on more methods for the commands.

Test purposes

If you don't want results to be written to db, use --test.

Preview results

(r'^tmdb/', include('tmdb.urls')),  

Call tmdb_preview_results url (/tmdb/test/) and pass qury arguments to the url. Additionally, pass a method arg with one of the currently supported values: Movie.browse, Movie.getInfo, Person.getInfo.

Example urls would be:

and the results are formatted JSON straight from the API.

Asynchronous tasks (Celery)

Currently I'm integrating it with celery, should commit soon.

Issues? Want to contribute?

Report any issues here. If you have any ideas, you can submit a proposal but better yet feel free to fork it, do it yourself and if it's ok I'll merge it.