add settings.POSTER_PRECEDENCE, update nginx setup

This commit is contained in:
j 2010-09-17 22:23:03 +02:00
parent 8431f02527
commit 37ed99d029
3 changed files with 13 additions and 16 deletions

View file

@ -10,5 +10,5 @@ respawn
chdir /srv/pandora/pandora chdir /srv/pandora/pandora
exec /srv/pandora/bin/gunicorn_django -u pandora -g pandora -b 127.0.0.1:8083 -w5 settings.py exec /srv/pandora/bin/gunicorn_django --daemon -u pandora -g pandora -b 127.0.0.1:8083 -w5 settings.py

View file

@ -517,13 +517,18 @@ class Movie(models.Model):
for f in glob(path.replace('.jpg', '*.jpg')): for f in glob(path.replace('.jpg', '*.jpg')):
os.unlink(f) os.unlink(f)
def prefered_poster_url(self):
if self.poster_url:
return self.poster_url
self.update_poster_urls()
for service in settings.POSTER_PRECEDENCE:
for u in self.poster_urls.filter(service=service).order_by('-height'):
return u.url
return None
def download_poster(self, force=False): def download_poster(self, force=False):
if not self.poster or force: if not self.poster or force:
url = self.poster_url url = self.prefered_poster_url()
if not url:
self.update_poster_urls()
if self.poster_urls.count() > 0:
url = self.poster_urls.all().order_by('-height')[0].url
if url: if url:
data = ox.net.readUrl(url) data = ox.net.readUrl(url)
if force: if force:

View file

@ -17,17 +17,8 @@ JSON_DEBUG = True
#with apache x-sendfile or lighttpd set this to True #with apache x-sendfile or lighttpd set this to True
XSENDFILE = False XSENDFILE = False
#with nginx X-Accel-Redirect set this to True
XACCELREDIRECT = False XACCELREDIRECT = False
# with nginx:
#XACCELREDIRECT=['/srv/pandora/pandora/media/', '/media/']
'''
this assumes the following configuration:
location /media/ {
internal;
root /srv/pandora/pandora/media/;
}
'''
ADMINS = ( ADMINS = (
#('admin', 'admin@example.com'), #('admin', 'admin@example.com'),
@ -154,6 +145,7 @@ TRANSMISSON_PASSWORD='transmission'
#list of poster services, https://wiki.0x2620.org/wiki/pandora/posterservice #list of poster services, https://wiki.0x2620.org/wiki/pandora/posterservice
POSTER_SERVICES=[] POSTER_SERVICES=[]
POSTER_PRECEDENCE=('local', 'criterion.com', 'wikipedia.org', 'impawards.com', 'movieposterdb.com', 'imdb.com', 'allmovie.com', 'other')
#0xdb.org #0xdb.org
#POSTER_SERVICES=['http://data.0xdb.org/poster/'] #POSTER_SERVICES=['http://data.0xdb.org/poster/']