forked from 0x2620/pandora
update static location in scripts, fix poster generation
This commit is contained in:
parent
86c5e3cc6a
commit
fc2951eb06
5 changed files with 12 additions and 6 deletions
|
@ -239,6 +239,7 @@ def getItem(info):
|
|||
#item.save()
|
||||
#tasks.updateImdb.delay(item.itemId)
|
||||
item.updateImdb()
|
||||
tasks.updatePoster.delay(item.itemId)
|
||||
else:
|
||||
q = Item.objects.filter(find__title=info['title'])
|
||||
if q.count() > 1:
|
||||
|
@ -776,10 +777,14 @@ class Item(models.Model):
|
|||
posters = self.local_posters()
|
||||
for poster in posters:
|
||||
frame = posters[poster]
|
||||
timeline = os.path.join(itemid_path(self.itemId), 'timeline.64.png')
|
||||
timeline = os.path.abspath(os.path.join(settings.MEDIA_ROOT, timeline))
|
||||
cmd = [settings.ITEM_POSTER,
|
||||
'-t', self.get('title'),
|
||||
'-d', ', '.join(self.get('directors', ['Unknown Director'])),
|
||||
'-y', str(self.get('year', '')),
|
||||
'-f', frame,
|
||||
'-l', timeline,
|
||||
'-p', poster
|
||||
]
|
||||
if len(self.itemId) == 7:
|
||||
|
|
|
@ -10,7 +10,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__), '..', '..', 'static')
|
||||
|
||||
def render_icon(frame, timeline, icon):
|
||||
icon_width = 256
|
||||
|
|
|
@ -10,7 +10,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__), '..', '..', 'static')
|
||||
|
||||
def render_list_icon(frames, icon):
|
||||
icon_width = 256
|
||||
|
|
|
@ -10,7 +10,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__), '..', '..', 'static')
|
||||
|
||||
def render_poster(title, director, year, series, oxdb_id, imdb_id, frame, timeline, poster):
|
||||
def get_oxdb_color(oxdb_id, series=False):
|
||||
|
@ -37,6 +37,7 @@ def render_poster(title, director, year, series, oxdb_id, imdb_id, frame, timeli
|
|||
poster_image = Image.new('RGB', (poster_width, poster_height))
|
||||
draw = ImageDraw.Draw(poster_image)
|
||||
font_file = os.path.join(static_root, 'ttf', 'DejaVuSansCondensedBold.ttf')
|
||||
|
||||
font_size = {
|
||||
'small': 28,
|
||||
'large': 42,
|
||||
|
@ -109,9 +110,9 @@ def render_poster(title, director, year, series, oxdb_id, imdb_id, frame, timeli
|
|||
logo_color = logo_image.getpixel((x, y))[0]
|
||||
alpha = logo_image.getpixel((x, y))[3]
|
||||
if series:
|
||||
poster_color = tuple(map(lambda x: x - (logo_color - 16) * alpha / 255, poster_color))
|
||||
poster_color = tuple(map(lambda x: int(x - (logo_color - 16) * alpha / 255), poster_color))
|
||||
else:
|
||||
poster_color = tuple(map(lambda x: x + (logo_color - 16) * alpha / 255, poster_color))
|
||||
poster_color = tuple(map(lambda x: int(x + (logo_color - 16) * alpha / 255), poster_color))
|
||||
poster_image.putpixel((logo_left + x, logo_top + y), poster_color)
|
||||
|
||||
poster_image.save(poster)
|
||||
|
|
|
@ -9,7 +9,7 @@ import os
|
|||
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__), '..', '..', 'static')
|
||||
|
||||
def render_poster(id, title, frame, timeline, poster):
|
||||
poster_width = 640
|
||||
|
|
Loading…
Reference in a new issue