Shows audio in the attachments list

This commit is contained in:
Manuel Cortez 2016-04-04 03:40:42 -05:00
parent 148d4a914d
commit a795eeee4c
2 changed files with 5 additions and 2 deletions

View File

@ -36,6 +36,9 @@ def add_attachment(attachment):
elif attachment["type"] == "video": elif attachment["type"] == "video":
msg = u"{0}".format(attachment["video"]["title"],) msg = u"{0}".format(attachment["video"]["title"],)
tpe = _(u"Video") tpe = _(u"Video")
elif attachment["type"] == "audio":
msg = u"{0}".format(" ".join(session.compose_audio(attachment["audio"])))
tpe = _(u"Audio")
return [tpe, msg] return [tpe, msg]
def get_message(status): def get_message(status):

View File

@ -118,11 +118,11 @@ def compose_status(status, session):
message = "no description available" message = "no description available"
return [user, message, created_at] return [user, message, created_at]
def compose_audio(audio, session): def compose_audio(audio, session=None):
if audio == False: return [_(u"Audio removed from library"), "", ""] if audio == False: return [_(u"Audio removed from library"), "", ""]
return [audio["title"], audio["artist"], utils.seconds_to_string(audio["duration"])] return [audio["title"], audio["artist"], utils.seconds_to_string(audio["duration"])]
def compose_video(video, session): def compose_video(video, session=None):
if video == False: return [_(u"Audio removed from library"), "", ""] if video == False: return [_(u"Audio removed from library"), "", ""]
return [video["title"], utils.seconds_to_string(video["duration"])] return [video["title"], utils.seconds_to_string(video["duration"])]