From 189d0ac249db93b4f203a1f6c2b7ef9ca1070226 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 15 Aug 2012 17:15:06 +0200 Subject: [PATCH] new python-ox api --- pandora/item/models.py | 4 ++-- pandora/item/views.py | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/pandora/item/models.py b/pandora/item/models.py index 78d4382a1..f890d4f82 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -1005,7 +1005,7 @@ class Item(models.Model): 'url-list': url, } if duration: - meta['playtime'] = ox.formatDuration(duration*1000)[:-4] + meta['playtime'] = ox.format_duration(duration*1000)[:-4] #slightly bigger torrent file but better for streaming piece_size_pow2 = 15 #1 mbps -> 32KB pieces @@ -1101,7 +1101,7 @@ class Item(models.Model): poster = self.make_siteposter() url = self.prefered_poster_url() if url: - data = ox.net.readUrl(url) + data = ox.net.read_url(url) self.save_poster(data) elif os.path.exists(poster): with open(poster) as f: diff --git a/pandora/item/views.py b/pandora/item/views.py index b3bd88789..ca2ce8743 100644 --- a/pandora/item/views.py +++ b/pandora/item/views.py @@ -97,6 +97,17 @@ def parse_query(data, user): def find(request): ''' + Example: + find({ + query:{ + conditions:[{ key: '*', value: 'paris', operator: '='}], + operator:'&' + }, + keys: ['title', 'id'], + range: [0, 10], + sort: [{key: 'title', operator: '+'}] + }) + param data { 'query': query, 'sort': array, @@ -793,8 +804,8 @@ def video(request, id, resolution, format, index=None): response = HttpResponse(extract.chop(path, t[0], t[1]), content_type=content_type) filename = u"Clip of %s - %s-%s - %s %s%s" % ( item.get('title'), - ox.formatDuration(t[0] * 1000).replace(':', '.')[:-4], - ox.formatDuration(t[1] * 1000).replace(':', '.')[:-4], + ox.format_duration(t[0] * 1000).replace(':', '.')[:-4], + ox.format_duration(t[1] * 1000).replace(':', '.')[:-4], settings.SITENAME, item.itemId, ext