random commit

This commit is contained in:
j 2009-12-31 16:04:32 +01:00
parent e98b6828fe
commit f24b268352
19 changed files with 908 additions and 542 deletions

View file

@ -1,2 +1,6 @@
secret.txt secret.txt
local_settings.py local_settings.py
lib
include
src
bin

36
README Normal file
View file

@ -0,0 +1,36 @@
To setup a local instance of 0xdb:
bzr branch http://code.0xdb.org/oxdb oxdb
cd oxdb
virtualenv .
pip -E . install -r requirements.txt
you need python, bazaar, pip and virtualenv:
apt-get install python-setuptools bzr
east_install pip
pip install virtualenv
also it uses system python moduels, so make sure you have
ipython, dbmodule(psycopg2, python-mysqldb,..)
installed via apt-get/pip/easy_install in your system path.
Install rabbitmq and carrot:
sudo apt-get install rabbitmq-server
sudo rabbitmqctl add_user oxdb password
sudo rabbitmqctl add_vhost /oxdb
sudo rabbitmqctl set_permissions -p /oxdb oxdb "^oxdb-.*" ".*" ".*"
update BROKER_* settings in local_settings.py:
Development:
we are using django, http://docs.djangoproject.com/en/dev/
communication between webserver and background tasks is done via rabbitmq
http://github.com/ask/carrot/ for more info on the lib used to communicate

24
apache/vhost.conf.in Normal file
View file

@ -0,0 +1,24 @@
<VirtualHost *:80>
<Location />
Options -Indexes
</Location>
<Directory __PREFIX__>
Order deny,allow
Allow from all
</Directory>
Alias /.bzr /oxdb/.bzr
Alias /static __PREFIX__/oxdb/static
Alias /favicon.ico __PREFIX__/oxdb/static/favicon.ico
Alias /media __PREFIX__/oxdb/media
Alias /admin/media __PREFIX__/src/django/django/contrib/admin/media
WSGIScriptAlias / __PREFIX__/wsgi/django.wsgi
WSGIDaemonProcess oxdb user=oxdb group=oxdb threads=25 python-path=__PREFIX__/lib/python2.6/site-packages/
WSGIProcessGroup oxdb
ServerSignature Off
</VirtualHost>

46
oxdb/backend/admin.py Normal file
View file

@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
# Written 2009 by j@mailb.org
from django.contrib import admin
from forms import FileAdminForm, MovieAdminForm, ArchiveFileAdminForm
import models
#class MovieImdbAdmin(admin.ModelAdmin):
# search_fields = ['imdbId', 'title']
#admin.site.register(models.MovieImdb, MovieImdbAdmin)
class MovieImdbInline(admin.StackedInline):
model = models.MovieImdb
class MovieOxdbInline(admin.StackedInline):
model = models.MovieOxdb
class MovieAdmin(admin.ModelAdmin):
search_fields = ['movieId', 'imdb__title', 'oxdb__title']
form = MovieAdminForm
#inlines = [MovieImdbInline, MovieOxdbInline]
admin.site.register(models.Movie, MovieAdmin)
class FileAdmin(admin.ModelAdmin):
search_fields = ['path', 'video_codec']
form = FileAdminForm
admin.site.register(models.File, FileAdmin)
class ArchiveFileAdmin(admin.ModelAdmin):
search_fields = ['path', 'archive__name']
form = ArchiveFileAdminForm
admin.site.register(models.ArchiveFile, ArchiveFileAdmin)
class ArchiveAdmin(admin.ModelAdmin):
search_fields = ['name']
admin.site.register(models.Archive, ArchiveAdmin)

47
oxdb/backend/fields.py Normal file
View file

@ -0,0 +1,47 @@
from django.db import models
from django.utils import simplejson as json
class DictField(models.TextField):
"""DictField is a textfield that contains JSON-serialized dictionaries."""
# Used so to_python() is called
__metaclass__ = models.SubfieldBase
def to_python(self, value):
"""Convert our string value to python after we load it from the DB"""
if isinstance(value, dict):
return value
value = json.loads(value)
assert isinstance(value, dict)
return value
def get_db_prep_save(self, value):
"""Convert our JSON object to a string before we save"""
assert isinstance(value, dict)
value = json.dumps(value)
return super(DictField, self).get_db_prep_save(value)
class TupleField(models.TextField):
"""TupleField is a textfield that contains JSON-serialized tuples."""
# Used so to_python() is called
__metaclass__ = models.SubfieldBase
def to_python(self, value):
"""Convert our string value to JSON after we load it from the DB"""
if isinstance(value, tuple):
return value
value = json.loads(value)
assert isinstance(value, list)
return tuple(value)
def get_db_prep_save(self, value):
"""Convert our JSON object to a string before we save"""
assert isinstance(value, tuple)
value = json.dumps(value)
return super(TupleField, self).get_db_prep_save(value)

42
oxdb/backend/forms.py Normal file
View file

@ -0,0 +1,42 @@
from ajax_filtered_fields.forms import AjaxManyToManyField, ForeignKeyByLetter
from django.conf import settings
from django import forms
import models
ajax_filtered_js = (
settings.ADMIN_MEDIA_PREFIX + "js/SelectBox.js",
settings.ADMIN_MEDIA_PREFIX + "js/SelectFilter2.js",
settings.STATIC_URL + 'js/jquery/jquery.js',
settings.STATIC_URL + 'js/ajax_filtered_fields.js',
)
class FileAdminForm(forms.ModelForm):
movie = ForeignKeyByLetter(models.Movie, field_name='imdb__title')
class Meta:
model = models.File
class Media:
js = ajax_filtered_js
class ArchiveFileAdminForm(forms.ModelForm):
file = ForeignKeyByLetter(models.File, field_name='path')
class Meta:
model = models.ArchiveFile
class Media:
js = ajax_filtered_js
class MovieAdminForm(forms.ModelForm):
imdb = ForeignKeyByLetter(models.MovieImdb, field_name='title')
oxdb = ForeignKeyByLetter(models.MovieOxdb, field_name='title')
class Meta:
model = models.Movie
class Media:
js = ajax_filtered_js

View file

@ -5,8 +5,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
import ox.web.imdb import oxweb.imdb
from ox import stripTags, findRe from oxlib import stripTags, findRe
import models import models
@ -37,14 +37,14 @@ def loadIMDb(imdbId):
movie = models.Movie() movie = models.Movie()
movie.imdb = imdb movie.imdb = imdb
info = ox.web.imdb.getMovieInfo(imdbId) info = oxweb.imdb.getMovieInfo(imdbId)
for key in ('title', for key in ('title',
'tagline', 'tagline',
'year', 'year',
'release_date', 'release_date',
'rating', 'rating',
'votes', 'votes',
'series_imdb' 'series_imdb',
'season', 'season',
'episode'): 'episode'):
if key in info: if key in info:
@ -58,11 +58,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 = ox.web.imdb.getMoviePlot(imdbId) movie.imdb.plot = oxweb.imdb.getMoviePlot(imdbId)
debug("plot", movie.imdb.plot) debug("plot", movie.imdb.plot)
movie.imdb.runtime = ox.web.imdb.getMovieRuntimeSeconds(imdbId) movie.imdb.runtime = oxweb.imdb.getMovieRuntimeSeconds(imdbId)
business = ox.web.imdb.getMovieBusinessSum(imdbId) business = oxweb.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])
@ -70,7 +70,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 ox.web.imdb.getMovieAKATitles(imdbId): for i in oxweb.imdb.getMovieAKATitles(imdbId):
t = models.AlternativeTitle() t = models.AlternativeTitle()
t.movie = movie t.movie = movie
t.title = i[0] t.title = i[0]
@ -100,7 +100,7 @@ def loadIMDb(imdbId):
#Location #Location
movie.locations_all.filter(manual=False).delete() movie.locations_all.filter(manual=False).delete()
locations = ox.web.imdb.getMovieLocations(imdbId) locations = oxweb.imdb.getMovieLocations(imdbId)
for i in locations: for i in locations:
debug("add location", i) debug("add location", i)
location = models.Location.get_or_create(i) location = models.Location.get_or_create(i)
@ -116,7 +116,7 @@ def loadIMDb(imdbId):
#Keyword #Keyword
movie.keywords_all.filter(manual=False).delete() movie.keywords_all.filter(manual=False).delete()
keywords = ox.web.imdb.getMovieKeywords(imdbId) keywords = oxweb.imdb.getMovieKeywords(imdbId)
for g in keywords: for g in keywords:
debug("add keyword", g) debug("add keyword", g)
keyword = models.Keyword.get_or_create(g) keyword = models.Keyword.get_or_create(g)
@ -124,7 +124,7 @@ def loadIMDb(imdbId):
movie.trivia_all.filter(manual=False).delete() movie.trivia_all.filter(manual=False).delete()
position = 0 position = 0
trivia = ox.web.imdb.getMovieTrivia(imdbId) trivia = oxweb.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()
@ -136,7 +136,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 = ox.web.imdb.getMovieCredits(imdbId) credits = oxweb.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])
@ -149,7 +149,7 @@ def loadIMDb(imdbId):
position += 1 position += 1
movie.connections_all.filter(manual=False).delete() movie.connections_all.filter(manual=False).delete()
connections = ox.web.imdb.getMovieConnections(imdbId) connections = oxweb.imdb.getMovieConnections(imdbId)
for relation in connections: for relation in connections:
for otherId in connections[relation]: for otherId in connections[relation]:
try: try:
@ -159,7 +159,7 @@ def loadIMDb(imdbId):
except models.Movie.DoesNotExist: except models.Movie.DoesNotExist:
pass pass
reviews = ox.web.imdb.getMovieExternalReviews(imdbId) reviews = oxweb.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)

View file

@ -132,7 +132,7 @@ class FileManager(Manager):
def movie_files(self, movie): def movie_files(self, movie):
q = self.get_query_set() q = self.get_query_set()
return q.filter(is_video=True, movie=movie) return q.filter(type=1, movie=movie)
class ArchiveFileManager(Manager): class ArchiveFileManager(Manager):
def get_query_set(self): def get_query_set(self):
@ -144,9 +144,10 @@ class ArchiveFileManager(Manager):
def by_oshash(self, oshash): def by_oshash(self, oshash):
q = self.get_query_set() q = self.get_query_set()
q.filter(movie_file__oshash=oshash) q = q.filter(file__oshash=oshash)
if q.count() == 0: if q.count() == 0:
raise models.ArchiveFile.DoesNotExist("%s matching oshash %s does not exist." % raise models.ArchiveFile.DoesNotExist("%s matching oshash %s does not exist." %
(models.ArchiveFile._meta.object_name, oshash)) (models.ArchiveFile._meta.object_name, oshash))
return q[0] else:
return q[0]

View file

