oxlib->ox, oxweb->ox.web
This commit is contained in:
parent
3fe22ed624
commit
1bb16bb703
7 changed files with 34 additions and 34 deletions
|
@ -10,7 +10,7 @@ import time
|
||||||
import warnings
|
import warnings
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
import oxlib
|
import ox
|
||||||
import Image
|
import Image
|
||||||
import simplejson as json
|
import simplejson as json
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ def frame(videoFile, position, baseFolder, width=128, redo=False):
|
||||||
redo boolean to extract file even if it exists
|
redo boolean to extract file even if it exists
|
||||||
'''
|
'''
|
||||||
def frame_path(size):
|
def frame_path(size):
|
||||||
return os.path.join(baseFolder, "%s.%s.%s" % (oxlib.ms2time(position*1000), size, img_extension))
|
return os.path.join(baseFolder, "%s.%s.%s" % (ox.ms2time(position*1000), size, img_extension))
|
||||||
|
|
||||||
#not using input file, to slow to extract frame right now
|
#not using input file, to slow to extract frame right now
|
||||||
base_size = 320
|
base_size = 320
|
||||||
|
|
|
@ -6,8 +6,8 @@ import os.path
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
from oxlib import stripTags, findRe
|
from ox import stripTags, findRe
|
||||||
import oxweb.imdb
|
import ox.web.imdb
|
||||||
|
|
||||||
import models
|
import models
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ def loadIMDb(imdbId):
|
||||||
movie = models.Movie()
|
movie = models.Movie()
|
||||||
movie.imdb = imdb
|
movie.imdb = imdb
|
||||||
|
|
||||||
info = oxweb.imdb.getMovieInfo(imdbId)
|
info = ox.web.imdb.getMovieInfo(imdbId)
|
||||||
for key in ('title',
|
for key in ('title',
|
||||||
'tagline',
|
'tagline',
|
||||||
'year',
|
'year',
|
||||||
|
@ -60,11 +60,11 @@ def loadIMDb(imdbId):
|
||||||
if key in info:
|
if key in info:
|
||||||
setattr(movie.imdb, _info_map.get(key, key), info[key])
|
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)
|
debug("plot", movie.imdb.plot)
|
||||||
|
|
||||||
movie.imdb.runtime = oxweb.imdb.getMovieRuntimeSeconds(imdbId)
|
movie.imdb.runtime = ox.web.imdb.getMovieRuntimeSeconds(imdbId)
|
||||||
business = oxweb.imdb.getMovieBusinessSum(imdbId)
|
business = ox.web.imdb.getMovieBusinessSum(imdbId)
|
||||||
for key in ('gross', 'profit', 'budget'):
|
for key in ('gross', 'profit', 'budget'):
|
||||||
setattr(movie.imdb, key, business[key])
|
setattr(movie.imdb, key, business[key])
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ def loadIMDb(imdbId):
|
||||||
movie.oxdbId = "__init__%s" % random.randint(0, 100000)
|
movie.oxdbId = "__init__%s" % random.randint(0, 100000)
|
||||||
movie.save()
|
movie.save()
|
||||||
models.AlternativeTitle.objects.filter(movie=movie, manual=False).delete()
|
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 = models.AlternativeTitle()
|
||||||
t.movie = movie
|
t.movie = movie
|
||||||
t.title = i[0]
|
t.title = i[0]
|
||||||
|
@ -102,7 +102,7 @@ def loadIMDb(imdbId):
|
||||||
|
|
||||||
#Location
|
#Location
|
||||||
movie.locations_all.filter(manual=False).delete()
|
movie.locations_all.filter(manual=False).delete()
|
||||||
locations = oxweb.imdb.getMovieLocations(imdbId)
|
locations = ox.web.imdb.getMovieLocations(imdbId)
|
||||||
for i in locations:
|
for i in locations:
|
||||||
debug("add location", i)
|
debug("add location", i)
|
||||||
location, created = models.Location.objects.get_or_create(name=i)
|
location, created = models.Location.objects.get_or_create(name=i)
|
||||||
|
@ -118,7 +118,7 @@ def loadIMDb(imdbId):
|
||||||
|
|
||||||
#Keyword
|
#Keyword
|
||||||
movie.keywords_all.filter(manual=False).delete()
|
movie.keywords_all.filter(manual=False).delete()
|
||||||
keywords = oxweb.imdb.getMovieKeywords(imdbId)
|
keywords = ox.web.imdb.getMovieKeywords(imdbId)
|
||||||
for g in keywords:
|
for g in keywords:
|
||||||
debug("add keyword", g)
|
debug("add keyword", g)
|
||||||
keyword, created = models.Keyword.objects.get_or_create(name=g)
|
keyword, created = models.Keyword.objects.get_or_create(name=g)
|
||||||
|
@ -126,7 +126,7 @@ def loadIMDb(imdbId):
|
||||||
|
|
||||||
movie.trivia_all.filter(manual=False).delete()
|
movie.trivia_all.filter(manual=False).delete()
|
||||||
position = 0
|
position = 0
|
||||||
trivia = oxweb.imdb.getMovieTrivia(imdbId)
|
trivia = ox.web.imdb.getMovieTrivia(imdbId)
|
||||||
for i in trivia:
|
for i in trivia:
|
||||||
debug("add trivia", i)
|
debug("add trivia", i)
|
||||||
t = models.Trivia()
|
t = models.Trivia()
|
||||||
|
@ -138,7 +138,7 @@ def loadIMDb(imdbId):
|
||||||
|
|
||||||
position = 0
|
position = 0
|
||||||
models.Cast.objects.filter(movie=movie).filter(manual=False).delete()
|
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 role in credits:
|
||||||
for p in credits[role]:
|
for p in credits[role]:
|
||||||
name = stripTags(p[0])
|
name = stripTags(p[0])
|
||||||
|
@ -151,7 +151,7 @@ def loadIMDb(imdbId):
|
||||||
position += 1
|
position += 1
|
||||||
|
|
||||||
movie.connections_all.filter(manual=False).delete()
|
movie.connections_all.filter(manual=False).delete()
|
||||||
connections = oxweb.imdb.getMovieConnections(imdbId)
|
connections = ox.web.imdb.getMovieConnections(imdbId)
|
||||||
for relation in connections:
|
for relation in connections:
|
||||||
for otherId in connections[relation]:
|
for otherId in connections[relation]:
|
||||||
try:
|
try:
|
||||||
|
@ -161,7 +161,7 @@ def loadIMDb(imdbId):
|
||||||
except models.Movie.DoesNotExist:
|
except models.Movie.DoesNotExist:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
reviews = oxweb.imdb.getMovieExternalReviews(imdbId)
|
reviews = ox.web.imdb.getMovieExternalReviews(imdbId)
|
||||||
movie.reviews_all.filter(manual=False).delete()
|
movie.reviews_all.filter(manual=False).delete()
|
||||||
for r in reviews:
|
for r in reviews:
|
||||||
debug("add review", r)
|
debug("add review", r)
|
||||||
|
|
|
@ -13,9 +13,9 @@ from django.utils import simplejson as json
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from oxdjango import fields
|
from oxdjango import fields
|
||||||
import oxlib
|
import ox
|
||||||
from oxlib import stripTags
|
from ox import stripTags
|
||||||
from oxlib.normalize import canonicalTitle, canonicalName
|
from ox.normalize import canonicalTitle, canonicalName
|
||||||
from firefogg import Firefogg
|
from firefogg import Firefogg
|
||||||
|
|
||||||
import managers
|
import managers
|
||||||
|
@ -618,7 +618,7 @@ class Person(models.Model):
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
if not self.name_sort:
|
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)
|
super(Person, self).save(*args, **kwargs)
|
||||||
|
|
||||||
def get_or_create(model, name, imdbId=None):
|
def get_or_create(model, name, imdbId=None):
|
||||||
|
@ -823,7 +823,7 @@ class Trivia(models.Model):
|
||||||
|
|
||||||
def json(self):
|
def json(self):
|
||||||
trivia = self.trivia
|
trivia = self.trivia
|
||||||
trivia = oxlib.fixAmpersands(trivia)
|
trivia = ox.fixAmpersands(trivia)
|
||||||
trivia = re.sub('<a name="#tr\d{7}"></a> ', '', trivia)
|
trivia = re.sub('<a name="#tr\d{7}"></a> ', '', trivia)
|
||||||
trivia = re.sub('<a href="(/name/nm.*?)">(.*?)</a>', '<a href="/?f=name&q=\\2">\\2</a>', trivia)
|
trivia = re.sub('<a href="(/name/nm.*?)">(.*?)</a>', '<a href="/?f=name&q=\\2">\\2</a>', trivia)
|
||||||
trivia = re.sub('<a href="/title/tt(.*?)/">(.*?)</a>', '<a href="/\\1">\\2</a>', trivia)
|
trivia = re.sub('<a href="/title/tt(.*?)/">(.*?)</a>', '<a href="/\\1">\\2</a>', trivia)
|
||||||
|
@ -947,7 +947,7 @@ def timeline_path(f):
|
||||||
return os.path.join(url_hash[:2], url_hash[2:4], url_hash[4:6], url_hash, name)
|
return os.path.join(url_hash[:2], url_hash[2:4], url_hash[4:6], url_hash, name)
|
||||||
|
|
||||||
def frame_path(f):
|
def frame_path(f):
|
||||||
position = oxlib.formatDuration(f.position*1000).replace(':', '.')
|
position = ox.formatDuration(f.position*1000).replace(':', '.')
|
||||||
name = "%s.%s" % (position, 'png')
|
name = "%s.%s" % (position, 'png')
|
||||||
url_hash = f.file.oshash
|
url_hash = f.file.oshash
|
||||||
return os.path.join(url_hash[:2], url_hash[2:4], url_hash[4:6], url_hash, 'frames', name)
|
return os.path.join(url_hash[:2], url_hash[2:4], url_hash[4:6], url_hash, 'frames', name)
|
||||||
|
|
|
@ -8,9 +8,9 @@ import sys
|
||||||
import re
|
import re
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
||||||
import oxlib
|
import ox
|
||||||
import oxlib.iso
|
import ox.iso
|
||||||
from oxlib.normalize import normalizeName
|
from ox.normalize import normalizeName
|
||||||
|
|
||||||
def oxid(title, director, year='', seriesTitle='', episodeTitle='', season=0, episode=0):
|
def oxid(title, director, year='', seriesTitle='', episodeTitle='', season=0, episode=0):
|
||||||
oxid_value = u"\n".join([title, director, year])
|
oxid_value = u"\n".join([title, director, year])
|
||||||
|
@ -62,7 +62,7 @@ def oxdb_title(_title, searchTitle = False):
|
||||||
return title
|
return title
|
||||||
|
|
||||||
def oxdb_year(data):
|
def oxdb_year(data):
|
||||||
return oxlib.findRe(data, '\.(\d{4})\.')
|
return ox.findRe(data, '\.(\d{4})\.')
|
||||||
|
|
||||||
def oxdb_series_title(path):
|
def oxdb_series_title(path):
|
||||||
seriesTitle = u''
|
seriesTitle = u''
|
||||||
|
@ -113,7 +113,7 @@ def oxdb_part(path):
|
||||||
return part
|
return part
|
||||||
|
|
||||||
def parsePath(path):
|
def parsePath(path):
|
||||||
import oxweb.imdb
|
import ox.web.imdb
|
||||||
search_title = oxdb_title(path, True)
|
search_title = oxdb_title(path, True)
|
||||||
r = {}
|
r = {}
|
||||||
r['title'] = oxdb_title(path)
|
r['title'] = oxdb_title(path)
|
||||||
|
@ -122,6 +122,6 @@ def parsePath(path):
|
||||||
r['season'], r['episode'] = oxdb_season_episode(path)
|
r['season'], r['episode'] = oxdb_season_episode(path)
|
||||||
r['series'] = oxdb_series_title(path)
|
r['series'] = oxdb_series_title(path)
|
||||||
r['part'] = oxdb_part(path)
|
r['part'] = oxdb_part(path)
|
||||||
r['imdbId'] = oxweb.imdb.guess(search_title, r['director'], timeout=-1)
|
r['imdbId'] = ox.web.imdb.guess(search_title, r['director'], timeout=-1)
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ except ImportError:
|
||||||
from oxdjango.decorators import login_required_json
|
from oxdjango.decorators import login_required_json
|
||||||
from oxdjango.shortcuts import render_to_json_response, get_object_or_404_json, json_response
|
from oxdjango.shortcuts import render_to_json_response, get_object_or_404_json, json_response
|
||||||
from oxdjango.http import HttpFileResponse
|
from oxdjango.http import HttpFileResponse
|
||||||
import oxlib
|
import ox
|
||||||
|
|
||||||
import models
|
import models
|
||||||
import utils
|
import utils
|
||||||
|
@ -619,7 +619,7 @@ def api_getImdbId(request):
|
||||||
return {'status': {'code': int, 'text': string},
|
return {'status': {'code': int, 'text': string},
|
||||||
'data': {imdbId:string }}
|
'data': {imdbId:string }}
|
||||||
'''
|
'''
|
||||||
imdbId = oxweb.imdb.guess(search_title, r['director'], timeout=-1)
|
imdbId = ox.web.imdb.guess(search_title, r['director'], timeout=-1)
|
||||||
if imdbId:
|
if imdbId:
|
||||||
response = json_response({'imdbId': imdbId})
|
response = json_response({'imdbId': imdbId})
|
||||||
else:
|
else:
|
||||||
|
@ -688,7 +688,7 @@ def video(request, id, quality):
|
||||||
|
|
||||||
def frame(request, id, position, size):
|
def frame(request, id, position, size):
|
||||||
movie = get_object_or_404(models.Movie, movieId=id)
|
movie = get_object_or_404(models.Movie, movieId=id)
|
||||||
position = oxlib.time2ms(position)/1000
|
position = ox.time2ms(position)/1000
|
||||||
frame = movie.frame(position, int(size))
|
frame = movie.frame(position, int(size))
|
||||||
if not frame:
|
if not frame:
|
||||||
raise Http404
|
raise Http404
|
||||||
|
|
|
@ -7,7 +7,7 @@ import base64
|
||||||
from subprocess import Popen
|
from subprocess import Popen
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
import oxlib.torrent
|
import ox.torrent
|
||||||
import transmissionrpc
|
import transmissionrpc
|
||||||
|
|
||||||
def connect():
|
def connect():
|
||||||
|
@ -32,7 +32,7 @@ def add(torrent_file):
|
||||||
download_dir = os.path.dirname(torrent_file)
|
download_dir = os.path.dirname(torrent_file)
|
||||||
with open(torrent_file) as f:
|
with open(torrent_file) as f:
|
||||||
torrent_data = base64.b64encode(f.read())
|
torrent_data = base64.b64encode(f.read())
|
||||||
info_hash = oxlib.torrent.getInfoHash(torrent_file)
|
info_hash = ox.torrent.getInfoHash(torrent_file)
|
||||||
try:
|
try:
|
||||||
tc = connect()
|
tc = connect()
|
||||||
if not is_seeding(info_hash):
|
if not is_seeding(info_hash):
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
-e svn+http://code.djangoproject.com/svn/django/trunk#egg=django
|
-e svn+http://code.djangoproject.com/svn/django/trunk#egg=django
|
||||||
-e hg+http://bitbucket.org/andrewgodwin/south/#egg=south
|
-e hg+http://bitbucket.org/andrewgodwin/south/#egg=south
|
||||||
chardet
|
chardet
|
||||||
-e bzr+http://code.0x2620.org/python-oxlib/#egg=python-oxlib
|
-e bzr+http://code.0x2620.org/python-ox/#egg=python-ox
|
||||||
-e bzr+http://code.0x2620.org/python-oxweb/#egg=python-oxweb
|
-e bzr+http://code.0x2620.org/python-ox.web/#egg=python-ox.web
|
||||||
-e bzr+http://code.0x2620.org/python-oxdjango/#egg=python-oxdjango
|
-e bzr+http://code.0x2620.org/python-oxdjango/#egg=python-oxdjango
|
||||||
simplejson
|
simplejson
|
||||||
-e hg+https://django-ajax-filtered-fields.googlecode.com/hg/#egg=django-ajax-filtered-fields
|
-e hg+https://django-ajax-filtered-fields.googlecode.com/hg/#egg=django-ajax-filtered-fields
|
||||||
|
|
Loading…
Reference in a new issue