From a795eeee4cf8ae0b96e3ef236731971b91e5f0aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Mon, 4 Apr 2016 03:40:42 -0500 Subject: [PATCH] Shows audio in the attachments list --- src/controller/posts.py | 3 +++ src/sessionmanager/session.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/controller/posts.py b/src/controller/posts.py index a824d7f..8573986 100644 --- a/src/controller/posts.py +++ b/src/controller/posts.py @@ -36,6 +36,9 @@ def add_attachment(attachment): elif attachment["type"] == "video": msg = u"{0}".format(attachment["video"]["title"],) tpe = _(u"Video") + elif attachment["type"] == "audio": + msg = u"{0}".format(" ".join(session.compose_audio(attachment["audio"]))) + tpe = _(u"Audio") return [tpe, msg] def get_message(status): diff --git a/src/sessionmanager/session.py b/src/sessionmanager/session.py index 97b6954..beba580 100644 --- a/src/sessionmanager/session.py +++ b/src/sessionmanager/session.py @@ -118,11 +118,11 @@ def compose_status(status, session): message = "no description available" 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"), "", ""] 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"), "", ""] return [video["title"], utils.seconds_to_string(video["duration"])]