cleanup static

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

View file

@ -6,3 +6,4 @@ src
bin bin
static/json/pandora.json static/json/pandora.json
static/js/pandora.js static/js/pandora.js
static/png/*.png

View file

@ -4,6 +4,7 @@ from __future__ import division, with_statement
import os import os
import sys import sys
import shutil
import time import time
import thread import thread
@ -72,6 +73,18 @@ def update_static():
with open(pandora_json, 'w') as f: with open(pandora_json, 'w') as f:
json.dump(sorted(js), f, indent=2) 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(): def init():
load_config() load_config()
thread.start_new_thread(reloader_thread, ()) thread.start_new_thread(reloader_thread, ())

View file

@ -693,7 +693,7 @@ def poster(request, id, size=None):
if item.poster: if item.poster:
return image_to_response(item.poster, size) return image_to_response(item.poster, size)
else: 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 = HttpFileResponse(poster_path, content_type='image/jpeg')
response['Cache-Control'] = 'no-cache' response['Cache-Control'] = 'no-cache'
return response return response

View file

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

View file

@ -516,5 +516,5 @@ def icon(request, id, size=16):
list = qs[0] list = qs[0]
icon = list.get_icon(int(size)) icon = list.get_icon(int(size))
else: 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') return HttpFileResponse(icon, content_type='image/jpeg')

View file

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View file

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View file

@ -15,7 +15,7 @@ from optparse import OptionParser
import sys 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): def render_icon(frame, timeline, icon):
icon_width = 1024 icon_width = 1024

View file

@ -16,7 +16,7 @@ from optparse import OptionParser
from ox.image import drawText, wrapText from ox.image import drawText, wrapText
import sys 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): def render_list_icon(frames, icon):
icon_width = 256 icon_width = 256

View file

@ -17,7 +17,7 @@ from ox.image import drawText, wrapText
import sys 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 render_poster(title, director, year, series, oxdb_id, imdb_id, frame, timeline, poster):
def get_oxdb_color(oxdb_id, series=False): 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
logo_height = 32 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_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_image = logo_image.resize((logo_width, logo_height), Image.ANTIALIAS)
logo_left = text_width - text_margin - logo_width logo_left = text_width - text_margin - logo_width

View file

@ -16,7 +16,7 @@ from optparse import OptionParser
from ox.image import drawText, wrapText from ox.image import drawText, wrapText
import sys 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): def render_poster(id, title, frame, timeline, poster):
poster_width = 640 poster_width = 640

View file

@ -1,86 +0,0 @@
<div id="itemInfo">
<div style="position: absolute; left: 8px; top: 8px; width: 256px">
<div style="width: 256px; height: ${posterHeight}px">
<img class="icon" style="position: absolute; left: ${posterLeft}px; width: ${posterWidth}px; height: ${posterHeight}px" src="/${id}/poster.jpg"/>
</div>
<div style="display: block; position: absolute; top: ${posterHeight}px; width: 256px; height: 128px; overflow-y: hidden">
<img class="icon" style="position: absolute; left: ${posterLeft}px; width: ${posterWidth}px; height: ${posterHeight}px; -moz-transform: scaleY(-1); -webkit-transform: scaleY(-1)" src="/${id}/poster.jpg"/>
<div style="display: block; position: absolute; width: 256px; height: 128px; background: -moz-linear-gradient(top, rgba(16, 16, 16, 0.75), rgba(16, 16, 16, 1)); background: -webkit-linear-gradient(top, rgba(16, 16, 16, 0.75), rgba(16, 16, 16, 1))"></div>
</div>
</div>
<div style="position: absolute; width: 512px; left: 272px; top: 8px">
<div id="movieTitle" class="movieData textLarge textLeft" style="margin-top: 0px; margin-bottom: 2px; font-size: 13px; font-weight: bold">
${title}
</div>
<div id="movieDirector" class="movieData textLarge textLeft" style="margin-bottom: 4px; font-size: 13px; font-weight: bold">
${director}
</div>
<div id="movieInfo" class="movieData textMedium textJustify" style="margin-bottom: 4px">
<span id="movieCountry">
<span style="font-weight: bold">Country:</span> ${country}
</span>
<span id="movieYear">
<span style="font-weight: bold">Year:</span> ${year}
</span>
<span id="movieLanguage">
<span style="font-weight: bold">Language:</span> ${language}
</span>
<span id="movieRuntime">
<span style="font-weight: bold">Runtime:</span> ${runtime}
</span>
</div>
<div id="movieAltTitles" class="movieData textMedium textJustify" style="margin-bottom: 4px">
<span style="font-weight: bold">Alternative Title(s):</span> ${alternative_titles}
</div>
<div id="movieWriter" class="movieData textMedium textJustify" style="margin-bottom: 4px">
<span style="font-weight: bold">Writer:</span> ${writer}
</div>
<div id="movieProducer" class="movieData textMedium textJustify" style="margin-bottom: 4px">
<span style="font-weight: bold">Producer:</span> ${producer}
</div>
<div id="movieCast" class="movieData textMedium textJustify" style="margin-bottom: 4px">
<span style="font-weight: bold">Cast:</span> ${cast}
</div>
<div id="movieGenre" class="movieData textMedium textJustify" style="margin-bottom: 4px">
<span style="font-weight: bold">Genre:</span> ${genre}
</div>
<div id="movieKeywords" class="movieData textMedium textJustify" style="margin-bottom: 4px">
<span style="font-weight: bold">Keywords:</span> ${keyword}
</div>
<div id="movieSummary" class="movieData textMedium textJustify" style="margin-bottom: 4px">
<span style="font-weight: bold">Summary:</span> FIXME
</div>
<div id="movieTrivia" class="movieData textMedium">
FIXTRIVA
</div>
<div id="movieBusiness" class="movieData textMedium textJustify" style="margin-bottom: 4px">
<div id="movieDate" style="margin-bottom: 4px;">
<span style="font-weight: bold">Release Date:</span> ${release_date}
</div>
<span id="movieBudget">
<span style="font-weight: bold">Budget:</span> ${budget}
</span>
<span id="movieGross">
<span style="font-weight: bold">Gross:</span> ${gross}
</span>
<span id="movieLoss">
<span style="font-weight: bold">Profit:</span> ${profit}
</span>
</div>
<div id="moviePoll" class="movieData textMedium textJustify" style="margin-bottom: 4px">
<span id="movieRating">
<span style="font-weight: bold">Rating:</span> ${rating}
</span>
<span id="movieVotes">
<span style="font-weight: bold">Votes:</span> ${votes}
</span>
</div>
<div id="movieConnections">
FIXME: movie connections
</div>
<div id="movieReviews" class="movieData textMedium textJustify" style="margin-bottom: 4px">
<span style="font-weight: bold">Reviews:</span> ${reviewsHtml}
</div>
</div>
</div>

BIN
static/jpg/list256.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

BIN
static/jpg/poster.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 799 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

View file

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB