Unverified Commit 573bf90b authored by Kevin Gutiérrez's avatar Kevin Gutiérrez Committed by GitHub
Browse files

Extract valid transcodes to reusable function

parent cf01a878
......@@ -184,6 +184,9 @@ class AbstractVideo(CollectionMember, index.Indexed, models.Model):
def get_track_listing_model(cls):
return cls.track_listing.related.related_model
def get_current_transcodes(self):
return self.transcodes.exclude(processing=True).filter(error_message__exact='')
def video_tag(self, attrs=None):
if attrs is None:
attrs = {}
......@@ -192,7 +195,7 @@ class AbstractVideo(CollectionMember, index.Indexed, models.Model):
if self.thumbnail:
attrs['poster'] = self.thumbnail.url
transcodes = self.transcodes.exclude(processing=True).filter(error_message__exact='')
transcodes = self.get_current_transcodes()
sources = []
for transcode in transcodes:
sources.append("<source src='{0}' type='video/{1}' >".format(transcode.url, transcode.media_format.name))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment