+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 collection(request, slug):
+ coll = get_object_or_404(models.Collection, slug=slug)
+ slugs = coll.book_slugs.split()
+ # allow URIs
+ slugs = [slug.rstrip('/').rsplit('/', 1)[-1] if '/' in slug else slug
+ for slug in slugs]
+ return book_list(request, Q(slug__in=slugs),
+ template_name='catalogue/collection.html',
+ context={'collection': coll})
+
+
+def differentiate_tags(request, tags, ambiguous_slugs):
+ beginning = '/'.join(tag.url_chunk for tag in tags)
+ unparsed = '/'.join(ambiguous_slugs[1:])
+ options = []
+ for tag in models.Tag.objects.exclude(category='book').filter(slug=ambiguous_slugs[0]):
+ options.append({
+ 'url_args': '/'.join((beginning, tag.url_chunk, unparsed)).strip('/'),
+ 'tags': [tag]
+ })
+ return render_to_response('catalogue/differentiate_tags.html',
+ {'tags': tags, 'options': options, 'unparsed': ambiguous_slugs[1:]},
+ context_instance=RequestContext(request))
+
+