cleanup static

This commit is contained in:
j 2011-10-28 00:15:37 +02:00
commit c544084c8e
29 changed files with 22 additions and 94 deletions

View file

@ -4,6 +4,7 @@ from __future__ import division, with_statement
import os
import sys
import shutil
import time
import thread
@ -72,6 +73,18 @@ def update_static():
with open(pandora_json, 'w') as f:
json.dump(sorted(js), f, indent=2)
for size in (16, 64, 256):
pandora = os.path.join(settings.STATIC_ROOT, 'png/pandora/icon%d.png'%size)
image = os.path.join(settings.STATIC_ROOT, 'png/icon%d.png'%size)
if not os.path.exists(image):
shutil.copyfile(pandora, image)
for size in (256, 1024):
pandora = os.path.join(settings.STATIC_ROOT, 'png/pandora/logo%d.png'%size)
image = os.path.join(settings.STATIC_ROOT, 'png/logo%d.png'%size)
if not os.path.exists(image):
shutil.copyfile(pandora, image)
def init():
load_config()
thread.start_new_thread(reloader_thread, ())

View file

@ -693,7 +693,7 @@ def poster(request, id, size=None):
if item.poster:
return image_to_response(item.poster, size)
else:
poster_path = os.path.join(settings.STATIC_ROOT, 'png/poster.png')
poster_path = os.path.join(settings.STATIC_ROOT, 'jpg/poster.jpg')
response = HttpFileResponse(poster_path, content_type='image/jpeg')
response['Cache-Control'] = 'no-cache'
return response

View file

@ -159,7 +159,7 @@ class List(models.Model):
source = self.icon.path
max_size = min(self.icon.width, self.icon.height)
else:
source = os.path.join(settings.STATIC_ROOT, 'png/list256.png')
source = os.path.join(settings.STATIC_ROOT, 'jpg/list256.jpg')
max_size = 256
if size < max_size:
extract.resize_image(source, path, size=size)

View file

@ -516,5 +516,5 @@ def icon(request, id, size=16):
list = qs[0]
icon = list.get_icon(int(size))
else:
icon = os.path.join(settings.STATIC_ROOT, 'jpg/list.jpg')
icon = os.path.join(settings.STATIC_ROOT, 'jpg/list256.jpg')
return HttpFileResponse(icon, content_type='image/jpeg')

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View file

@ -15,7 +15,7 @@ from optparse import OptionParser
import sys
static_root = os.path.join(os.path.dirname(__file__), '..', '..', 'static')
static_root = os.path.join(os.path.dirname(__file__), 'data')
def render_icon(frame, timeline, icon):
icon_width = 1024

View file

@ -16,7 +16,7 @@ from optparse import OptionParser
from ox.image import drawText, wrapText
import sys
static_root = os.path.join(os.path.dirname(__file__), '..', '..', 'static')
static_root = os.path.join(os.path.dirname(__file__), 'data')
def render_list_icon(frames, icon):
icon_width = 256

View file

@ -17,7 +17,7 @@ from ox.image import drawText, wrapText
import sys
static_root = os.path.join(os.path.dirname(__file__), '..', '..', 'static')
static_root = os.path.join(os.path.dirname(__file__), 'data')
def render_poster(title, director, year, series, oxdb_id, imdb_id, frame, timeline, poster):
def get_oxdb_color(oxdb_id, series=False):
@ -107,7 +107,7 @@ def render_poster(title, director, year, series, oxdb_id, imdb_id, frame, timeli
# logo
logo_height = 32
logo_image = Image.open(os.path.join(static_root, 'png', 'logo.poster.png'))
logo_image = Image.open(os.path.join(static_root, 'png', 'logo.png'))
logo_width = int(round(logo_height * logo_image.size[0] / logo_image.size[1]))
logo_image = logo_image.resize((logo_width, logo_height), Image.ANTIALIAS)
logo_left = text_width - text_margin - logo_width

View file

@ -16,7 +16,7 @@ from optparse import OptionParser
from ox.image import drawText, wrapText
import sys
static_root = os.path.join(os.path.dirname(__file__), '..', '..', 'static')
static_root = os.path.join(os.path.dirname(__file__), 'data')
def render_poster(id, title, frame, timeline, poster):
poster_width = 640