Unverified Commit bde8553a authored by seb-b's avatar seb-b Committed by GitHub
Browse files

Merge pull request #63 from jkevingutierrez/patch-1

Extract transcodes to reusable function
parents 35b5c815 573bf90b
......@@ -183,6 +183,9 @@ class AbstractVideo(CollectionMember, index.Indexed, models.Model):
@classmethod
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:
......@@ -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