without timeline there are no local posters

This commit is contained in:
j 2011-02-08 15:58:10 +05:30
parent 61c867dec1
commit 70bf214ec9

View file

@ -726,6 +726,10 @@ class Item(models.Model):
def local_posters(self): def local_posters(self):
part = 1 part = 1
posters = {} posters = {}
timeline = self.path('timeline.64.png')
timeline = os.path.abspath(os.path.join(settings.MEDIA_ROOT, timeline))
if not os.path.exists(timeline):
return posters
if self.poster_frame >= 0: if self.poster_frame >= 0:
frame = self.get_poster_frame_path() frame = self.get_poster_frame_path()
path = self.path('poster.pandora.%s.%s.jpg'%(part, self.poster_frame)) path = self.path('poster.pandora.%s.%s.jpg'%(part, self.poster_frame))
@ -742,11 +746,11 @@ class Item(models.Model):
def make_local_posters(self): def make_local_posters(self):
posters = self.local_posters() posters = self.local_posters()
for poster in posters: timeline = self.path('timeline.64.png')
frame = posters[poster] timeline = os.path.abspath(os.path.join(settings.MEDIA_ROOT, timeline))
timeline = self.path('timeline.64.png') if os.path.exists(timeline):
timeline = os.path.abspath(os.path.join(settings.MEDIA_ROOT, timeline)) for poster in posters:
if os.path.exists(timeline): 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'])),