From 22bc00a3c040bc06f9149eb99573dc8a1114aabd Mon Sep 17 00:00:00 2001 From: Leif Johansson Date: Fri, 13 May 2011 23:31:52 +0200 Subject: add recordings and some minor cleanup --- src/meetingtools/apps/cluster/models.py | 5 ++++- src/meetingtools/apps/room/views.py | 25 ++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) (limited to 'src/meetingtools/apps') diff --git a/src/meetingtools/apps/cluster/models.py b/src/meetingtools/apps/cluster/models.py index 7dba80e..9921dd4 100644 --- a/src/meetingtools/apps/cluster/models.py +++ b/src/meetingtools/apps/cluster/models.py @@ -16,4 +16,7 @@ class ACCluster(models.Model): domain_match = TextField() def __unicode__(self): - return self.url \ No newline at end of file + return self.url + + def make_url(self,path=""): + return "%s%s" % (self.url,path) \ No newline at end of file diff --git a/src/meetingtools/apps/room/views.py b/src/meetingtools/apps/room/views.py index 97a487c..b0297cd 100644 --- a/src/meetingtools/apps/room/views.py +++ b/src/meetingtools/apps/room/views.py @@ -440,4 +440,27 @@ def tag(request,rid): else: form = TagRoomForm() - return respond_to(request, {'text/html': "apps/room/tag.html"}, {'form': form,'formtitle': 'Add Tag','cancelname':'Done','submitname': 'Add Tag','room': room, 'tags': Tag.objects.get_for_object(room)}) \ No newline at end of file + return respond_to(request, + {'text/html': "apps/room/tag.html"}, + {'form': form,'formtitle': 'Add Tag','cancelname':'Done','submitname': 'Add Tag','room': room, 'tags': Tag.objects.get_for_object(room)}) + + +from time import mktime +from feedparser import _parse_date as parse_date + +@login_required +def recordings(request,rid): + room = get_object_or_404(Room,pk=rid) + api = ac_api_client(request, room.acc) + + r = api.request('sco-expanded-contents',{'sco-id': room.sco_id,'filter-icon':'archive'},True) + recordings = [{'name': sco.findtext('name'), + 'sco_id': sco.get('sco-id'), + 'url': room.acc.make_url(sco.findtext('url-path')), + 'description': sco.findtext('description'), + 'date_created': datetime.fromtimestamp(mktime(parse_date(sco.findtext('date-created')))), + 'date_modified': datetime.fromtimestamp(mktime(parse_date(sco.findtext('date-modified'))))} for sco in r.et.findall(".//sco")] + + return respond_to(request, + {'text/html': 'apps/room/recordings.html'}, + {'recordings': recordings,'room':room}) \ No newline at end of file -- cgit v1.1