@ -2,7 +2,7 @@
from south.db import db from south.db import db
from django.db import models from django.db import models
from oxdb.backend.models import * from backend.models import *
class Migration: class Migration:
@ -12,8 +12,9 @@ class Migration:
db.create_table('backend_trivia', ( db.create_table('backend_trivia', (
('id', orm['backend.Trivia:id']), ('id', orm['backend.Trivia:id']),
('trivia', orm['backend.Trivia:trivia']), ('trivia', orm['backend.Trivia:trivia']),
('movie', orm['backend.Trivia:movie']), ('manual', orm['backend.Trivia:manual']),
('position', orm['backend.Trivia:position']), ('position', orm['backend.Trivia:position']),
('movie', orm['backend.Trivia:movie']),
)) ))
db.send_create_signal('backend', ['Trivia']) db.send_create_signal('backend', ['Trivia'])
@ -23,6 +24,7 @@ class Migration:
('movie', orm['backend.AlternativeTitle:movie']), ('movie', orm['backend.AlternativeTitle:movie']),
('title', orm['backend.AlternativeTitle:title']), ('title', orm['backend.AlternativeTitle:title']),
('type', orm['backend.AlternativeTitle:type']), ('type', orm['backend.AlternativeTitle:type']),
('manual', orm['backend.AlternativeTitle:manual']),
)) ))
db.send_create_signal('backend', ['AlternativeTitle']) db.send_create_signal('backend', ['AlternativeTitle'])
@ -32,6 +34,7 @@ class Migration:
('movie', orm['backend.MovieLanguage:movie']), ('movie', orm['backend.MovieLanguage:movie']),
('language', orm['backend.MovieLanguage:language']), ('language', orm['backend.MovieLanguage:language']),
('position', orm['backend.MovieLanguage:position']), ('position', orm['backend.MovieLanguage:position']),
('manual', orm['backend.MovieLanguage:manual']),
)) ))
db.send_create_signal('backend', ['MovieLanguage']) db.send_create_signal('backend', ['MovieLanguage'])
@ -40,10 +43,12 @@ class Migration:
('id', orm['backend.Movie:id']), ('id', orm['backend.Movie:id']),
('created', orm['backend.Movie:created']), ('created', orm['backend.Movie:created']),
('modified', orm['backend.Movie:modified']), ('modified', orm['backend.Movie:modified']),
('accessed', orm['backend.Movie:accessed']), ('available', orm['backend.Movie:available']),
('movieId', orm['backend.Movie:movieId']), ('movieId', orm['backend.Movie:movieId']),
('imdbId', orm['backend.Movie:imdbId']),
('oxdbId', orm['backend.Movie:oxdbId']), ('oxdbId', orm['backend.Movie:oxdbId']),
('imdb', orm['backend.Movie:imdb']),
('oxdb', orm['backend.Movie:oxdb']),
('rights_level', orm['backend.Movie:rights_level']),
('title', orm['backend.Movie:title']), ('title', orm['backend.Movie:title']),
('year', orm['backend.Movie:year']), ('year', orm['backend.Movie:year']),
('runtime', orm['backend.Movie:runtime']), ('runtime', orm['backend.Movie:runtime']),
@ -56,26 +61,29 @@ class Migration:
('budget', orm['backend.Movie:budget']), ('budget', orm['backend.Movie:budget']),
('gross', orm['backend.Movie:gross']), ('gross', orm['backend.Movie:gross']),
('profit', orm['backend.Movie:profit']), ('profit', orm['backend.Movie:profit']),
('files_modified', orm['backend.Movie:files_modified']),
('filename', orm['backend.Movie:filename']),
('extracted', orm['backend.Movie:extracted']),
('duration', orm['backend.Movie:duration']),
('rights_level', orm['backend.Movie:rights_level']),
('tpb_id', orm['backend.Movie:tpb_id']),
('kg_id', orm['backend.Movie:kg_id']),
('open_subtitle_id', orm['backend.Movie:open_subtitle_id']),
('wikipedia_url', orm['backend.Movie:wikipedia_url']),
('series_imdb', orm['backend.Movie:series_imdb']), ('series_imdb', orm['backend.Movie:series_imdb']),
('series_title', orm['backend.Movie:series_title']), ('series_title', orm['backend.Movie:series_title']),
('episode_title', orm['backend.Movie:episode_title']), ('episode_title', orm['backend.Movie:episode_title']),
('season', orm['backend.Movie:season']), ('season', orm['backend.Movie:season']),
('episode', orm['backend.Movie:episode']), ('episode', orm['backend.Movie:episode']),
('still_pos', orm['backend.Movie:still_pos']), ('directors', orm['backend.Movie:directors']),
('poster', orm['backend.Movie:poster']), ('writers', orm['backend.Movie:writers']),
('posters_disabled', orm['backend.Movie:posters_disabled']), ('editors', orm['backend.Movie:editors']),
('posters_available', orm['backend.Movie:posters_available']), ('producers', orm['backend.Movie:producers']),
('poster_height', orm['backend.Movie:poster_height']), ('cinematographers', orm['backend.Movie:cinematographers']),
('poster_width', orm['backend.Movie:poster_width']), ('cast', orm['backend.Movie:cast']),
('alternative_titles', orm['backend.Movie:alternative_titles']),
('genres', orm['backend.Movie:genres']),
('keywords', orm['backend.Movie:keywords']),
('countries', orm['backend.Movie:countries']),
('languages', orm['backend.Movie:languages']),
('trivia', orm['backend.Movie:trivia']),
('locations', orm['backend.Movie:locations']),
('connections', orm['backend.Movie:connections']),
('reviews', orm['backend.Movie:reviews']),
('stream128', orm['backend.Movie:stream128']),
('stream320', orm['backend.Movie:stream320']),
('stream640', orm['backend.Movie:stream640']),
('scene_height', orm['backend.Movie:scene_height']), ('scene_height', orm['backend.Movie:scene_height']),
)) ))
db.send_create_signal('backend', ['Movie']) db.send_create_signal('backend', ['Movie'])
@ -86,6 +94,7 @@ class Migration:
('created', orm['backend.Archive:created']), ('created', orm['backend.Archive:created']),
('modified', orm['backend.Archive:modified']), ('modified', orm['backend.Archive:modified']),
('name', orm['backend.Archive:name']), ('name', orm['backend.Archive:name']),
('public', orm['backend.Archive:public']),
)) ))
db.send_create_signal('backend', ['Archive']) db.send_create_signal('backend', ['Archive'])
@ -95,11 +104,36 @@ class Migration:
('created', orm['backend.ArchiveFile:created']), ('created', orm['backend.ArchiveFile:created']),
('modified', orm['backend.ArchiveFile:modified']), ('modified', orm['backend.ArchiveFile:modified']),
('archive', orm['backend.ArchiveFile:archive']), ('archive', orm['backend.ArchiveFile:archive']),
('movie_file', orm['backend.ArchiveFile:movie_file']), ('file', orm['backend.ArchiveFile:file']),
('path', orm['backend.ArchiveFile:path']), ('path', orm['backend.ArchiveFile:path']),
)) ))
db.send_create_signal('backend', ['ArchiveFile']) db.send_create_signal('backend', ['ArchiveFile'])
# Adding model 'MovieOxdb'
db.create_table('backend_movieoxdb', (
('id', orm['backend.MovieOxdb:id']),
('created', orm['backend.MovieOxdb:created']),
('modified', orm['backend.MovieOxdb:modified']),
('title', orm['backend.MovieOxdb:title']),
('year', orm['backend.MovieOxdb:year']),
('runtime', orm['backend.MovieOxdb:runtime']),
('release_date', orm['backend.MovieOxdb:release_date']),
('tagline', orm['backend.MovieOxdb:tagline']),
('plot', orm['backend.MovieOxdb:plot']),
('plot_outline', orm['backend.MovieOxdb:plot_outline']),
('rating', orm['backend.MovieOxdb:rating']),
('votes', orm['backend.MovieOxdb:votes']),
('budget', orm['backend.MovieOxdb:budget']),
('gross', orm['backend.MovieOxdb:gross']),
('profit', orm['backend.MovieOxdb:profit']),
('series_imdb', orm['backend.MovieOxdb:series_imdb']),
('series_title', orm['backend.MovieOxdb:series_title']),
('episode_title', orm['backend.MovieOxdb:episode_title']),
('season', orm['backend.MovieOxdb:season']),
('episode', orm['backend.MovieOxdb:episode']),
))
db.send_create_signal('backend', ['MovieOxdb'])
# Adding model 'Language' # Adding model 'Language'
db.create_table('backend_language', ( db.create_table('backend_language', (
('id', orm['backend.Language:id']), ('id', orm['backend.Language:id']),
@ -115,9 +149,22 @@ class Migration:
)) ))
db.send_create_signal('backend', ['ReviewWhitelist']) db.send_create_signal('backend', ['ReviewWhitelist'])
# Adding model 'Layer'
db.create_table('backend_layer', (
('id', orm['backend.Layer:id']),
('created', orm['backend.Layer:created']),
('modified', orm['backend.Layer:modified']),
('user', orm['backend.Layer:user']),
('movie', orm['backend.Layer:movie']),
('time_in', orm['backend.Layer:time_in']),
('time_out', orm['backend.Layer:time_out']),
('type', orm['backend.Layer:type']),
('value', orm['backend.Layer:value']),
))
db.send_create_signal('backend', ['Layer'])
# Adding model 'MovieSort' # Adding model 'MovieSort'
db.create_table('backend_moviesort', ( db.create_table('backend_moviesort', (
('id', orm['backend.MovieSort:id']),
('movie', orm['backend.MovieSort:movie']), ('movie', orm['backend.MovieSort:movie']),
('title', orm['backend.MovieSort:title']), ('title', orm['backend.MovieSort:title']),
('director', orm['backend.MovieSort:director']), ('director', orm['backend.MovieSort:director']),
@ -135,6 +182,8 @@ class Migration:
('summary', orm['backend.MovieSort:summary']), ('summary', orm['backend.MovieSort:summary']),
('trivia', orm['backend.MovieSort:trivia']), ('trivia', orm['backend.MovieSort:trivia']),
('connections', orm['backend.MovieSort:connections']), ('connections', orm['backend.MovieSort:connections']),
('rating', orm['backend.MovieSort:rating']),
('votes', orm['backend.MovieSort:votes']),
('scenes', orm['backend.MovieSort:scenes']), ('scenes', orm['backend.MovieSort:scenes']),
('words', orm['backend.MovieSort:words']), ('words', orm['backend.MovieSort:words']),
('wpm', orm['backend.MovieSort:wpm']), ('wpm', orm['backend.MovieSort:wpm']),
@ -163,6 +212,7 @@ class Migration:
('computed_path', orm['backend.File:computed_path']), ('computed_path', orm['backend.File:computed_path']),
('size', orm['backend.File:size']), ('size', orm['backend.File:size']),
('duration', orm['backend.File:duration']), ('duration', orm['backend.File:duration']),
('is_video', orm['backend.File:is_video']),
('video_codec', orm['backend.File:video_codec']), ('video_codec', orm['backend.File:video_codec']),
('pixel_format', orm['backend.File:pixel_format']), ('pixel_format', orm['backend.File:pixel_format']),
('width', orm['backend.File:width']), ('width', orm['backend.File:width']),
@ -176,6 +226,10 @@ class Migration:
('bpp', orm['backend.File:bpp']), ('bpp', orm['backend.File:bpp']),
('pixels', orm['backend.File:pixels']), ('pixels', orm['backend.File:pixels']),
('part', orm['backend.File:part']), ('part', orm['backend.File:part']),
('available', orm['backend.File:available']),
('stream128', orm['backend.File:stream128']),
('stream320', orm['backend.File:stream320']),
('stream640', orm['backend.File:stream640']),
)) ))
db.send_create_signal('backend', ['File']) db.send_create_signal('backend', ['File'])
@ -190,6 +244,7 @@ class Migration:
db.create_table('backend_genre', ( db.create_table('backend_genre', (
('id', orm['backend.Genre:id']), ('id', orm['backend.Genre:id']),
('name', orm['backend.Genre:name']), ('name', orm['backend.Genre:name']),
('manual', orm['backend.Genre:manual']),
)) ))
db.send_create_signal('backend', ['Genre']) db.send_create_signal('backend', ['Genre'])
@ -199,6 +254,7 @@ class Migration:
('movie', orm['backend.MovieCountry:movie']), ('movie', orm['backend.MovieCountry:movie']),
('country', orm['backend.MovieCountry:country']), ('country', orm['backend.MovieCountry:country']),
('position', orm['backend.MovieCountry:position']), ('position', orm['backend.MovieCountry:position']),
('manual', orm['backend.MovieCountry:manual']),
)) ))
db.send_create_signal('backend', ['MovieCountry']) db.send_create_signal('backend', ['MovieCountry'])
@ -208,6 +264,7 @@ class Migration:
('movie', orm['backend.Review:movie']), ('movie', orm['backend.Review:movie']),
('title', orm['backend.Review:title']), ('title', orm['backend.Review:title']),
('url', orm['backend.Review:url']), ('url', orm['backend.Review:url']),
('manual', orm['backend.Review:manual']),
)) ))
db.send_create_signal('backend', ['Review']) db.send_create_signal('backend', ['Review'])
@ -217,7 +274,7 @@ class Migration:
('created', orm['backend.Subtitle:created']), ('created', orm['backend.Subtitle:created']),
('modified', orm['backend.Subtitle:modified']), ('modified', orm['backend.Subtitle:modified']),
('user', orm['backend.Subtitle:user']), ('user', orm['backend.Subtitle:user']),
('movie_file', orm['backend.Subtitle:movie_file']), ('file', orm['backend.Subtitle:file']),
('language', orm['backend.Subtitle:language']), ('language', orm['backend.Subtitle:language']),
('srt', orm['backend.Subtitle:srt']), ('srt', orm['backend.Subtitle:srt']),
)) ))
@ -231,6 +288,7 @@ class Migration:
('role', orm['backend.Cast:role']), ('role', orm['backend.Cast:role']),
('character', orm['backend.Cast:character']), ('character', orm['backend.Cast:character']),
('position', orm['backend.Cast:position']), ('position', orm['backend.Cast:position']),
('manual', orm['backend.Cast:manual']),
)) ))
db.send_create_signal('backend', ['Cast']) db.send_create_signal('backend', ['Cast'])
@ -247,9 +305,36 @@ class Migration:
db.create_table('backend_keyword', ( db.create_table('backend_keyword', (
('id', orm['backend.Keyword:id']), ('id', orm['backend.Keyword:id']),
('name', orm['backend.Keyword:name']), ('name', orm['backend.Keyword:name']),
('manual', orm['backend.Keyword:manual']),
)) ))
db.send_create_signal('backend', ['Keyword']) db.send_create_signal('backend', ['Keyword'])
# Adding model 'MovieImdb'
db.create_table('backend_movieimdb', (
('id', orm['backend.MovieImdb:id']),
('created', orm['backend.MovieImdb:created']),
('modified', orm['backend.MovieImdb:modified']),
('imdbId', orm['backend.MovieImdb:imdbId']),
('title', orm['backend.MovieImdb:title']),
('year', orm['backend.MovieImdb:year']),
('runtime', orm['backend.MovieImdb:runtime']),
('release_date', orm['backend.MovieImdb:release_date']),
('tagline', orm['backend.MovieImdb:tagline']),
('plot', orm['backend.MovieImdb:plot']),
('plot_outline', orm['backend.MovieImdb:plot_outline']),
('rating', orm['backend.MovieImdb:rating']),
('votes', orm['backend.MovieImdb:votes']),
('budget', orm['backend.MovieImdb:budget']),
('gross', orm['backend.MovieImdb:gross']),
('profit', orm['backend.MovieImdb:profit']),
('series_imdb', orm['backend.MovieImdb:series_imdb']),
('series_title', orm['backend.MovieImdb:series_title']),
('episode_title', orm['backend.MovieImdb:episode_title']),
('season', orm['backend.MovieImdb:season']),
('episode', orm['backend.MovieImdb:episode']),
))
db.send_create_signal('backend', ['MovieImdb'])
# Adding model 'List' # Adding model 'List'
db.create_table('backend_list', ( db.create_table('backend_list', (
('id', orm['backend.List:id']), ('id', orm['backend.List:id']),
@ -267,6 +352,7 @@ class Migration:
('subject', orm['backend.Connection:subject']), ('subject', orm['backend.Connection:subject']),
('relation', orm['backend.Connection:relation']), ('relation', orm['backend.Connection:relation']),
('object', orm['backend.Connection:object']), ('object', orm['backend.Connection:object']),
('manual', orm['backend.Connection:manual']),
)) ))
db.send_create_signal('backend', ['Connection']) db.send_create_signal('backend', ['Connection'])
@ -274,6 +360,7 @@ class Migration:
db.create_table('backend_location', ( db.create_table('backend_location', (
('id', orm['backend.Location:id']), ('id', orm['backend.Location:id']),
('name', orm['backend.Location:name']), ('name', orm['backend.Location:name']),
('manual', orm['backend.Location:manual']),
('lat_sw', orm['backend.Location:lat_sw']), ('lat_sw', orm['backend.Location:lat_sw']),
('lng_sw', orm['backend.Location:lng_sw']), ('lng_sw', orm['backend.Location:lng_sw']),
('lat_ne', orm['backend.Location:lat_ne']), ('lat_ne', orm['backend.Location:lat_ne']),
@ -286,7 +373,6 @@ class Migration:
# Adding model 'MovieFind' # Adding model 'MovieFind'
db.create_table('backend_moviefind', ( db.create_table('backend_moviefind', (
('id', orm['backend.MovieFind:id']),
('movie', orm['backend.MovieFind:movie']), ('movie', orm['backend.MovieFind:movie']),
('all', orm['backend.MovieFind:all']), ('all', orm['backend.MovieFind:all']),
('title', orm['backend.MovieFind:title']), ('title', orm['backend.MovieFind:title']),
@ -368,12 +454,18 @@ class Migration:
# Deleting model 'ArchiveFile' # Deleting model 'ArchiveFile'
db.delete_table('backend_archivefile') db.delete_table('backend_archivefile')
# Deleting model 'MovieOxdb'
db.delete_table('backend_movieoxdb')
# Deleting model 'Language' # Deleting model 'Language'
db.delete_table('backend_language') db.delete_table('backend_language')
# Deleting model 'ReviewWhitelist' # Deleting model 'ReviewWhitelist'
db.delete_table('backend_reviewwhitelist') db.delete_table('backend_reviewwhitelist')
# Deleting model 'Layer'
db.delete_table('backend_layer')
# Deleting model 'MovieSort' # Deleting model 'MovieSort'
db.delete_table('backend_moviesort') db.delete_table('backend_moviesort')
@ -404,6 +496,9 @@ class Migration:
# Deleting model 'Keyword' # Deleting model 'Keyword'
db.delete_table('backend_keyword') db.delete_table('backend_keyword')
# Deleting model 'MovieImdb'
db.delete_table('backend_movieimdb')
# Deleting model 'List' # Deleting model 'List'
db.delete_table('backend_list') db.delete_table('backend_list')
@ -463,7 +558,8 @@ class Migration:
}, },
'backend.alternativetitle': { 'backend.alternativetitle': {
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'movie': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'alternative_titles'", 'to': "orm['backend.Movie']"}), 'manual': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'movie': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'alternative_titles_all'", 'to': "orm['backend.Movie']"}),
'title': ('django.db.models.fields.TextField', [], {}), 'title': ('django.db.models.fields.TextField', [], {}),
'type': ('django.db.models.fields.CharField', [], {'max_length': '1000'}) 'type': ('django.db.models.fields.CharField', [], {'max_length': '1000'})
}, },
@ -472,29 +568,32 @@ class Migration:
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), 'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
'public': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'users': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.User']"}) 'users': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.User']"})
}, },
'backend.archivefile': { 'backend.archivefile': {
'archive': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.Archive']"}), 'archive': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'files'", 'to': "orm['backend.Archive']"}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'file': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.File']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), 'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'movie_file': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.File']"}),
'path': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'blank': 'True'}) 'path': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'blank': 'True'})
}, },
'backend.cast': { 'backend.cast': {
'character': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}), 'character': ('django.db.models.fields.CharField', [], {'max_length': '1000', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'movie': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.Movie']"}), 'manual': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'movie': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'cast_relation'", 'to': "orm['backend.Movie']"}),
'person': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.Person']"}), 'person': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.Person']"}),
'position': ('django.db.models.fields.IntegerField', [], {}), 'position': ('django.db.models.fields.IntegerField', [], {}),
'role': ('django.db.models.fields.CharField', [], {'max_length': '200'}) 'role': ('django.db.models.fields.CharField', [], {'max_length': '200'})
}, },
'backend.connection': { 'backend.connection': {
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'manual': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'object': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.Movie']"}), 'object': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.Movie']"}),
'relation': ('django.db.models.fields.CharField', [], {'max_length': '512'}), 'relation': ('django.db.models.fields.CharField', [], {'max_length': '512'}),
'subject': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'connections'", 'to': "orm['backend.Movie']"}) 'subject': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'connections_all'", 'to': "orm['backend.Movie']"})
}, },
'backend.country': { 'backend.country': {
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
@ -503,6 +602,7 @@ class Migration:
}, },
'backend.file': { 'backend.file': {
'audio_codec': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}), 'audio_codec': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'available': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'bpp': ('django.db.models.fields.FloatField', [], {'default': '-1'}), 'bpp': ('django.db.models.fields.FloatField', [], {'default': '-1'}),
'channels': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), 'channels': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
'computed_path': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'blank': 'True'}), 'computed_path': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'blank': 'True'}),
@ -512,6 +612,7 @@ class Migration:
'framerate': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}), 'framerate': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'height': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), 'height': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_video': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'md5': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32', 'blank': 'True'}), 'md5': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32', 'blank': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), 'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'movie': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'files'", 'to': "orm['backend.Movie']"}), 'movie': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'files'", 'to': "orm['backend.Movie']"}),
@ -523,16 +624,21 @@ class Migration:
'samplerate': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), 'samplerate': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
'sha1': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '40', 'blank': 'True'}), 'sha1': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '40', 'blank': 'True'}),
'size': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), 'size': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
'stream128': ('django.db.models.fields.files.FileField', [], {'default': 'None', 'max_length': '100'}),
'stream320': ('django.db.models.fields.files.FileField', [], {'default': 'None', 'max_length': '100'}),
'stream640': ('django.db.models.fields.files.FileField', [], {'default': 'None', 'max_length': '100'}),
'video_codec': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}), 'video_codec': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'width': ('django.db.models.fields.IntegerField', [], {'default': '-1'}) 'width': ('django.db.models.fields.IntegerField', [], {'default': '-1'})
}, },
'backend.genre': { 'backend.genre': {
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'manual': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'movies': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['backend.Movie']"}), 'movies': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['backend.Movie']"}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'}) 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'})
}, },
'backend.keyword': { 'backend.keyword': {
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'manual': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'movies': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['backend.Movie']"}), 'movies': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['backend.Movie']"}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'}) 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'})
}, },
@ -541,6 +647,17 @@ class Migration:
'movies': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['backend.Movie']"}), 'movies': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['backend.Movie']"}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'}) 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'})
}, },
'backend.layer': {
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'movie': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.Movie']"}),
'time_in': ('django.db.models.fields.FloatField', [], {'default': '-1'}),
'time_out': ('django.db.models.fields.FloatField', [], {'default': '-1'}),
'type': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
'value': ('django.db.models.fields.TextField', [], {})
},
'backend.list': { 'backend.list': {
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
@ -566,84 +683,136 @@ class Migration:
'lng_center': ('django.db.models.fields.FloatField', [], {'default': '0'}), 'lng_center': ('django.db.models.fields.FloatField', [], {'default': '0'}),
'lng_ne': ('django.db.models.fields.FloatField', [], {'default': '0'}), 'lng_ne': ('django.db.models.fields.FloatField', [], {'default': '0'}),
'lng_sw': ('django.db.models.fields.FloatField', [], {'default': '0'}), 'lng_sw': ('django.db.models.fields.FloatField', [], {'default': '0'}),
'manual': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'movies': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['backend.Movie']"}), 'movies': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['backend.Movie']"}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'}) 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'})
}, },
'backend.movie': { 'backend.movie': {
'accessed': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), 'alternative_titles': ('fields.TupleField', [], {'default': '()'}),
'available': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}),
'budget': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'budget': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'cast': ('fields.TupleField', [], {'default': '()'}),
'cinematographers': ('fields.TupleField', [], {'default': '()'}),
'connections': ('fields.TupleField', [], {'default': '()'}),
'countries': ('fields.TupleField', [], {'default': '()'}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'duration': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), 'directors': ('fields.TupleField', [], {'default': '()'}),
'editors': ('fields.TupleField', [], {'default': '()'}),
'episode': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), 'episode': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
'episode_title': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}), 'episode_title': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
'extracted': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'genres': ('fields.TupleField', [], {'default': '()'}),
'filename': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'files_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'gross': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'gross': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'imdbId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '7', 'blank': 'True'}), 'imdb': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'movie'", 'unique': 'True', 'null': 'True', 'to': "orm['backend.MovieImdb']"}),
'kg_id': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}), 'keywords': ('fields.TupleField', [], {'default': '()'}),
'languages': ('fields.TupleField', [], {'default': '()'}),
'locations': ('fields.TupleField', [], {'default': '()'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), 'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'movieId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'blank': 'True'}), 'movieId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'blank': 'True'}),
'open_subtitle_id': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'oxdb': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'movie'", 'unique': 'True', 'null': 'True', 'to': "orm['backend.MovieOxdb']"}),
'oxdbId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '42', 'blank': 'True'}), 'oxdbId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '42', 'blank': 'True'}),
'plot': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'plot': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'plot_outline': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'plot_outline': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'poster': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'producers': ('fields.TupleField', [], {'default': '()'}),
'poster_height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'poster_width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'posters_available': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'posters_disabled': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'profit': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'profit': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'rating': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'rating': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
'release_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), 'release_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
'reviews': ('fields.TupleField', [], {'default': '()'}),
'rights_level': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), 'rights_level': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
'runtime': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'runtime': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'scene_height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'scene_height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'season': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), 'season': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
'series_imdb': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '7'}), 'series_imdb': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '7'}),
'series_title': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}), 'series_title': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
'still_pos': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'stream128': ('django.db.models.fields.files.FileField', [], {'default': 'None', 'max_length': '100'}),
'stream320': ('django.db.models.fields.files.FileField', [], {'default': 'None', 'max_length': '100'}),
'stream640': ('django.db.models.fields.files.FileField', [], {'default': 'None', 'max_length': '100'}),
'tagline': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'tagline': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '1000'}), 'title': ('django.db.models.fields.CharField', [], {'max_length': '1000'}),
'tpb_id': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}), 'trivia': ('fields.TupleField', [], {'default': '()'}),
'votes': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'votes': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'wikipedia_url': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'writers': ('fields.TupleField', [], {'default': '()'}),
'year': ('django.db.models.fields.CharField', [], {'max_length': '4'}) 'year': ('django.db.models.fields.CharField', [], {'max_length': '4'})
}, },
'backend.moviecountry': { 'backend.moviecountry': {
'country': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.Country']"}), 'country': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.Country']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'manual': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'movie': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.Movie']"}), 'movie': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.Movie']"}),
'position': ('django.db.models.fields.IntegerField', [], {}) 'position': ('django.db.models.fields.IntegerField', [], {})
}, },
'backend.moviefind': { 'backend.moviefind': {
'all': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'all': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'cast': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'cast': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
'cinematographer': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'cinematographer': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
'country': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'country': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
'director': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'director': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
'editor': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'editor': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
'filename': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'filename': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
'genre': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'genre': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'keywords': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'keywords': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'language': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'language': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
'locations': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'locations': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
'movie': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'find'", 'unique': 'True', 'to': "orm['backend.Movie']"}), 'movie': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'find'", 'unique': 'True', 'primary_key': 'True', 'to': "orm['backend.Movie']"}),
'producer': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'producer': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
'summary': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'summary': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '1000'}), 'title': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'trivia': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'trivia': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'writer': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'writer': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
'year': ('django.db.models.fields.CharField', [], {'max_length': '4'})
},
'backend.movieimdb': {
'budget': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'episode': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
'episode_title': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1000', 'blank': 'True'}),
'gross': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'imdbId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '7'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'plot': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'plot_outline': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'profit': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'rating': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
'release_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
'runtime': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'season': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
'series_imdb': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '7'}),
'series_title': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1000', 'blank': 'True'}),
'tagline': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '1000'}),
'votes': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'year': ('django.db.models.fields.CharField', [], {'max_length': '4'}) 'year': ('django.db.models.fields.CharField', [], {'max_length': '4'})
}, },
'backend.movielanguage': { 'backend.movielanguage': {
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'language': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.Language']"}), 'language': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.Language']"}),
'manual': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'movie': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.Movie']"}), 'movie': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.Movie']"}),
'position': ('django.db.models.fields.IntegerField', [], {}) 'position': ('django.db.models.fields.IntegerField', [], {})
}, },
'backend.movieoxdb': {
'budget': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'episode': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
'episode_title': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
'gross': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'plot': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'plot_outline': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'profit': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'rating': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
'release_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
'runtime': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'season': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
'series_imdb': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '7'}),
'series_title': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
'tagline': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '1000'}),
'votes': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'year': ('django.db.models.fields.CharField', [], {'max_length': '4'})
},
'backend.moviesort': { 'backend.moviesort': {
'aspectratio': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}), 'aspectratio': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}),
'bitrate': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}), 'bitrate': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}),
@ -657,13 +826,13 @@ class Migration:
'filename': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}), 'filename': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}),
'files': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}), 'files': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}),
'genre': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'genre': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'keywords': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}), 'keywords': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}),
'language': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'language': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'movie': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'sort'", 'unique': 'True', 'to': "orm['backend.Movie']"}), 'movie': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'sort'", 'unique': 'True', 'primary_key': 'True', 'to': "orm['backend.Movie']"}),
'movieId': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}), 'movieId': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
'pixels': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}), 'pixels': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}),
'producer': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'producer': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'rating': ('django.db.models.fields.FloatField', [], {'blank': 'True'}),
'resolution': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}), 'resolution': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}),
'risk': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'risk': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'runtime': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'runtime': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
@ -672,6 +841,7 @@ class Migration:
'summary': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}), 'summary': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '1000'}), 'title': ('django.db.models.fields.CharField', [], {'max_length': '1000'}),
'trivia': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}), 'trivia': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}),
'votes': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}),
'words': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'words': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'wpm': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'wpm': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'writer': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'writer': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
@ -686,7 +856,8 @@ class Migration:
}, },
'backend.review': { 'backend.review': {
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'movie': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'reviews'", 'to': "orm['backend.Movie']"}), 'manual': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'movie': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'reviews_all'", 'to': "orm['backend.Movie']"}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'blank': 'True'}), 'title': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'blank': 'True'}),
'url': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'blank': 'True'}) 'url': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'blank': 'True'})
}, },
@ -697,16 +868,17 @@ class Migration:
}, },
'backend.subtitle': { 'backend.subtitle': {
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'file': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'subtitles'", 'to': "orm['backend.File']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'language': ('django.db.models.fields.CharField', [], {'max_length': '16'}), 'language': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), 'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'movie_file': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.File']"}),
'srt': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'srt': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
}, },
'backend.trivia': { 'backend.trivia': {
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'movie': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'trivia'", 'to': "orm['backend.Movie']"}), 'manual': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'movie': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'trivia_all'", 'to': "orm['backend.Movie']"}),
'position': ('django.db.models.fields.IntegerField', [], {}), 'position': ('django.db.models.fields.IntegerField', [], {}),
'trivia': ('django.db.models.fields.TextField', [], {}) 'trivia': ('django.db.models.fields.TextField', [], {})
}, },

