always create a local poster

This commit is contained in:
j 2011-04-05 14:56:02 +02:00
parent b34add3f99
commit 2faa1e28e0
2 changed files with 36 additions and 24 deletions

View file

@ -631,6 +631,9 @@ class Item(models.Model):
elif not os.path.exists(os.path.dirname(stream.video.path)):
os.makedirs(os.path.dirname(stream.video.path))
if len(files.values()) > 1:
if len(files.values()) > 4:
print "FIXME: to many files for this item, not merging entire tv shows"
return
for f in sorted(files):
cmd.append('+')
cmd.append(files[f])
@ -724,6 +727,9 @@ class Item(models.Model):
timeline = self.path('timeline.64.png')
timeline = os.path.abspath(os.path.join(settings.MEDIA_ROOT, timeline))
if not os.path.exists(timeline):
path = self.path('poster.pandora.jpg')
path = os.path.abspath(os.path.join(settings.MEDIA_ROOT, path))
posters[path] = False
return posters
if self.poster_frame >= 0:
frame = self.get_poster_frame_path()
@ -743,16 +749,20 @@ class Item(models.Model):
posters = self.local_posters()
timeline = self.path('timeline.64.png')
timeline = os.path.abspath(os.path.join(settings.MEDIA_ROOT, timeline))
if os.path.exists(timeline):
if not os.path.exists(os.path.join(settings.MEDIA_ROOT,self.path())):
os.makedirs(os.path.join(settings.MEDIA_ROOT,self.path()))
for poster in posters:
frame = posters[poster]
cmd = [settings.ITEM_POSTER,
'-t', self.get('title'),
'-d', ', '.join(self.get('director', ['Unknown Director'])),
'-y', str(self.get('year', '')),
'-p', poster
]
if frame:
cmd += [
'-f', frame,
'-l', timeline,
'-p', poster
]
if settings.USE_IMDB:
if len(self.itemId) == 7:
@ -760,6 +770,7 @@ class Item(models.Model):
cmd += ['-o', self.oxdbId]
else:
cmd += ['-i', self.itemId]
print cmd
p = subprocess.Popen(cmd)
p.wait()
return posters.keys()

View file

@ -51,10 +51,10 @@ def render_poster(title, director, year, series, oxdb_id, imdb_id, frame, timeli
}
# frame
if frame:
frame_width = poster_width
frame_ratio = 4 / 3
frame_height = int(round(frame_width / frame_ratio))
if frame:
frame_image = Image.open(frame)
frame_image_ratio = frame_image.size[0] / frame_image.size[1]
if frame_ratio < frame_image_ratio:
@ -70,6 +70,7 @@ def render_poster(title, director, year, series, oxdb_id, imdb_id, frame, timeli
# timeline
timeline_width = poster_width
timeline_height = 64
if timeline:
timeline_image = Image.open(timeline)
timeline_image = timeline_image.resize((timeline_width, timeline_height), Image.ANTIALIAS)
poster_image.paste(timeline_image, (0, frame_height))