+def audiobook_list(request):
+ return book_list(request, Q(media__type='mp3') | Q(media__type='ogg'),
+ template_name='catalogue/audiobook_list.html')
+
+
+def daisy_list(request):
+ return book_list(request, Q(media__type='daisy'),
+ template_name='catalogue/daisy_list.html')
+
+
+def counters(request):
+ form = forms.SearchForm()
+
+ books = models.Book.objects.count()
+ books_nonempty = models.Book.objects.exclude(html_file='').count()
+ books_empty = models.Book.objects.filter(html_file='').count()
+ books_root = models.Book.objects.filter(parent=None).count()
+
+ media = models.BookMedia.objects.count()
+ media_types = models.BookMedia.objects.values('type').\
+ annotate(count=Count('type')).\
+ order_by('type')
+ for mt in media_types:
+ size = 0
+ deprecated = missing_project = 0
+ for b in models.BookMedia.objects.filter(type=mt['type']):
+ size += b.file.size
+ if b.type in ('mp3', 'ogg'):
+ if not b.source_sha1:
+ deprecated += 1
+ if not 'project' in b.get_extra_info_value():
+ missing_project += 1
+ mt['size'] = size
+ mt['deprecated'] = deprecated
+ mt['missing_project'] = missing_project
+
+ return render_to_response('catalogue/counters.html',
+ locals(), context_instance=RequestContext(request))
+
+