Browse Source

Display duration info for link topics

This only covers YouTube for now, but hopefully will be possible to
extend to other relevant sites in the future.
merge-requests/55/head
Deimos 6 years ago
parent
commit
dd6e8b930b
  1. 6
      tildes/tildes/models/topic/topic.py

6
tildes/tildes/models/topic/topic.py

@ -395,6 +395,12 @@ class Topic(DatabaseModel):
if self.created_time - published > timedelta(days=3):
metadata_strings.append(published.strftime("%b %-d %Y"))
# display the duration if we have it
duration = self.get_content_metadata("duration")
if duration:
duration_delta = timedelta(seconds=duration)
metadata_strings.append(str(duration_delta).lstrip("0:"))
return ", ".join(metadata_strings)
@property

Loading…
Cancel
Save