add downloads

This commit is contained in:
j 2012-09-27 16:00:43 +02:00
parent 28e787c3f5
commit e9b0e837f1
3 changed files with 7 additions and 6 deletions

View file

@ -16,7 +16,7 @@ import ox.web.imdb
import ox.web.wikipedia import ox.web.wikipedia
import ox.web.allmovie import ox.web.allmovie
from modules import get_likes from modules import get_info
def get_movie_id(imdb_id): def get_movie_id(imdb_id):
@ -144,8 +144,8 @@ class MovieId(models.Model):
'url': 'http://google.com/search?q=%s' % quote(qs.encode('utf-8'))}) 'url': 'http://google.com/search?q=%s' % quote(qs.encode('utf-8'))})
return links return links
def likes(self): def info(self, key):
return get_likes(self) return get_info(self, key)
def json(self, prefix): def json(self, prefix):
from poster.models import getPosters from poster.models import getPosters

View file

@ -14,7 +14,7 @@ class IdModules(object):
get_ids = IdModules() get_ids = IdModules()
class Likes(object): class Info(object):
def __init__(self): def __init__(self):
self._registry = {} self._registry = {}
@ -27,5 +27,5 @@ class Likes(object):
if name not in self._registry: if name not in self._registry:
self._registry[name] = get_likes self._registry[name] = get_likes
get_likes = Likes() get_info = Info()

View file

@ -157,7 +157,8 @@ class Imdb(models.Model):
if not data['reviews']: if not data['reviews']:
del data['reviews'] del data['reviews']
data['likes'] = self.likes() data['likes'] = self.info('likes')
data['downloads'] = self.info('downloads')
data['links'] = self.links() data['links'] = self.links()
data['posters'] = self.posters(request) data['posters'] = self.posters(request)
return data return data