View file

@ -1,349 +0,0 @@
# -*- coding: utf-8 -*-
from south.db import db
from django.db import models
from oxdb.backend.models import *
class Migration:
def forwards(self, orm):
# Adding field 'Movie.available'
db.add_column('backend_movie', 'available', orm['backend.movie:available'])
# Deleting field 'Movie.filename'
db.delete_column('backend_movie', 'filename')
# Deleting field 'Movie.extracted'
db.delete_column('backend_movie', 'extracted')
# Deleting field 'Movie.files_modified'
db.delete_column('backend_movie', 'files_modified')
# Deleting model 'file'
db.delete_table('backend_file')
# Deleting model 'archivefile'
db.delete_table('backend_archivefile')
# Deleting model 'subtitle'
db.delete_table('backend_subtitle')
# Deleting model 'archive'
db.delete_table('backend_archive')
def backwards(self, orm):
# Deleting field 'Movie.available'
db.delete_column('backend_movie', 'available')
# Adding field 'Movie.filename'
db.add_column('backend_movie', 'filename', orm['backend.movie:filename'])
# Adding field 'Movie.extracted'
db.add_column('backend_movie', 'extracted', orm['backend.movie:extracted'])
# Adding field 'Movie.files_modified'
db.add_column('backend_movie', 'files_modified', orm['backend.movie:files_modified'])
# Adding model 'file'
db.create_table('backend_file', (
('computed_path', orm['backend.movie:computed_path']),
('pixel_format', orm['backend.movie:pixel_format']),
('height', orm['backend.movie:height']),
('channels', orm['backend.movie:channels']),
('audio_codec', orm['backend.movie:audio_codec']),
('duration', orm['backend.movie:duration']),
('samplerate', orm['backend.movie:samplerate']),
('id', orm['backend.movie:id']),
('size', orm['backend.movie:size']),
('width', orm['backend.movie:width']),
('movie', orm['backend.movie:movie']),
('pixel_aspect_ratio', orm['backend.movie:pixel_aspect_ratio']),
('oshash', orm['backend.movie:oshash']),
('part', orm['backend.movie:part']),
('display_aspect_ratio', orm['backend.movie:display_aspect_ratio']),
('pixels', orm['backend.movie:pixels']),
('md5', orm['backend.movie:md5']),
('sha1', orm['backend.movie:sha1']),
('created', orm['backend.movie:created']),
('framerate', orm['backend.movie:framerate']),
('modified', orm['backend.movie:modified']),
('bpp', orm['backend.movie:bpp']),
('video_codec', orm['backend.movie:video_codec']),
))
db.send_create_signal('backend', ['file'])
# Adding model 'archivefile'
db.create_table('backend_archivefile', (
('created', orm['backend.movie:created']),
('modified', orm['backend.movie:modified']),
('archive', orm['backend.movie:archive']),
('movie_file', orm['backend.movie:movie_file']),
('path', orm['backend.movie:path']),
('id', orm['backend.movie:id']),
))
db.send_create_signal('backend', ['archivefile'])
# Adding model 'subtitle'
db.create_table('backend_subtitle', (
('language', orm['backend.movie:language']),
('created', orm['backend.movie:created']),
('modified', orm['backend.movie:modified']),
('user', orm['backend.movie:user']),
('srt', orm['backend.movie:srt']),
('movie_file', orm['backend.movie:movie_file']),
('id', orm['backend.movie:id']),
))
db.send_create_signal('backend', ['subtitle'])
# Adding model 'archive'
db.create_table('backend_archive', (
('name', orm['backend.movie:name']),
('created', orm['backend.movie:created']),
('modified', orm['backend.movie:modified']),
('id', orm['backend.movie:id']),
('users', orm['backend.movie:users']),
))
db.send_create_signal('backend', ['archive'])
models = {
'auth.group': {
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'})
},
'auth.permission': {
'Meta': {'unique_together': "(('content_type', 'codename'),)"},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'backend.alternativetitle': {
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'movie': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'alternative_titles'", 'to': "orm['backend.Movie']"}),
'title': ('django.db.models.fields.TextField', [], {}),
'type': ('django.db.models.fields.CharField', [], {'max_length': '1000'})
},
'backend.cast': {
'character': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'movie': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.Movie']"}),
'person': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.Person']"}),
'position': ('django.db.models.fields.IntegerField', [], {}),
'role': ('django.db.models.fields.CharField', [], {'max_length': '200'})
},
'backend.connection': {
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.Movie']"}),
'relation': ('django.db.models.fields.CharField', [], {'max_length': '512'}),
'subject': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'connections'", 'to': "orm['backend.Movie']"})
},
'backend.country': {
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'movies': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['backend.Movie']"}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'})
},
'backend.genre': {
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'movies': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['backend.Movie']"}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'})
},
'backend.keyword': {
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'movies': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['backend.Movie']"}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'})
},
'backend.language': {
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'movies': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['backend.Movie']"}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'})
},
'backend.list': {
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'movies': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['backend.Movie']"}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
'public': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'backend.listitem': {
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'list': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.List']"}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'movie': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.Movie']"})
},
'backend.location': {
'area': ('django.db.models.fields.FloatField', [], {'default': '-1'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'lat_center': ('django.db.models.fields.FloatField', [], {'default': '0'}),
'lat_ne': ('django.db.models.fields.FloatField', [], {'default': '0'}),
'lat_sw': ('django.db.models.fields.FloatField', [], {'default': '0'}),
'lng_center': ('django.db.models.fields.FloatField', [], {'default': '0'}),
'lng_ne': ('django.db.models.fields.FloatField', [], {'default': '0'}),
'lng_sw': ('django.db.models.fields.FloatField', [], {'default': '0'}),
'movies': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['backend.Movie']"}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'})
},
'backend.movie': {
'accessed': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'available': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'budget': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'duration': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
'episode': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
'episode_title': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
'gross': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'imdbId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '7', 'blank': 'True'}),
'kg_id': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'movieId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'blank': 'True'}),
'open_subtitle_id': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'oxdbId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '42', 'blank': 'True'}),
'plot': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'plot_outline': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'poster': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'poster_height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'poster_width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'posters_available': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'posters_disabled': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'profit': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'rating': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'release_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
'rights_level': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
'runtime': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'scene_height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'season': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
'series_imdb': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '7'}),
'series_title': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
'still_pos': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'tagline': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '1000'}),
'tpb_id': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
'votes': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'wikipedia_url': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'year': ('django.db.models.fields.CharField', [], {'max_length': '4'})
},
'backend.moviecountry': {
'country': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.Country']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'movie': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.Movie']"}),
'position': ('django.db.models.fields.IntegerField', [], {})
},
'backend.moviefind': {
'all': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'cast': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'cinematographer': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'country': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'director': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'editor': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'filename': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'genre': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'keywords': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'language': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'locations': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'movie': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'find'", 'unique': 'True', 'to': "orm['backend.Movie']"}),
'producer': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'summary': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '1000'}),
'trivia': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'writer': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'year': ('django.db.models.fields.CharField', [], {'max_length': '4'})
},
'backend.movielanguage': {
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'language': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.Language']"}),
'movie': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['backend.Movie']"}),
'position': ('django.db.models.fields.IntegerField', [], {})
},
'backend.moviesort': {
'aspectratio': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}),
'bitrate': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}),
'cast': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}),
'cinematographer': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'connections': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}),
'country': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'director': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'duration': ('django.db.models.fields.FloatField', [], {'default': '-1'}),
'editor': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'filename': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}),
'files': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}),
'genre': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'keywords': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}),
'language': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'movie': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'sort'", 'unique': 'True', 'to': "orm['backend.Movie']"}),
'movieId': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
'pixels': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}),
'producer': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'resolution': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}),
'risk': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'runtime': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'scenes': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}),
'size': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}),
'summary': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '1000'}),
'trivia': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}),
'words': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'wpm': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'writer': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'year': ('django.db.models.fields.CharField', [], {'max_length': '4'})
},
'backend.person': {
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'imdbId': ('django.db.models.fields.CharField', [], {'max_length': '7', 'blank': 'True'}),
'movies': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['backend.Movie']"}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'name_sort': ('django.db.models.fields.CharField', [], {'max_length': '200'})
},
'backend.review': {
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'movie': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'reviews'", 'to': "orm['backend.Movie']"}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'blank': 'True'}),
'url': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'blank': 'True'})
},
'backend.reviewwhitelist': {
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
'url': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'})
},
'backend.trivia': {
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'movie': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'trivia'", 'to': "orm['backend.Movie']"}),
'position': ('django.db.models.fields.IntegerField', [], {}),
'trivia': ('django.db.models.fields.TextField', [], {})
},
'contenttypes.contenttype': {
'Meta': {'unique_together': "(('app_label', 'model'),)", 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
}
}
complete_apps = ['backend']

