better presentation

This commit is contained in:
Christophe Benz 2010-04-27 12:24:07 +02:00 committed by Romain Bignon
commit c272634a14
2 changed files with 13 additions and 3 deletions

View file

@ -75,8 +75,11 @@ class VideoobWeb(BaseApplication):
c['results'] = {}
if q:
for backend in self.weboob.iter_backends():
items = [(video.id, video.title, video.formatted_duration) for video in
backend.iter_search_results(pattern=q, nsfw=nsfw)]
items = [dict(title=video.title,
page_url=video.page_url,
url=video.url if video.url else '/download?id=%s' % video.id
) \
for video in backend.iter_search_results(pattern=q, nsfw=nsfw)]
if items:
c['results'][backend.name] = items
template = template_lookup.get_template('index.mako')

View file

@ -14,7 +14,14 @@
<div id="results">
% for backend, items in results.iteritems():
<h2>${backend}</h2>
${items}
<ul>
% for item in items:
<li>
<a href="${item['page_url']}">${item['title']}</a>
## (<a href="${item['url']}"><em>download</em></a>)
</li>
% endfor
</ul>
% endfor
</div>
</%def>