new python-ox api

This commit is contained in:
j 2012-08-15 17:15:06 +02:00
parent f0c800cb5b
commit 189d0ac249
2 changed files with 15 additions and 4 deletions

View file

@ -1005,7 +1005,7 @@ class Item(models.Model):
'url-list': url, 'url-list': url,
} }
if duration: 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 #slightly bigger torrent file but better for streaming
piece_size_pow2 = 15 #1 mbps -> 32KB pieces piece_size_pow2 = 15 #1 mbps -> 32KB pieces
@ -1101,7 +1101,7 @@ class Item(models.Model):
poster = self.make_siteposter() poster = self.make_siteposter()
url = self.prefered_poster_url() url = self.prefered_poster_url()
if url: if url:
data = ox.net.readUrl(url) data = ox.net.read_url(url)
self.save_poster(data) self.save_poster(data)
elif os.path.exists(poster): elif os.path.exists(poster):
with open(poster) as f: with open(poster) as f:

View file

@ -97,6 +97,17 @@ def parse_query(data, user):
def find(request): def find(request):
''' '''
Example:
find({
query:{
conditions:[{ key: '*', value: 'paris', operator: '='}],
operator:'&'
},
keys: ['title', 'id'],
range: [0, 10],
sort: [{key: 'title', operator: '+'}]
})
param data { param data {
'query': query, 'query': query,
'sort': array, '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) response = HttpResponse(extract.chop(path, t[0], t[1]), content_type=content_type)
filename = u"Clip of %s - %s-%s - %s %s%s" % ( filename = u"Clip of %s - %s-%s - %s %s%s" % (
item.get('title'), item.get('title'),
ox.formatDuration(t[0] * 1000).replace(':', '.')[:-4], ox.format_duration(t[0] * 1000).replace(':', '.')[:-4],
ox.formatDuration(t[1] * 1000).replace(':', '.')[:-4], ox.format_duration(t[1] * 1000).replace(':', '.')[:-4],
settings.SITENAME, settings.SITENAME,
item.itemId, item.itemId,
ext ext