View file

@ -7,13 +7,15 @@ import random
from django.db import models from django.db import models
from django.db.models import Q from django.db.models import Q
from django.contrib.auth.models import User from django.contrib.auth.models import User
import ox from django.core.files.base import ContentFile
from ox import stripTags import oxlib
from ox.normalize import canonicalTitle, canonicalName from oxlib import stripTags
from oxlib.normalize import canonicalTitle, canonicalName
from django.utils import simplejson as json
import utils import utils
import managers import managers
import fields
class MovieImdb(models.Model): class MovieImdb(models.Model):
created = models.DateTimeField(auto_now_add=True) created = models.DateTimeField(auto_now_add=True)
@ -36,11 +38,14 @@ class MovieImdb(models.Model):
profit = models.IntegerField(null=True, blank=True) profit = models.IntegerField(null=True, blank=True)
series_imdb = models.CharField(max_length=7, default='') series_imdb = models.CharField(max_length=7, default='')
series_title = models.TextField(blank=True, default='') series_title = models.CharField(max_length=1000, blank=True, default='')
episode_title = models.TextField(blank=True, default='') episode_title = models.CharField(max_length=1000, blank=True, default='')
season = models.IntegerField(default=-1) season = models.IntegerField(default=-1)
episode = models.IntegerField(default=-1) episode = models.IntegerField(default=-1)
def __unicode__(self):
return u"%s (%s)" % (self.title, self.imdbId)
class MovieOxdb(models.Model): class MovieOxdb(models.Model):
created = models.DateTimeField(auto_now_add=True) created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True) modified = models.DateTimeField(auto_now=True)
@ -66,6 +71,9 @@ class MovieOxdb(models.Model):
season = models.IntegerField(default=-1) season = models.IntegerField(default=-1)
episode = models.IntegerField(default=-1) episode = models.IntegerField(default=-1)
def __unicode__(self):
return u"%s (%s)" % (self.title, self.year)
def newMovie(title, director, year): def newMovie(title, director, year):
movie = Movie() movie = Movie()
oxdb = MovieOxdb() oxdb = MovieOxdb()
@ -80,13 +88,18 @@ def newMovie(title, director, year):
movie.save() movie.save()
return movie return movie
def movie_path(f, size):
name = "%s.%s" % (size, 'ogv')
url_hash = f.movieId
return os.path.join('movie', url_hash[:2], url_hash[2:4], url_hash[4:6], name)
class Movie(models.Model): class Movie(models.Model):
created = models.DateTimeField(auto_now_add=True) created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True) modified = models.DateTimeField(auto_now=True)
#only movies that have metadata from files are available, #only movies that have metadata from files are available,
#this is indicated by setting available to True #this is indicated by setting available to True
available = models.BooleanField(default=False) available = models.BooleanField(default=False, db_index=True)
movieId = models.CharField(max_length=128, unique=True, blank=True) movieId = models.CharField(max_length=128, unique=True, blank=True)
oxdbId = models.CharField(max_length=42, unique=True, blank=True) oxdbId = models.CharField(max_length=42, unique=True, blank=True)
@ -139,9 +152,9 @@ class Movie(models.Model):
def keywords(self): def keywords(self):
return self._manual(self.keywords_all) return self._manual(self.keywords_all)
def countries(self): def countries(self):
return self._manual(self.countries_all, 'moviecountry__manual') return self._manual(self.countries_all, 'moviecountry__manual').order_by('moviecountry__position')
def languages(self): def languages(self):
return self._manual(self.languages_all, 'movielanguage__manual') return self._manual(self.languages_all, 'movielanguage__manual').order_by('movielanguage__position')
def trivia(self): def trivia(self):
return self._manual(self.trivia_all) return self._manual(self.trivia_all)
def locations(self): def locations(self):
@ -169,12 +182,59 @@ class Movie(models.Model):
rights_level = models.IntegerField(default=-1) rights_level = models.IntegerField(default=-1)
'''
#these values get populated with imdb/oxdb values on save()
#edits will be overwritten
title = models.CharField(max_length=1000)
year = models.CharField(max_length=4)
runtime = models.IntegerField(null=True, blank=True)
release_date = models.DateField(null=True, blank=True)
tagline = models.TextField(blank=True)
plot = models.TextField(blank=True)
plot_outline = models.TextField(blank=True)
rating = models.FloatField(null=True, blank=True)
votes = models.IntegerField(null=True, blank=True)
budget = models.IntegerField(null=True, blank=True)
gross = models.IntegerField(null=True, blank=True)
profit = models.IntegerField(null=True, blank=True)
series_imdb = models.CharField(max_length=7, default='')
series_title = models.TextField(blank=True, default='')
episode_title = models.TextField(blank=True, default='')
season = models.IntegerField(default=-1)
episode = models.IntegerField(default=-1)
'''
json = fields.DictField(default={}, editable=False)
'''
directors = fields.TupleField(default=())
writers = fields.TupleField(default=())
editors = fields.TupleField(default=())
producers = fields.TupleField(default=())
cinematographers = fields.TupleField(default=())
cast = fields.TupleField(default=())
alternative_titles = fields.TupleField(default=())
genres = fields.TupleField(default=())
keywords = fields.TupleField(default=())
countries = fields.TupleField(default=())
languages = fields.TupleField(default=())
trivia = fields.TupleField(default=())
locations = fields.TupleField(default=())
connections = fields.DictField(default={})
reviews = fields.TupleField(default=())
'''
#FIXME: use data.0xdb.org #FIXME: use data.0xdb.org
'''
tpb_id = models.CharField(max_length=128, blank=True) tpb_id = models.CharField(max_length=128, blank=True)
kg_id = models.CharField(max_length=128, blank=True) kg_id = models.CharField(max_length=128, blank=True)
open_subtitle_id = models.IntegerField(null=True, blank=True) open_subtitle_id = models.IntegerField(null=True, blank=True)
wikipedia_url = models.TextField(blank=True) wikipedia_url = models.TextField(blank=True)
#FIXME: use data.0xdb.org/posters for that
#what of this is still required? #what of this is still required?
still_pos = models.IntegerField(null=True, blank=True) still_pos = models.IntegerField(null=True, blank=True)
poster = models.TextField(blank=True) poster = models.TextField(blank=True)
@ -182,13 +242,20 @@ class Movie(models.Model):
posters_available = models.TextField(blank=True) posters_available = models.TextField(blank=True)
poster_height = models.IntegerField(null=True, blank=True) poster_height = models.IntegerField(null=True, blank=True)
poster_width = models.IntegerField(null=True, blank=True) poster_width = models.IntegerField(null=True, blank=True)
'''
#stream related fields
'''
'''
stream128 = models.FileField(default=None, blank=True, upload_to=lambda f, x: movie_path(f, '128'))
stream320 = models.FileField(default=None, blank=True, upload_to=lambda f, x: movie_path(f, '320'))
stream640 = models.FileField(default=None, blank=True, upload_to=lambda f, x: movie_path(f, '640'))
#FIXME: is this still required? should this not be aspect ratio? depends on stream???
scene_height = models.IntegerField(null=True, blank=True) scene_height = models.IntegerField(null=True, blank=True)
def __unicode__(self): def __unicode__(self):
return u'%s (%s)' % (self.get('title'), self.get('year')) return u'%s (%s)' % (self.get('title'), self.get('year'))
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
if not self.oxdb: if not self.oxdb:
oxdb = MovieOxdb() oxdb = MovieOxdb()
@ -200,6 +267,26 @@ class Movie(models.Model):
mid = self.oxdbId mid = self.oxdbId
self.movieId = mid self.movieId = mid
if self.id:
self.json = self.get_json()
'''
#populate auto values for faster results
#FIXME: why is it not possible to use setattr to set List instead of db value?
common_fields = [f.name for f in MovieImdb._meta.fields]
only_relevant = lambda f: f not in ('id', 'created', 'modified', 'imdbId')
common_fields = filter(only_relevant, common_fields)
for f in common_fields:
setattr(self, f, self.get(f))
for f in ('directors', 'writers', 'editors', 'producers', 'cinematographers',
'reviews', 'countries', 'languages',
'keywords', 'genres', 'trivia', 'alternative_titles'):
value = getattr(self, 'get_' + f)
setattr(self, f, tuple([v.json() for v in value()]))
for f in ('cast', ):
value = getattr(self, 'get_' + f)
setattr(self, f, value())
self.connections = self.connections_json()
'''
super(Movie, self).save(*args, **kwargs) super(Movie, self).save(*args, **kwargs)
self.updateFind() self.updateFind()
self.updateSort() self.updateSort()
@ -229,7 +316,7 @@ class Movie(models.Model):
'alternative_titles': 'alternative_titles', 'alternative_titles': 'alternative_titles',
'connections_json': 'connections' 'connections_json': 'connections'
} }
def json(self, fields=None): def get_json(self, fields=None):
movie = {} movie = {}
for key in self._public_fields: for key in self._public_fields:
pub_key = self._public_fields.get(key, key) pub_key = self._public_fields.get(key, key)
@ -238,8 +325,9 @@ class Movie(models.Model):
value = getattr(self, key) value = getattr(self, key)
else: else:
value = self.get(key) value = self.get(key)
if key in ('directors', 'writers', 'reviews', if key in ('directors', 'writers', 'editors', 'cinematographers', 'producers',
'countries', 'languages', 'keywords', 'genres', 'trivia', 'alternative_titles'): 'reviews', 'countries', 'languages',
'keywords', 'genres', 'trivia', 'alternative_titles'):
movie[pub_key] = tuple([v.json() for v in value()]) movie[pub_key] = tuple([v.json() for v in value()])
elif callable(value): elif callable(value):
movie[pub_key] = value() movie[pub_key] = value()
@ -392,7 +480,7 @@ class MovieFind(models.Model):
movie = models.OneToOneField('Movie', related_name='find', primary_key=True) movie = models.OneToOneField('Movie', related_name='find', primary_key=True)
all = models.TextField(blank=True) all = models.TextField(blank=True)
title = models.CharField(max_length=1000) title = models.TextField(blank=True)
director = models.TextField(blank=True, default='') director = models.TextField(blank=True, default='')
country = models.TextField(blank=True, default='') country = models.TextField(blank=True, default='')
year = models.CharField(max_length=4) year = models.CharField(max_length=4)
@ -414,18 +502,17 @@ class MovieFind(models.Model):
filename = models.TextField(blank=True, default='') filename = models.TextField(blank=True, default='')
_private_fields = ('id', 'movie') _private_fields = ('id', 'movie')
_public_names = { #return available find fields
'movieId': 'id' #FIXME: should return mapping name -> verbose_name
} def fields(self):
def options(self): fields = []
options = []
for f in self._meta.fields: for f in self._meta.fields:
if f.name not in self._private_fields: if f.name not in self._private_fields:
name = f.name name = f.verbose_name
name = self._public_names.get(name, name) name = name[0].capitalize() + name[1:]
options.append((name, 'Find: %s' % name.capitalize())) fields.append(name)
return tuple(options) return tuple(fields)
options = classmethod(options) fields = classmethod(fields)
class MovieSort(models.Model): class MovieSort(models.Model):
""" """
@ -457,14 +544,14 @@ class MovieSort(models.Model):
votes = models.IntegerField(blank=True) votes = models.IntegerField(blank=True)
scenes = models.IntegerField(blank=True) scenes = models.IntegerField(blank=True)
words = models.IntegerField(null=True, blank=True) words = models.IntegerField(null=True, blank=True)
wpm = models.IntegerField(null=True, blank=True) wpm = models.IntegerField('Words per Minute', null=True, blank=True)
risk = models.IntegerField(null=True, blank=True) risk = models.IntegerField(null=True, blank=True)
movieId = models.CharField(max_length=128, blank=True) movieId = models.CharField('ID', max_length=128, blank=True)
duration = models.FloatField(default=-1) duration = models.FloatField(default=-1)
resolution = models.IntegerField(blank=True) resolution = models.IntegerField(blank=True)
aspectratio = models.IntegerField(blank=True) aspectratio = models.IntegerField('Aspect Ratio', blank=True)
bitrate = models.IntegerField(blank=True) bitrate = models.IntegerField(blank=True)
pixels = models.IntegerField(blank=True) pixels = models.IntegerField(blank=True)
filename = models.IntegerField(blank=True) filename = models.IntegerField(blank=True)
@ -472,18 +559,17 @@ class MovieSort(models.Model):
size = models.IntegerField(blank=True) size = models.IntegerField(blank=True)
_private_fields = ('id', 'movie') _private_fields = ('id', 'movie')
_public_names = { #return available sort fields
'movieId': 'id' #FIXME: should return mapping name -> verbose_name
} def fields(self):
def options(self): fields = []
options = []
for f in self._meta.fields: for f in self._meta.fields:
if f.name not in self._private_fields: if f.name not in self._private_fields:
name = f.name name = f.verbose_name
name = self._public_names.get(name, name) name = name[0].capitalize() + name[1:]
options.append((name, 'Sort: %s' % name.capitalize())) fields.append(name)
return tuple(options) return tuple(fields)
options = classmethod(options) fields = classmethod(fields)
class AlternativeTitle(models.Model): class AlternativeTitle(models.Model):
movie = models.ForeignKey(Movie, related_name='alternative_titles_all') movie = models.ForeignKey(Movie, related_name='alternative_titles_all')
@ -522,7 +608,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 = ox.normalize.canonicalName(self.name) self.name_sort = oxlib.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):
@ -544,10 +630,10 @@ class Person(models.Model):
return self.name return self.name
class Cast(models.Model): class Cast(models.Model):
movie = models.ForeignKey(Movie) movie = models.ForeignKey(Movie, related_name='cast_relation')
person = models.ForeignKey(Person) person = models.ForeignKey(Person)
role = models.CharField(max_length=200) role = models.CharField(max_length=200)
character = models.CharField(max_length=200, blank=True) character = models.CharField(max_length=1000, blank=True)
position = models.IntegerField() position = models.IntegerField()
manual = models.BooleanField(default=False) manual = models.BooleanField(default=False)
@ -736,7 +822,8 @@ class Trivia(models.Model):
def json(self): def json(self):
trivia = self.trivia trivia = self.trivia
trivia = ox.fixAmpersands(trivia) trivia = oxlib.fixAmpersands(trivia)
trivia = re.sub('<a name="#tr\d{7}"></a> ', '', trivia)
trivia = re.sub('<a href="(/name/nm.*?)">(.*?)</a>', '<a href="/?f=name&amp;q=\\2">\\2</a>', trivia) trivia = re.sub('<a href="(/name/nm.*?)">(.*?)</a>', '<a href="/?f=name&amp;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)
return trivia return trivia
@ -764,6 +851,7 @@ class Connection(models.Model):
'Spin off from': 'Spin off', 'Spin off from': 'Spin off',
'Spoofs': 'Spoofed in', 'Spoofs': 'Spoofed in',
'Version of': 'Version of', 'Version of': 'Version of',
'Alternate language version of': 'Alternate language version of',
} }
if relation in _map.values(): if relation in _map.values():
for k in _map: for k in _map:
@ -846,22 +934,37 @@ def stream_path(f, size):
url_hash = f.oshash url_hash = f.oshash
return os.path.join('stream', url_hash[:2], url_hash[2:4], url_hash[4:6], name) return os.path.join('stream', url_hash[:2], url_hash[2:4], url_hash[4:6], name)
def still_path(f, still):
name = "%s.%s" % (still, 'png')
url_hash = f.oshash
return os.path.join('still', url_hash[:2], url_hash[2:4], url_hash[4:6], name)
FILE_TYPES = (
(0, 'unknown'),
(1, 'video'),
(2, 'audio'),
(3, 'subtitle'),
)
class File(models.Model): class File(models.Model):
created = models.DateTimeField(auto_now_add=True) created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True) modified = models.DateTimeField(auto_now=True)
verified = models.BooleanField(default=False)
oshash = models.CharField(blank=True, unique=True, max_length=16) oshash = models.CharField(blank=True, unique=True, max_length=16)
sha1 = models.CharField(blank=True, unique=True, max_length=40) sha1 = models.CharField(blank=True, null=True, unique=True, max_length=40)
md5 = models.CharField(blank=True, unique=True, max_length=32) md5 = models.CharField(blank=True, null=True, unique=True, max_length=32)
movie = models.ForeignKey(Movie, related_name="files", default=None) movie = models.ForeignKey(Movie, related_name="files", default=None, null=True)
computed_path = models.CharField(blank=True, max_length=2048) type = models.IntegerField(default=0, choices=FILE_TYPES)
size = models.IntegerField(default=-1) info = fields.DictField(default={})
#FIMXE: why do i need those in the db? could jsut have them in info
path = models.CharField(blank=True, max_length=2048)
size = models.BigIntegerField(default=-1)
duration = models.FloatField(default=-1) duration = models.FloatField(default=-1)
is_video = models.BooleanField(default=False)
video_codec = models.CharField(blank=True, max_length=256) video_codec = models.CharField(blank=True, max_length=256)
pixel_format = models.CharField(blank=True, max_length=256) pixel_format = models.CharField(blank=True, max_length=256)
width = models.IntegerField(default=-1) width = models.IntegerField(default=-1)
@ -876,16 +979,20 @@ class File(models.Model):
#computed values #computed values
bpp = models.FloatField(default=-1) bpp = models.FloatField(default=-1)
pixels = models.IntegerField(default=0) pixels = models.BigIntegerField(default=0)
part = models.IntegerField(default=0) part = models.IntegerField(default=0)
needs_data = models.BooleanField(default=True)
#stream related fields #stream related fields
available = models.BooleanField(default=False) available = models.BooleanField(default=False)
stream128 = models.FileField(default=None, upload_to=lambda f, x: stream_path(f, '128')) stream128 = models.FileField(default=None, upload_to=lambda f, x: stream_path(f, '128'))
stream320 = models.FileField(default=None, upload_to=lambda f, x: stream_path(f, '320')) stream320 = models.FileField(default=None, upload_to=lambda f, x: stream_path(f, '320'))
stream640 = models.FileField(default=None, upload_to=lambda f, x: stream_path(f, '640')) stream640 = models.FileField(default=None, upload_to=lambda f, x: stream_path(f, '640'))
timeline = models.ImageField(default=None, null=True, upload_to=lambda f, x: still_path(f, '0'))
def save_chunk(self, chunk, name='video.ogv'): def save_chunk(self, chunk, name='video.ogv'):
if not self.available: if not self.available:
#FIXME: this should use stream128 or stream640 depending on configuration #FIXME: this should use stream128 or stream640 depending on configuration
@ -912,7 +1019,56 @@ class File(models.Model):
get_or_create = classmethod(get_or_create) get_or_create = classmethod(get_or_create)
def __unicode__(self): def __unicode__(self):
return "%s (%s)" % (self.computed_path, self.oshash) return "%s (%s)" % (self.path, self.oshash)
def update(self, data=None):
"""
only add, do not overwrite keys in file
"""
if data and not self.info:
self.info = data
_video_map = {
'codec': 'video_codec',
}
if 'video' in self.info and self.info['video']:
for key in ('codec', 'pixel_format', 'width', 'height',
'pixel_aspect_ratio', 'display_aspect_ratio', 'framerate'):
if key in self.info['video'][0]:
setattr(self, _video_map.get(key, key), self.info['video'][0][key])
_audio_map = {
'codec': 'audio_codec',
}
if 'audio' in self.info and self.info['audio']:
for key in ('codec', 'samplerate', 'channels'):
if key in self.info['audio'][0]:
setattr(self, _audio_map.get(key, key), self.info['audio'][0][key])
for key in ('duration', 'size', 'sha1', 'md5'):
if key in self.info:
setattr(self, key, self.info[key])
#detect and assign type based on extension or detected video track
if os.path.splitext(self.info['path'])[-1] in ('.rar', '.sub', '.idx'):
self.type = 0
elif 'video' in self.info:
self.type = 1
elif os.path.splitext(self.info['path'])[-1] in ('.mp3', '.oga'):
self.type = 2
elif os.path.splitext(self.info['path'])[-1] in ('.srt', ):
self.type = 3
#FIXME: this should be computed and not submitted path
self.path = self.info['path']
self.save()
class Still(models.Model):
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True)
file = models.ForeignKey(File, related_name="stills")
position = models.FloatField()
still = models.ImageField(default=None, null=True, upload_to=lambda f, x: still_path(f, '0'))
def __unicode__(self):
return '%s at %s' % (self.file, self.position)
class Subtitle(models.Model): class Subtitle(models.Model):
created = models.DateTimeField(auto_now_add=True) created = models.DateTimeField(auto_now_add=True)
@ -935,7 +1091,7 @@ class Subtitle(models.Model):
get_or_create = classmethod(get_or_create) get_or_create = classmethod(get_or_create)
def __unicode__(self): def __unicode__(self):
return '%s.%s.srt' % (os.path.splitext(self.movie_file.computed_path)[0], self.language) return '%s.%s.srt' % (os.path.splitext(self.movie_file.path)[0], self.language)
class Layer(models.Model): class Layer(models.Model):
created = models.DateTimeField(auto_now_add=True) created = models.DateTimeField(auto_now_add=True)
@ -959,6 +1115,9 @@ class Archive(models.Model):
public = models.BooleanField(default=False) public = models.BooleanField(default=False)
users = models.ManyToManyField(User, related_name='archives') users = models.ManyToManyField(User, related_name='archives')
def __unicode__(self):
return '%s' % (self.name)
class ArchiveFile(models.Model): class ArchiveFile(models.Model):
created = models.DateTimeField(auto_now_add=True) created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True) modified = models.DateTimeField(auto_now=True)
@ -972,27 +1131,22 @@ class ArchiveFile(models.Model):
""" """
only add, do not overwrite keys in file only add, do not overwrite keys in file
""" """
for key in ('duration', 'video_codec', 'pixel_format', 'width', 'height', self.file.update(data)
'pixel_aspect_ratio', 'display_aspect_ratio', 'framerate',
'audio_codec', 'samplerate', 'channels', 'size', 'sha1', 'md5'):
if key in data and not getattr(self.file, key):
setattr(self.file, key, data[key])
self.path = data.get('path', '') self.path = data.get('path', '')
self.file.save()
self.save() self.save()
def get_or_create(model, archive, oshash): def get_or_create(model, archive, oshash):
try: try:
f = model.objects.by_oshash(oshash=oshash) f = model.objects.by_oshash(oshash=oshash)
except model.DoesNotExist: except model.DoesNotExist:
f = model.objects.create() file = File.get_or_create(oshash)
f.file = File.get_or_create(oshash) file.save()
f.archive = archive f = model.objects.create(archive=archive, file=file)
f.save() f.save()
return f return f
get_or_create = classmethod(get_or_create) get_or_create = classmethod(get_or_create)
def __unicode__(self): def __unicode__(self):
return '%s (%s)' % (self.path, unicode(self.user)) return '%s (%s)' % (self.path, unicode(self.archive))

