diff --git a/pandora/archive/views.py b/pandora/archive/views.py index 59ec3743a..80626d58a 100644 --- a/pandora/archive/views.py +++ b/pandora/archive/views.py @@ -13,7 +13,7 @@ from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.db.models import Q, Avg, Count, Sum from django.http import HttpResponse, Http404 -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, redirect from django.template import RequestContext from django.conf import settings @@ -250,6 +250,12 @@ def api_editFile(request): #FIXME: should this be file.files. or part of update response = json_response(status=501, text='not implemented') return render_to_json_response(response) + +def lookup_file(request, oshash): + f = get_object_or_404(models.File, oshash=oshash) + return redirect(f.movie.get_absolute_url()) + + """ def api_fileInfo(request): ''' diff --git a/pandora/backend/models.py b/pandora/backend/models.py index f3951df03..3a7a2d683 100644 --- a/pandora/backend/models.py +++ b/pandora/backend/models.py @@ -144,6 +144,9 @@ class Movie(models.Model): return u'%s (%s)' % (self.get('title'), self.get('year')) return self.get('title') + def get_absolute_url(self): + return '/timeline#%s' % self.movieId + def save(self, *args, **kwargs): self.json = self.get_json() if not self.oxdbId: diff --git a/pandora/settings.py b/pandora/settings.py index e1c49bbfd..e1261d3cd 100644 --- a/pandora/settings.py +++ b/pandora/settings.py @@ -19,12 +19,12 @@ XSENDFILE = False XACCELREDIRECT = False # with nginx: -#XACCELREDIRECT=[/some/path/, /protected/] +#XACCELREDIRECT=['/srv/pandora/pandora/media/', '/media/'] ''' this assumes the following configuration: -location /protected/ { +location /media/ { internal; - root /some/path/; + root /srv/pandora/pandora/media/; } ''' diff --git a/pandora/static/js/pandora.local.js b/pandora/static/js/pandora.local.js index 32d6eae72..b6c2b13de 100644 --- a/pandora/static/js/pandora.local.js +++ b/pandora/static/js/pandora.local.js @@ -235,10 +235,10 @@ app.afterLaunch.push(function() { }, ], id: "volume", - request: function(options) { + request: function(options, callback) { Ox.print("options, volumes", options) if(!options.range) { - options.callback({ + callback({ data: { items: 58 } @@ -246,7 +246,7 @@ app.afterLaunch.push(function() { } else { app.local.files(name, function(result) { var fileInfo = result.info; - app.request('update', { + app.api.update({ 'volume': name, 'files': result.files }, function(result) { var videos = {}; @@ -301,7 +301,7 @@ app.afterLaunch.push(function() { post.info[oshash] = fileInfo[oshash]; } }); - app.request('update', post, function(result) { + app.api.update(post, function(result) { parseResult(result); }); } else { @@ -337,7 +337,7 @@ app.afterLaunch.push(function() { data: data, } Ox.print(r); - options.callback(r); + callback(r); }); } diff --git a/pandora/urls.py b/pandora/urls.py index a8e06ea2b..b848fc6c6 100644 --- a/pandora/urls.py +++ b/pandora/urls.py @@ -16,6 +16,8 @@ urlpatterns = patterns('', (r'^$', 'app.views.intro'), (r'^ra$', 'app.views.index'), (r'^timeline$', 'app.views.timeline'), + (r'^file/(?P.*)$', 'archive.views.lookup_file'), + (r'^r/(?P.*)$', 'oxuser.views.recover'), (r'', include('backend.urls')),