diff --git a/oxdb/backend/load.py b/oxdb/backend/load.py
index ade10939..0226a56e 100644
--- a/oxdb/backend/load.py
+++ b/oxdb/backend/load.py
@@ -5,8 +5,8 @@ import os.path
from django.db import models
from django.contrib.auth.models import User
-import oxweb.imdb
-from oxlib import stripTags, findRe
+import ox.web.imdb
+from ox import stripTags, findRe
import models
@@ -37,7 +37,7 @@ def loadIMDb(imdbId):
movie = models.Movie()
movie.imdb = imdb
- info = oxweb.imdb.getMovieInfo(imdbId)
+ info = ox.web.imdb.getMovieInfo(imdbId)
for key in ('title',
'tagline',
'year',
@@ -58,11 +58,11 @@ def loadIMDb(imdbId):
if key in info:
setattr(movie.imdb, _info_map.get(key, key), info[key])
- movie.imdb.plot = oxweb.imdb.getMoviePlot(imdbId)
+ movie.imdb.plot = ox.web.imdb.getMoviePlot(imdbId)
debug("plot", movie.imdb.plot)
- movie.imdb.runtime = oxweb.imdb.getMovieRuntimeSeconds(imdbId)
- business = oxweb.imdb.getMovieBusinessSum(imdbId)
+ movie.imdb.runtime = ox.web.imdb.getMovieRuntimeSeconds(imdbId)
+ business = ox.web.imdb.getMovieBusinessSum(imdbId)
for key in ('gross', 'profit', 'budget'):
setattr(movie.imdb, key, business[key])
@@ -70,7 +70,7 @@ def loadIMDb(imdbId):
movie.oxdbId = "__init__%s" % random.randint(0, 100000)
movie.save()
models.AlternativeTitle.objects.filter(movie=movie, manual=False).delete()
- for i in oxweb.imdb.getMovieAKATitles(imdbId):
+ for i in ox.web.imdb.getMovieAKATitles(imdbId):
t = models.AlternativeTitle()
t.movie = movie
t.title = i[0]
@@ -100,7 +100,7 @@ def loadIMDb(imdbId):
#Location
movie.locations_all.filter(manual=False).delete()
- locations = oxweb.imdb.getMovieLocations(imdbId)
+ locations = ox.web.imdb.getMovieLocations(imdbId)
for i in locations:
debug("add location", i)
location = models.Location.get_or_create(i)
@@ -116,7 +116,7 @@ def loadIMDb(imdbId):
#Keyword
movie.keywords_all.filter(manual=False).delete()
- keywords = oxweb.imdb.getMovieKeywords(imdbId)
+ keywords = ox.web.imdb.getMovieKeywords(imdbId)
for g in keywords:
debug("add keyword", g)
keyword = models.Keyword.get_or_create(g)
@@ -124,7 +124,7 @@ def loadIMDb(imdbId):
movie.trivia_all.filter(manual=False).delete()
position = 0
- trivia = oxweb.imdb.getMovieTrivia(imdbId)
+ trivia = ox.web.imdb.getMovieTrivia(imdbId)
for i in trivia:
debug("add trivia", i)
t = models.Trivia()
@@ -136,7 +136,7 @@ def loadIMDb(imdbId):
position = 0
models.Cast.objects.filter(movie=movie).filter(manual=False).delete()
- credits = oxweb.imdb.getMovieCredits(imdbId)
+ credits = ox.web.imdb.getMovieCredits(imdbId)
for role in credits:
for p in credits[role]:
name = stripTags(p[0])
@@ -149,7 +149,7 @@ def loadIMDb(imdbId):
position += 1
movie.connections_all.filter(manual=False).delete()
- connections = oxweb.imdb.getMovieConnections(imdbId)
+ connections = ox.web.imdb.getMovieConnections(imdbId)
for relation in connections:
for otherId in connections[relation]:
try:
@@ -159,7 +159,7 @@ def loadIMDb(imdbId):
except models.Movie.DoesNotExist:
pass
- reviews = oxweb.imdb.getMovieExternalReviews(imdbId)
+ reviews = ox.web.imdb.getMovieExternalReviews(imdbId)
movie.reviews_all.filter(manual=False).delete()
for r in reviews:
debug("add review", r)
diff --git a/oxdb/backend/models.py b/oxdb/backend/models.py
index 6197b7a0..502e229a 100644
--- a/oxdb/backend/models.py
+++ b/oxdb/backend/models.py
@@ -7,9 +7,9 @@ import random
from django.db import models
from django.db.models import Q
from django.contrib.auth.models import User
-import oxlib
-from oxlib import stripTags
-from oxlib.normalize import canonicalTitle, canonicalName
+import ox
+from ox import stripTags
+from ox.normalize import canonicalTitle, canonicalName
import utils
import managers
@@ -522,7 +522,7 @@ class Person(models.Model):
def save(self, *args, **kwargs):
if not self.name_sort:
- self.name_sort = oxlib.normalize.canonicalName(self.name)
+ self.name_sort = ox.normalize.canonicalName(self.name)
super(Person, self).save(*args, **kwargs)
def get_or_create(model, name, imdbId=None):
@@ -736,7 +736,7 @@ class Trivia(models.Model):
def json(self):
trivia = self.trivia
- trivia = oxlib.fixAmpersands(trivia)
+ trivia = ox.fixAmpersands(trivia)
trivia = re.sub('(.*?)', '\\2', trivia)
trivia = re.sub('(.*?)', '\\2', trivia)
return trivia
diff --git a/oxdb/backend/utils.py b/oxdb/backend/utils.py
index 25f2a9c4..0602d656 100644
--- a/oxdb/backend/utils.py
+++ b/oxdb/backend/utils.py
@@ -8,9 +8,9 @@ import sys
import re
import hashlib
-import oxlib
-import oxlib.iso
-from oxlib.normalize import normalizeName
+import ox
+import ox.iso
+from ox.normalize import normalizeName
def oxid(title, director, year='', seriesTitle='', episodeTitle='', season=0, episode=0):
oxid_value = u"\n".join([title, director, year])
@@ -62,7 +62,7 @@ def oxdb_title(_title, searchTitle = False):
return title
def oxdb_year(data):
- return oxlib.findRe(data, '\.(\d{4})\.')
+ return ox.findRe(data, '\.(\d{4})\.')
def oxdb_series_title(path):
seriesTitle = u''
diff --git a/oxdb/backend/views.py b/oxdb/backend/views.py
index 2226ecf8..618db48d 100644
--- a/oxdb/backend/views.py
+++ b/oxdb/backend/views.py
@@ -12,8 +12,8 @@ from django.template import RequestContext
from django.core.paginator import Paginator
from django.contrib.auth.decorators import login_required
from django.utils import simplejson as json
-from oxdb.utils.shortcuts import render_to_json_response
-from oxdb.utils.decorators import login_required_json
+from ox.django.shortcuts import render_to_json_response
+from ox.django.decorators import login_required_json
import models
import utils
diff --git a/oxdb/user_management/views.py b/oxdb/user_management/views.py
index d5b9666e..689363a9 100644
--- a/oxdb/user_management/views.py
+++ b/oxdb/user_management/views.py
@@ -6,8 +6,8 @@ from django.shortcuts import render_to_response, get_object_or_404, get_list_or_
from django.template import RequestContext
from django.utils import simplejson as json
-from oxdb.utils.shortcuts import render_to_json_response
-from oxdb.utils.decorators import login_required_json
+from ox.django.shortcuts import render_to_json_response
+from ox.django.decorators import login_required_json
import models
diff --git a/oxdb/utils/__init__.py b/oxdb/utils/__init__.py
deleted file mode 100644
index e69de29b..00000000
diff --git a/oxdb/utils/decorators.py b/oxdb/utils/decorators.py
deleted file mode 100644
index 1311e997..00000000
--- a/oxdb/utils/decorators.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- coding: utf-8 -*-
-# vi:si:et:sw=4:sts=4:ts=4
-from django.contrib.auth.decorators import user_passes_test
-
-
-def login_required_json(function=None):
- """
- Decorator for views that checks that the user is logged in
- return json error if not logged in.
- """
- actual_decorator = user_passes_test(
- lambda u: u.is_authenticated(),
- login_url='/json/login',
- )
- if function:
- return actual_decorator(function)
- return actual_decorator
-
diff --git a/oxdb/utils/shortcuts.py b/oxdb/utils/shortcuts.py
deleted file mode 100644
index 4505b536..00000000
--- a/oxdb/utils/shortcuts.py
+++ /dev/null
@@ -1,14 +0,0 @@
-# -*- coding: utf-8 -*-
-# vi:si:et:sw=4:sts=4:ts=4
-
-from django.http import HttpResponse
-from django.utils import simplejson
-from django.conf import settings
-
-def render_to_json_response(dictionary, content_type="text/json"):
- indent=None
- if settings.DEBUG:
- content_type = "text/javascript"
- indent = 2
- return HttpResponse(simplejson.dumps(dictionary, indent=indent), content_type=content_type)
-
diff --git a/wsgi/django.wsgi b/wsgi/django.wsgi
index 43e5837c..ce989fd4 100644
--- a/wsgi/django.wsgi
+++ b/wsgi/django.wsgi
@@ -15,7 +15,7 @@ sys.path.append(root_dir)
sys.path.append(os.path.join(root_dir, project_module))
#reload if this django.wsgi gets touched
-from utils import monitor
+from ox.django import monitor
monitor.start(interval=1.0)
monitor.track(os.path.abspath(os.path.dirname(__file__)))