forked from 0x2620/pandora
always create a local poster
This commit is contained in:
parent
b34add3f99
commit
2faa1e28e0
2 changed files with 36 additions and 24 deletions
|
@ -631,6 +631,9 @@ class Item(models.Model):
|
||||||
elif not os.path.exists(os.path.dirname(stream.video.path)):
|
elif not os.path.exists(os.path.dirname(stream.video.path)):
|
||||||
os.makedirs(os.path.dirname(stream.video.path))
|
os.makedirs(os.path.dirname(stream.video.path))
|
||||||
if len(files.values()) > 1:
|
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):
|
for f in sorted(files):
|
||||||
cmd.append('+')
|
cmd.append('+')
|
||||||
cmd.append(files[f])
|
cmd.append(files[f])
|
||||||
|
@ -724,6 +727,9 @@ class Item(models.Model):
|
||||||
timeline = self.path('timeline.64.png')
|
timeline = self.path('timeline.64.png')
|
||||||
timeline = os.path.abspath(os.path.join(settings.MEDIA_ROOT, timeline))
|
timeline = os.path.abspath(os.path.join(settings.MEDIA_ROOT, timeline))
|
||||||
if not os.path.exists(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
|
return posters
|
||||||
if self.poster_frame >= 0:
|
if self.poster_frame >= 0:
|
||||||
frame = self.get_poster_frame_path()
|
frame = self.get_poster_frame_path()
|
||||||
|
@ -743,16 +749,20 @@ class Item(models.Model):
|
||||||
posters = self.local_posters()
|
posters = self.local_posters()
|
||||||
timeline = self.path('timeline.64.png')
|
timeline = self.path('timeline.64.png')
|
||||||
timeline = os.path.abspath(os.path.join(settings.MEDIA_ROOT, timeline))
|
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:
|
for poster in posters:
|
||||||
frame = posters[poster]
|
frame = posters[poster]
|
||||||
cmd = [settings.ITEM_POSTER,
|
cmd = [settings.ITEM_POSTER,
|
||||||
'-t', self.get('title'),
|
'-t', self.get('title'),
|
||||||
'-d', ', '.join(self.get('director', ['Unknown Director'])),
|
'-d', ', '.join(self.get('director', ['Unknown Director'])),
|
||||||
'-y', str(self.get('year', '')),
|
'-y', str(self.get('year', '')),
|
||||||
|
'-p', poster
|
||||||
|
]
|
||||||
|
if frame:
|
||||||
|
cmd += [
|
||||||
'-f', frame,
|
'-f', frame,
|
||||||
'-l', timeline,
|
'-l', timeline,
|
||||||
'-p', poster
|
|
||||||
]
|
]
|
||||||
if settings.USE_IMDB:
|
if settings.USE_IMDB:
|
||||||
if len(self.itemId) == 7:
|
if len(self.itemId) == 7:
|
||||||
|
@ -760,6 +770,7 @@ class Item(models.Model):
|
||||||
cmd += ['-o', self.oxdbId]
|
cmd += ['-o', self.oxdbId]
|
||||||
else:
|
else:
|
||||||
cmd += ['-i', self.itemId]
|
cmd += ['-i', self.itemId]
|
||||||
|
print cmd
|
||||||
p = subprocess.Popen(cmd)
|
p = subprocess.Popen(cmd)
|
||||||
p.wait()
|
p.wait()
|
||||||
return posters.keys()
|
return posters.keys()
|
||||||
|
|
|
@ -51,10 +51,10 @@ def render_poster(title, director, year, series, oxdb_id, imdb_id, frame, timeli
|
||||||
}
|
}
|
||||||
|
|
||||||
# frame
|
# frame
|
||||||
if frame:
|
|
||||||
frame_width = poster_width
|
frame_width = poster_width
|
||||||
frame_ratio = 4 / 3
|
frame_ratio = 4 / 3
|
||||||
frame_height = int(round(frame_width / frame_ratio))
|
frame_height = int(round(frame_width / frame_ratio))
|
||||||
|
if frame:
|
||||||
frame_image = Image.open(frame)
|
frame_image = Image.open(frame)
|
||||||
frame_image_ratio = frame_image.size[0] / frame_image.size[1]
|
frame_image_ratio = frame_image.size[0] / frame_image.size[1]
|
||||||
if frame_ratio < frame_image_ratio:
|
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
|
||||||
timeline_width = poster_width
|
timeline_width = poster_width
|
||||||
timeline_height = 64
|
timeline_height = 64
|
||||||
|
if timeline:
|
||||||
timeline_image = Image.open(timeline)
|
timeline_image = Image.open(timeline)
|
||||||
timeline_image = timeline_image.resize((timeline_width, timeline_height), Image.ANTIALIAS)
|
timeline_image = timeline_image.resize((timeline_width, timeline_height), Image.ANTIALIAS)
|
||||||
poster_image.paste(timeline_image, (0, frame_height))
|
poster_image.paste(timeline_image, (0, frame_height))
|
||||||
|
|
Loading…
Reference in a new issue