2009-07-13 12:32:01 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vi:si:et:sw=4:sts=4:ts=4
|
|
|
|
import os.path
|
|
|
|
from django.db import models
|
|
|
|
from django.db.models import Q
|
|
|
|
from django.contrib.auth.models import User
|
2009-07-15 16:39:28 +00:00
|
|
|
from django.shortcuts import render_to_response, get_object_or_404, get_list_or_404
|
|
|
|
from django.template import RequestContext
|
2009-07-13 12:32:01 +00:00
|
|
|
|
|
|
|
from oxdata.utils.shortcuts import render_to_json_response
|
2009-07-15 16:39:28 +00:00
|
|
|
from oxdata.lookup.models import MovieId
|
2009-07-13 12:32:01 +00:00
|
|
|
|
2009-07-15 16:39:28 +00:00
|
|
|
import models
|
2009-07-13 12:32:01 +00:00
|
|
|
|
|
|
|
def poster(request):
|
|
|
|
#FIXME: get MovieId from provided id and redirect to poster url
|
2009-07-15 16:39:28 +00:00
|
|
|
if 'imdb' in request.GET:
|
|
|
|
imdbId = request.GET['imdb']
|
|
|
|
movie_id = MovieId.objects.get(imdb_id=imdbId)
|
|
|
|
elif 'oxdb' in request.GET:
|
|
|
|
oxdbId = request.GET['oxdb']
|
|
|
|
movie_id = MovieId.objects.get(oxdb_id=oxdbId)
|
|
|
|
context = RequestContext(request, {'imdb': imdbId})
|
|
|
|
return render_to_response('poster.html', context)
|
|
|
|
|
|
|
|
def poster_json(request):
|
|
|
|
#FIXME: get MovieId from provided id and redirect to poster url
|
|
|
|
if 'imdb' in request.GET:
|
|
|
|
imdbId = request.GET['imdb']
|
|
|
|
movie_id = MovieId.objects.get(imdb_id=imdbId)
|
|
|
|
elif 'oxdb' in request.GET:
|
|
|
|
oxdbId = request.GET['oxdb']
|
|
|
|
movie_id = MovieId.objects.get(oxdb_id=oxdbId)
|
|
|
|
json = models.getPosters(movie_id)
|
|
|
|
return render_to_json_response(json)
|
2009-07-13 12:32:01 +00:00
|
|
|
|