back to oxlib, package_dir does not work with pip/python setup.py develop
This commit is contained in:
parent
bfc33beda5
commit
0f232e01cb
7 changed files with 37 additions and 37 deletions
|
@ -3,12 +3,12 @@
|
|||
import os
|
||||
|
||||
from django.conf import settings
|
||||
from ox.cache import readUrlUnicode
|
||||
from ox import findRe
|
||||
import ox.web.criterion
|
||||
import ox.web.karagarga
|
||||
import ox.web.imdb
|
||||
import ox.web.impawards
|
||||
from oxlib.cache import readUrlUnicode
|
||||
from oxlib import findRe
|
||||
import oxweb.criterion
|
||||
import oxweb.karagarga
|
||||
import oxweb.imdb
|
||||
import oxweb.impawards
|
||||
|
||||
import models
|
||||
from oxdata.poster.models import PosterCache
|
||||
|
@ -19,10 +19,10 @@ def addPoster(m, url, site, site_id):
|
|||
p.save()
|
||||
|
||||
def getIds():
|
||||
for id in ox.web.impawards.getIds():
|
||||
for id in oxweb.impawards.getIds():
|
||||
if models.MovieId.objects.all().filter(impawards_id=id).count() == 0:
|
||||
print 'impawards', id
|
||||
data = ox.web.impawards.getData(id)
|
||||
data = oxweb.impawards.getData(id)
|
||||
if data and 'imdbId' in data:
|
||||
m = models.getMovieIdByImdbId(data['imdbId'])
|
||||
if not m.impawards_id:
|
||||
|
@ -31,10 +31,10 @@ def getIds():
|
|||
for poster in data['posters']:
|
||||
addPoster(m, poster, 'impawards.com', m.imdb_id)
|
||||
|
||||
for id in ox.web.criterion.getIds():
|
||||
for id in oxweb.criterion.getIds():
|
||||
if models.MovieId.objects.all().filter(criterion_id=id).count() == 0:
|
||||
print 'criterion', id
|
||||
data = ox.web.criterion.getData(id)
|
||||
data = oxweb.criterion.getData(id)
|
||||
if data and 'imdbId' in data:
|
||||
m = models.getMovieIdByImdbId(data['imdbId'])
|
||||
if not m.criterion_id:
|
||||
|
@ -46,10 +46,10 @@ def getIds():
|
|||
|
||||
#kg
|
||||
lastId = models.Karagarga.maxId()
|
||||
for id in ox.web.karagarga.getIds(lastId):
|
||||
for id in oxweb.karagarga.getIds(lastId):
|
||||
if models.Karagarga.objects.filter(karagarga_id=id).count() == 0:
|
||||
print 'kg', id
|
||||
data = ox.web.karagarga.getData(id)
|
||||
data = oxweb.karagarga.getData(id)
|
||||
if data and 'imdbId' in data:
|
||||
m = models.getMovieIdByImdbId(data['imdbId'])
|
||||
kg = models.Karagarga()
|
||||
|
|
|
@ -8,9 +8,9 @@ from django.db.models import Q, Max
|
|||
from django.contrib.auth.models import User
|
||||
from django.utils import simplejson
|
||||
|
||||
import ox.web.wikipedia
|
||||
import ox.web.imdb
|
||||
from ox import stripTags
|
||||
import oxweb.wikipedia
|
||||
import oxweb.imdb
|
||||
from oxlib import stripTags
|
||||
|
||||
|
||||
def getMovieIdByImdbId(imdb_id):
|
||||
|
@ -56,8 +56,8 @@ class MovieId(models.Model):
|
|||
|
||||
def updateFromWikipedia(self):
|
||||
if self.wikipedia_id:
|
||||
wikipedia_url = ox.web.wikipedia.getUrl(self.wikipedia_id)
|
||||
data = ox.web.wikipedia.getMovieData(wikipedia_url)
|
||||
wikipedia_url = oxweb.wikipedia.getUrl(self.wikipedia_id)
|
||||
data = oxweb.wikipedia.getMovieData(wikipedia_url)
|
||||
_key = {}
|
||||
for key in ('imdb_id', 'amg_id'):
|
||||
if key in data:
|
||||
|
@ -67,7 +67,7 @@ class MovieId(models.Model):
|
|||
|
||||
def updateFromImdb(self):
|
||||
if self.imdb_id:
|
||||
data = ox.web.imdb.getMovieInfo(self.imdb_id)
|
||||
data = oxweb.imdb.getMovieInfo(self.imdb_id)
|
||||
_key = {
|
||||
'episode title': 'episode_title',
|
||||
'series title': 'series_title',
|
||||
|
@ -76,12 +76,12 @@ class MovieId(models.Model):
|
|||
if key in data and data[key]:
|
||||
setattr(self, _key.get(key, key), data[key])
|
||||
directors = []
|
||||
credits = ox.web.imdb.getMovieCredits(self.imdb_id)
|
||||
credits = oxweb.imdb.getMovieCredits(self.imdb_id)
|
||||
if 'directors' in credits:
|
||||
directors = credits['directors']
|
||||
self.director = ', '.join([stripTags(d[0]) for d in directors])
|
||||
if not self.wikipedia_id:
|
||||
self.wikipedia_id = ox.web.wikipedia.getId(ox.web.wikipedia.getUrlByImdb(self.imdb_id))
|
||||
self.wikipedia_id = oxweb.wikipedia.getId(oxweb.wikipedia.getUrlByImdb(self.imdb_id))
|
||||
if not self.oxdb_id:
|
||||
self.gen_oxdb_id()
|
||||
self.save()
|
||||
|
|
|
@ -5,7 +5,7 @@ from django.db import models
|
|||
from django.db.models import Q
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
from ox.django.shortcuts import render_to_json_response
|
||||
from oxdjango.shortcuts import render_to_json_response
|
||||
|
||||
def ids(request):
|
||||
json = {}
|
||||
|
|
|
@ -8,11 +8,11 @@ from django.db.models import Q
|
|||
from django.contrib.auth.models import User
|
||||
from django.core.files.base import ContentFile
|
||||
|
||||
import ox.web.criterion
|
||||
import ox.web.movieposterdb
|
||||
import ox.web.karagarga
|
||||
import ox.web.imdb
|
||||
import ox.web.impawards
|
||||
import oxweb.criterion
|
||||
import oxweb.movieposterdb
|
||||
import oxweb.karagarga
|
||||
import oxweb.imdb
|
||||
import oxweb.impawards
|
||||
|
||||
from oxdata.lookup.models import MovieId, Karagarga
|
||||
|
||||
|
@ -56,9 +56,9 @@ class PosterCache(models.Model):
|
|||
def get(self):
|
||||
if not self.image and not self.failed:
|
||||
try:
|
||||
import ox.net
|
||||
import oxlib.net
|
||||
name = hashlib.sha1(self.url).hexdigest()
|
||||
data = ox.net.readUrl(self.url)
|
||||
data = oxlib.net.readUrl(self.url)
|
||||
self.image.save(name, ContentFile(data))
|
||||
except:
|
||||
self.failed = True
|
||||
|
@ -90,28 +90,28 @@ def getPosterUrls(m):
|
|||
p.save()
|
||||
|
||||
if m.imdb_id:
|
||||
poster = ox.web.imdb.getMoviePoster(m.imdb_id)
|
||||
poster = oxweb.imdb.getMoviePoster(m.imdb_id)
|
||||
if poster:
|
||||
addPoster(poster, 'imdb.com', m.imdb_id)
|
||||
for poster in ox.web.movieposterdb.getData(m.imdb_id)['posters']:
|
||||
for poster in oxweb.movieposterdb.getData(m.imdb_id)['posters']:
|
||||
addPoster(poster, 'movieposterdb.com', m.imdb_id)
|
||||
if m.criterion_id:
|
||||
print 'criterion', m.criterion_id
|
||||
for poster in ox.web.criterion.getData(m.criterion_id)['posters']:
|
||||
for poster in oxweb.criterion.getData(m.criterion_id)['posters']:
|
||||
addPoster(poster, 'criterion.com', m.criterion_id)
|
||||
if m.wikipedia_id:
|
||||
poster = ox.web.wikipedia.getPosterUrl(m.wikipedia_id)
|
||||
poster = oxweb.wikipedia.getPosterUrl(m.wikipedia_id)
|
||||
if poster:
|
||||
if PosterCache.objects.all().filter(url=poster).count() == 0:
|
||||
addPoster(poster, 'wikipedia.org', m.wikipedia_id)
|
||||
if m.impawards_id:
|
||||
data = ox.web.impawards.getData(m.impawards_id)
|
||||
data = oxweb.impawards.getData(m.impawards_id)
|
||||
if data and 'imdbId' in data:
|
||||
for poster in data['posters']:
|
||||
addPoster(poster, 'impawards.com', m.imdb_id)
|
||||
|
||||
for kg in Karagarga.objects.all().filter(movie_id=m):
|
||||
data = ox.web.karagarga.getData(kg.karagarga_id)
|
||||
data = oxweb.karagarga.getData(kg.karagarga_id)
|
||||
if data:
|
||||
for poster in data['posters']:
|
||||
addPoster(poster, 'karagarga.net', kg.karagarga_id)
|
||||
|
|
|
@ -7,7 +7,7 @@ from django.contrib.auth.models import User
|
|||
from django.shortcuts import render_to_response, get_object_or_404, get_list_or_404
|
||||
from django.template import RequestContext
|
||||
|
||||
from ox.django.shortcuts import render_to_json_response
|
||||
from oxdjango.shortcuts import render_to_json_response
|
||||
from oxdata.lookup.models import MovieId
|
||||
|
||||
import models
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
-e svn+http://code.djangoproject.com/svn/django/branches/releases/1.1.X/#egg=django
|
||||
South==0.6.1
|
||||
-e bzr+http://code.0xdb.org/python-ox/#egg=python-ox
|
||||
-e bzr+http://code.0xdb.org/python-oxweb/#egg=python-oxweb
|
||||
-e bzr+http://code.0xdb.org/python-oxlib/#egg=python-oxlib
|
||||
-e bzr+file:///home/j/Projects/python-oxweb/#egg=python-oxweb
|
||||
-e bzr+http://code.0xdb.org/python-oxdjango/#egg=python-oxdjango
|
||||
|
||||
|
|
Loading…
Reference in a new issue