add settings.POSTER_PRECEDENCE, update nginx setup
This commit is contained in:
parent
8431f02527
commit
37ed99d029
3 changed files with 13 additions and 16 deletions
|
@ -10,5 +10,5 @@ respawn
|
|||
|
||||
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
|
||||
|
||||
|
|
|
@ -517,13 +517,18 @@ class Movie(models.Model):
|
|||
for f in glob(path.replace('.jpg', '*.jpg')):
|
||||
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):
|
||||
if not self.poster or force:
|
||||
url = self.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
|
||||
url = self.prefered_poster_url()
|
||||
if url:
|
||||
data = ox.net.readUrl(url)
|
||||
if force:
|
||||
|
|
|
@ -17,17 +17,8 @@ JSON_DEBUG = True
|
|||
#with apache x-sendfile or lighttpd set this to True
|
||||
XSENDFILE = False
|
||||
|
||||
#with nginx X-Accel-Redirect set this to True
|
||||
XACCELREDIRECT = False
|
||||
# with nginx:
|
||||
#XACCELREDIRECT=['/srv/pandora/pandora/media/', '/media/']
|
||||
'''
|
||||
this assumes the following configuration:
|
||||
location /media/ {
|
||||
internal;
|
||||
root /srv/pandora/pandora/media/;
|
||||
}
|
||||
'''
|
||||
|
||||
|
||||
ADMINS = (
|
||||
#('admin', 'admin@example.com'),
|
||||
|
@ -154,6 +145,7 @@ TRANSMISSON_PASSWORD='transmission'
|
|||
|
||||
#list of poster services, https://wiki.0x2620.org/wiki/pandora/posterservice
|
||||
POSTER_SERVICES=[]
|
||||
POSTER_PRECEDENCE=('local', 'criterion.com', 'wikipedia.org', 'impawards.com', 'movieposterdb.com', 'imdb.com', 'allmovie.com', 'other')
|
||||
|
||||
#0xdb.org
|
||||
#POSTER_SERVICES=['http://data.0xdb.org/poster/']
|
||||
|
|
Loading…
Reference in a new issue