1 # -*- coding: utf-8 -*-
2 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 from django.conf.urls import url
6 from django.db.models import Max
7 from django.views.generic import ListView, RedirectView
8 from catalogue.feeds import AudiobookFeed
9 from catalogue.models import Book
10 from catalogue import views
17 url(r'^obraz/strona/$', picture.views.picture_page, name='picture_page'),
18 # pictures - currently pictures are coupled with catalogue, hence the url is here
19 url(r'^obraz/$', picture.views.picture_list_thumb, name='picture_list_thumb'),
20 url(r'^obraz/(?P<slug>%s).html$' % SLUG, picture.views.picture_viewer, name='picture_viewer'),
21 url(r'^obraz/(?P<slug>%s)/$' % SLUG, picture.views.picture_detail, name='picture_detail'),
23 # old search page - redirected
24 url(r'^szukaj/$', RedirectView.as_view(
25 url='/szukaj/', query_string=True, permanent=True)),
27 url(r'^$', views.catalogue, name='catalogue'),
29 url(r'^autor/$', views.tag_catalogue, {'category': 'author'}, name='author_catalogue'),
30 url(r'^epoka/$', views.tag_catalogue, {'category': 'epoch'}, name='epoch_catalogue'),
31 url(r'^gatunek/$', views.tag_catalogue, {'category': 'genre'}, name='genre_catalogue'),
32 url(r'^rodzaj/$', views.tag_catalogue, {'category': 'kind'}, name='kind_catalogue'),
33 url(r'^motyw/$', views.tag_catalogue, {'category': 'theme'}, name='theme_catalogue'),
35 url(r'^galeria/$', views.gallery, name='gallery'),
36 url(r'^kolekcje/$', views.collections, name='catalogue_collections'),
38 url(r'^lektury/$', views.literature, name='book_list'),
39 url(r'^lektury/(?P<slug>[a-zA-Z0-9-]+)/$', views.collection, name='collection'),
40 url(r'^audiobooki/$', views.audiobooks, name='audiobook_list'),
41 url(r'^daisy/$', views.daisy_list, name='daisy_list'),
42 url(r'^nowe/$', ListView.as_view(
43 queryset=Book.objects.filter(parent=None).order_by('-created_at'),
44 template_name='catalogue/recent_list.html'), name='recent_list'),
45 url(r'^nowe/audiobooki/$', ListView.as_view(
46 queryset=Book.objects.filter(media__type='ogg').annotate(m=Max('media__uploaded_at')).order_by('-m'),
47 template_name='catalogue/recent_audiobooks_list.html'), name='recent_audiobooks_list'),
48 url(r'^nowe/daisy/$', ListView.as_view(
49 queryset=Book.objects.filter(media__type='daisy').annotate(m=Max('media__uploaded_at')).order_by('-m'),
50 template_name='catalogue/recent_daisy_list.html'), name='recent_daisy_list'),
52 url(r'^custompdf/(?P<slug>%s)/$' % SLUG, views.CustomPDFFormView(), name='custom_pdf_form'),
54 url(r'^audiobooki/(?P<type>mp3|ogg|daisy|all).xml$', AudiobookFeed(), name='audiobook_feed'),
56 url(r'^pobierz/(?P<key>.*)/(?P<slug>%s).(?P<format_>[a-z0-9]*)$' % SLUG, views.embargo_link, name='embargo_link'),
59 url(r'^zip/pdf\.zip$', views.download_zip, {'format': 'pdf', 'slug': None}, 'download_zip_pdf'),
60 url(r'^zip/epub\.zip$', views.download_zip, {'format': 'epub', 'slug': None}, 'download_zip_epub'),
61 url(r'^zip/mobi\.zip$', views.download_zip, {'format': 'mobi', 'slug': None}, 'download_zip_mobi'),
62 url(r'^zip/mp3/(?P<slug>%s)\.zip' % SLUG, views.download_zip, {'format': 'mp3'}, 'download_zip_mp3'),
63 url(r'^zip/ogg/(?P<slug>%s)\.zip' % SLUG, views.download_zip, {'format': 'ogg'}, 'download_zip_ogg'),
65 # Public interface. Do not change this URLs.
66 url(r'^lektura/(?P<slug>%s)\.html$' % SLUG, views.book_text, name='book_text'),
67 url(r'^lektura/(?P<slug>%s)/audiobook/$' % SLUG, views.player, name='book_player'),
68 url(r'^lektura/(?P<slug>%s)/$' % SLUG, views.book_detail, name='book_detail'),
69 url(r'^lektura/(?P<slug>%s)/motyw/(?P<theme_slug>[a-zA-Z0-9-]+)/$' % SLUG,
70 views.book_fragments, name='book_fragments'),
72 url(r'^okladka-ridero/(?P<slug>%s).png$' % SLUG, views.ridero_cover),
73 url(r'^isbn/(?P<book_format>(pdf|epub|mobi|txt|html))/(?P<slug>%s)/' % SLUG, views.get_isbn),
75 # This should be the last pattern.
76 url(r'^galeria/(?P<tags>[a-zA-Z0-9-/]*)/$', views.tagged_object_list, {'list_type': 'gallery'},
77 name='tagged_object_list_gallery'),
78 url(r'^audiobooki/(?P<tags>[a-zA-Z0-9-/]*)/$', views.tagged_object_list, {'list_type': 'audiobooks'},
79 name='tagged_object_list_audiobooks'),
80 url(r'^(?P<tags>[a-zA-Z0-9-/]*)/$', views.tagged_object_list, {'list_type': 'books'},
81 name='tagged_object_list'),