View file

@ -20,12 +20,11 @@ subtitles/add?oshash&language
subtitles/remove?oshash&language subtitles/remove?oshash&language
''' '''
urlpatterns = patterns("oxdb.backend.views", urlpatterns = patterns("backend.views",
(r'^find', 'find'), (r'^find', 'find'),
(r'^files/find', 'find_files'), (r'^files/find', 'find_files'),
(r'^files/info', 'file_info'), (r'^files/info', 'file_info'),
(r'^archive/(?P<archive>.+)/add', 'add_file'), (r'^archive/(?P<archive>.+)/update', 'update_archive'),
(r'^archive/(?P<archive>.+)/remove', 'remove_file'),
(r'^file/parse', 'file_parse'), (r'^file/parse', 'file_parse'),
(r'^subtitle/get', 'subtitles'), (r'^subtitle/get', 'subtitles'),

View file

@ -8,9 +8,9 @@ import sys
import re import re
import hashlib import hashlib
import ox import oxlib
import ox.iso import oxlib.iso
from ox.normalize import normalizeName from oxlib.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 ox.findRe(data, '\.(\d{4})\.') return oxlib.findRe(data, '\.(\d{4})\.')
def oxdb_series_title(path): def oxdb_series_title(path):
seriesTitle = u'' seriesTitle = u''

View file

@ -4,16 +4,22 @@ import os.path
import re import re
from datetime import datetime from datetime import datetime
from urllib2 import unquote from urllib2 import unquote
import json
from django.db.models import Q, Avg, Count from django.db.models import Q, Avg, Count
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.shortcuts import render_to_response, get_object_or_404, get_list_or_404 from django.shortcuts import render_to_response, get_object_or_404, get_list_or_404
from django.template import RequestContext from django.template import RequestContext
from django.core.paginator import Paginator from django.core.paginator import Paginator
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.utils import simplejson as json try:
from ox.django.shortcuts import render_to_json_response import simplejson as json
from ox.django.decorators import login_required_json except ImportError:
from django.utils import simplejson as json
from oxdjango.shortcuts import render_to_json_response
from oxdjango.decorators import login_required_json
import models import models
import utils import utils
@ -168,13 +174,18 @@ def find(request):
if 'n' in query: if 'n' in query:
response = {'items': qs.count()} response = {'items': qs.count()}
else: else:
_p = query['p']
def only_p(m):
r = {}
if m:
m = json.loads(m)
for p in _p:
r[p] = m[p]
return r
qs = qs[query['i']:query['o']] qs = qs[query['i']:query['o']]
print qs.query.as_sql()
p = Paginator(qs, 100) response['items'] = [only_p(m['json']) for m in qs.values('json')]
for i in p.page_range:
page = p.page(i)
for m in page.object_list:
response['items'].append(m.json(query['p']))
elif 'g' in query: elif 'g' in query:
if query['s'].split(':')[0] not in ('name', 'items'): if query['s'].split(':')[0] not in ('name', 'items'):
query['s'] = 'name' query['s'] = 'name'
@ -207,9 +218,9 @@ def find(request):
order_by = "%s:%s" % (items, order_by[1]) order_by = "%s:%s" % (items, order_by[1])
qs = order_query(qs, order_by, '') qs = order_query(qs, order_by, '')
qs = qs[query['i']:query['o']] qs = qs[query['i']:query['o']]
for i in qs:
group = {'title': i[name], 'items': i[items]} response['items'] = [{'title': i[name], 'items': i[items]} for i in qs]
response['items'].append(group)
else: else:
#FIXME: also filter lists here #FIXME: also filter lists here
movies = models.Movie.objects.filter(available=True) movies = models.Movie.objects.filter(available=True)
@ -225,23 +236,15 @@ def find(request):
''' '''
GET info?oshash=a41cde31c581e11d GET info?oshash=a41cde31c581e11d
> { > {
"movie_id": 0123456, "movie_id": 0123456, ??
"duration": 5.266667,
"video_codec": "mpeg1",
"pixel_format": "yuv420p",
"width": 352,
"height": 240,
"pixel_aspect_ratio": "1:1",
"display_aspect_ratio": "22:15",
"framerate": "30:1",
"audio_codec": "mp2",
"samplerate": 44100,
"channels": 1,
"path": "E/Example, The/An Example.avi",
"size": 1646274
"oshash": "a41cde31c581e11d", "oshash": "a41cde31c581e11d",
"sha1":.., "sha1":..,
"md5":.. "md5":..
"duration": 5.266667,
"video": [],
"audio": [],
"path": "E/Example, The/An Example.avi",
"size": 1646274
} }
''' '''
def file_info(request): def file_info(request):
@ -264,7 +267,7 @@ srt =
def subtitles(request): def subtitles(request):
oshash = request.GET['oshash'] oshash = request.GET['oshash']
language = request.GET.get('language', None) language = request.GET.get('language', None)
if requeset.method == 'POST': if request.method == 'POST':
user = request.user user = request.user
sub = models.Subtitles.get_or_create(user, oshash, language) sub = models.Subtitles.get_or_create(user, oshash, language)
sub.srt = request.POST['srt'] sub.srt = request.POST['srt']
@ -289,6 +292,7 @@ GET list
''' '''
@login_required_json @login_required_json
def list_files(request): def list_files(request):
response = {}
response['files'] = {} response['files'] = {}
qs = models.UserFile.filter(user=request.user) qs = models.UserFile.filter(user=request.user)
p = Paginator(qs, 1000) p = Paginator(qs, 1000)
@ -299,9 +303,10 @@ def list_files(request):
return render_to_json_response(response) return render_to_json_response(response)
def find_files(request): def find_files(request):
response = {}
query = parse_query(request) query = parse_query(request)
response['files'] = {} response['files'] = {}
qs = models.UserFile.filter(user=request.user).filter(movie_file__movie__id__in=quert['q']) qs = models.UserFile.filter(user=request.user).filter(movie_file__movie__id__in=query['q'])
p = Paginator(qs, 1000) p = Paginator(qs, 1000)
for i in p.page_range: for i in p.page_range:
page = p.page(i) page = p.page(i)
@ -310,7 +315,7 @@ def find_files(request):
return render_to_json_response(response) return render_to_json_response(response)
''' '''
POST add POST metadata
> file: { > file: {
"duration": 5.266667, "duration": 5.266667,
"video_codec": "mpeg1", "video_codec": "mpeg1",
@ -331,8 +336,7 @@ POST add
} }
''' '''
#@login_required_json #@login_required_json
def add_file(request, archive): def add_metadata(request, archive):
print request.POST
info = json.loads(request.POST['file']) info = json.loads(request.POST['file'])
oshash = info['oshash'] oshash = info['oshash']
archive = models.Archive.objects.get(name=archive) archive = models.Archive.objects.get(name=archive)
@ -344,15 +348,99 @@ def add_file(request, archive):
response = {'status': 404} response = {'status': 404}
return render_to_json_response(response) return render_to_json_response(response)
class StillForm(forms.Form):
still = forms.FileField()
position = forms.FloatField()
#@login_required_json
def add_still(request, oshash):
response = {'status': 500}
f = get_object_or_404(models.File, oshash=oshash)
form = TimelineForm(request.POST, request.FILES)
if form.is_valid():
ff = form.cleaned_data['still']
position = form.cleaned_data['position']
still = models.Still(file=f, position=position)
still.save()
still.still.save(ff, ff.name)
response = {'status': 200}
response['url'] = still.url()
return render_to_json_response(response)
class TimelineForm(forms.Form):
timeline = forms.FileField()
#FIXME: should everybody be able to overwrite timelines?
#@login_required_json
def add_timeline(request, oshash):
response = {'status': 500}
f = get_object_or_404(models.File, oshash=oshash)
form = TimelineForm(request.POST, request.FILES)
if form.is_valid():
ff = form.cleaned_data['timeline']
f.timeline.save(ff.name, ff)
response = {'status': 200}
response['url'] = f.timeline.url()
return render_to_json_response(response)
class VideoForm(forms.Form):
video = forms.FileField()
#@login_required_json
def add_video(request, oshash):
response = {'status': 500}
f = get_object_or_404(models.File, oshash=oshash)
form = VideoForm(request.POST, request.FILES)
if form.is_valid():
ff = form.cleaned_data['video']
f.stream128.save(ff.name, ff)
response = {'status': 200}
response['url'] = f.stream128.url()
return render_to_json_response(response)
''' '''
POST remove?oshash= POST update
> files: {
oshash: { 'path': .., ..},
oshash: { 'path': .., ..},
}
''' '''
@login_required_json #@login_required_json
def remove_file(request, archive): def update_archive(request, archive):
oshash = request.POST['oshash'] print "update request"
archive = models.Archive.objects.get(name=archive) archive = models.Archive.objects.get(name=archive)
models.UserFiles.objects.filter(movie_file__oshash=oshash, user=request.user).delete() files = json.loads(request.POST['files'])
response = {'status': 200} print "update request for", archive.name
needs_data = []
rename = {}
for oshash in files:
print 'checking', oshash
data = files[oshash]
q = models.ArchiveFile.objects.filter(archive=archive, file__oshash=oshash)
if q.count() == 0:
print "adding file", oshash, data['path']
f = models.ArchiveFile.get_or_create(archive, oshash)
f.update(data)
#FIXME: only add if it was not in File
else:
f = q[0]
if data['path'] != f.path:
f.path = data['path']
f.save()
if f.file.needs_data:
needs_data.append(oshash)
if f.path != f.file.path:
rename[oshash] = f.file.path
print "processed files for", archive.name
#remove all files not in files.keys() from ArchiveFile
response = {}
response['info'] = needs_data
response['rename'] = rename
return render_to_json_response(response) return render_to_json_response(response)
def file_parse(request): def file_parse(request):

View file

@ -52,6 +52,8 @@ TESTS_ROOT = join(PROJECT_ROOT, 'tests')
# Examples: "http://media.lawrence.com", "http://example.com/media/" # Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = '' MEDIA_URL = ''
STATIC_URL = '/static/'
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash. # trailing slash.
# Examples: "http://foo.com/media/", "/media/". # Examples: "http://foo.com/media/", "/media/".
@ -61,7 +63,7 @@ ADMIN_MEDIA_PREFIX = '/admin/media/'
TEMPLATE_LOADERS = ( TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source', 'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source', 'django.template.loaders.app_directories.load_template_source',
# 'django.template.loaders.eggs.load_template_source', 'django.template.loaders.eggs.load_template_source',
) )
MIDDLEWARE_CLASSES = ( MIDDLEWARE_CLASSES = (
@ -88,6 +90,14 @@ INSTALLED_APPS = (
'backend', 'backend',
) )
#rabbitmq connection settings
BROKER_HOST = "127.0.0.1"
BROKER_PORT = 5672
BROKER_USER = "oxdb"
BROKER_PASSWORD = "0xdb"
BROKER_VHOST = "/oxdb"
#overwrite default settings with local settings #overwrite default settings with local settings
try: try:
from local_settings import * from local_settings import *

View file

@ -0,0 +1,91 @@
ajax_filtered_fields = {
request_url: "/ajax_filtered_fields/json_index/",
data_loaded: "data_loaded",
_appendOption: function(obj, selector) {
// append a json data row as an option to the selector
var option = $('<option>' + obj[1] + '</option>');
option.attr({value: obj[0]});
option.appendTo(selector);
return option;
},
_removeOptions: function(selector) {
// remove all options from selector
selector.children("option").each(function(i) {
$(this).remove();
});
},
getManyToManyJSON: function(element_id, app_label, object_name,
lookup_string, select_related) {
// manage the ManyToMany ajax request
var selector_from = $("#" + element_id + "_from");
var selector_to = $("#" + element_id + "_to");
$("#" + element_id + "_input").val("");
selector_from.attr("disabled", true);
selector_to.attr("disabled", true);
this._removeOptions(selector_from);
$.getJSON(this.request_url, {
app_label: app_label,
object_name: object_name,
lookup_string: lookup_string,
select_related: select_related},
function(data){
$.each(data, function(i, obj){
var option_is_selected = selector_to.children("option[value='" + obj[0] + "']").length;
if (!option_is_selected) {
ajax_filtered_fields._appendOption(obj, selector_from);
};
});
SelectBox.init(element_id + "_from");
selector_from.attr("disabled", false);
selector_to.attr("disabled", false);
selector_from.trigger(ajax_filtered_fields.data_loaded);
});
},
getForeignKeyJSON: function(element_id, app_label, object_name,
lookup_string, select_related) {
// manage the ForeignKey ajax request
var selector = $("#" + element_id);
var hidden = $("#hidden-" + element_id);
$("#" + element_id + "_input").val("");
selector.attr("disabled", true);
this._removeOptions(selector);
$.getJSON(this.request_url, {
app_label: app_label,
object_name: object_name,
lookup_string: lookup_string,
select_related: select_related},
function(data){
var selection = hidden.val();
ajax_filtered_fields._appendOption(new Array("", "---------"), selector);
$.each(data, function(i, obj){
ajax_filtered_fields._appendOption(obj, selector);
});
selector.children("option[value='" + selection + "']").attr("selected", "selected");
selector.attr("disabled", false);
SelectBox.init(element_id);
ajax_filtered_fields.bindForeignKeyOptions(element_id);
selector.trigger(ajax_filtered_fields.data_loaded);
});
},
bindForeignKeyOptions: function(element_id) {
// bind the dummy options to the hidden field that do the work
var selector = $("#" + element_id);
var hidden = $("#hidden-" + element_id);
selector.change(function(e) {
hidden.val($(this).val());
});
}
};

View file

@ -568,7 +568,7 @@ $(function() {
items.push({ items.push({
size: 64, size: 64,
id: code, id: code,
icon: "http://oil21.org/tmp/flags/" + flag + ".png", icon: "http://localhost/oxdbstatic/flags/" + flag + ".png",
title: strings[0] + (strings.length > 1 ? "<br/>" + strings[1] : ""), title: strings[0] + (strings.length > 1 ? "<br/>" + strings[1] : ""),
info: Ox.formatNumber(v.items) + " Movie" + (v.items > 1 ? "s" : "") info: Ox.formatNumber(v.items) + " Movie" + (v.items > 1 ? "s" : "")
}); });

View file

@ -9,6 +9,7 @@ admin.autodiscover()
urlpatterns = patterns('', urlpatterns = patterns('',
# Example: # Example:
(r'^ajax_filtered_fields/', include('ajax_filtered_fields.urls')),
(r'^json/', include('backend.urls')), (r'^json/', include('backend.urls')),
(r'^$', 'app.views.index'), (r'^$', 'app.views.index'),

View file

@ -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.template import RequestContext
from django.utils import simplejson as json from django.utils import simplejson as json
from ox.django.shortcuts import render_to_json_response from oxdjango.shortcuts import render_to_json_response
from ox.django.decorators import login_required_json from oxdjango.decorators import login_required_json
import models import models
@ -51,7 +51,7 @@ def recover(request):
if q.count() > 0: if q.count() > 0:
user = q[0] user = q[0]
if user: if user:
user.sendmail(...) #FIXME: send recovery mail #user.sendmail(...) #FIXME: send recovery mail
response = {'status': 200, 'message': 'recovert email sent.'} response = {'status': 200, 'message': 'recovert email sent.'}
else: else:
response = {'status': 500, 'message': 'user or email not found.'} response = {'status': 500, 'message': 'user or email not found.'}
@ -80,7 +80,7 @@ def preferences(request):
if key == 'password': if key == 'password':
user.set_password(value) user.set_password(value)
user.save() user.save()
elsif key == 'email': elif key == 'email':
user.email = vaule user.email = vaule
user.save() user.save()
else: else: