poster
This commit is contained in:
parent
3db4b37cd6
commit
fc4b59a084
1 changed files with 3 additions and 4 deletions
|
@ -917,15 +917,14 @@ class Item(models.Model):
|
||||||
|
|
||||||
def make_poster(self, force=False):
|
def make_poster(self, force=False):
|
||||||
if not self.poster or force:
|
if not self.poster or force:
|
||||||
url = self.prefered_poster_url()
|
self.delete_poster()
|
||||||
poster = self.make_siteposter()
|
poster = self.make_siteposter()
|
||||||
|
url = self.prefered_poster_url()
|
||||||
if url:
|
if url:
|
||||||
data = ox.net.readUrl(url)
|
data = ox.net.readUrl(url)
|
||||||
self.delete_poster()
|
|
||||||
self.poster.save('poster.jpg', ContentFile(data))
|
self.poster.save('poster.jpg', ContentFile(data))
|
||||||
self.save()
|
self.save()
|
||||||
else:
|
elif os.path.exists(poster):
|
||||||
self.delete_poster()
|
|
||||||
with open(poster) as f:
|
with open(poster) as f:
|
||||||
self.poster.save('poster.jpg', ContentFile(f.read()))
|
self.poster.save('poster.jpg', ContentFile(f.read()))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue