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 url(r'^p/(?P<pk>\d+)/short\.(?P<lang>.+)\.html', picture.views.picture_short, name='picture_short'),
24 url(r'^pa/(?P<pk>\d+)/short\.(?P<lang>.+)\.html', picture.views.picturearea_short, name='picture_area_short'),
26 # old search page - redirected
27 url(r'^szukaj/$', RedirectView.as_view(
28 url='/szukaj/', query_string=True, permanent=True)),
30 url(r'^$', views.catalogue, name='catalogue'),
32 url(r'^autor/$', views.tag_catalogue, {'category': 'author'}, name='author_catalogue'),
33 url(r'^epoka/$', views.tag_catalogue, {'category': 'epoch'}, name='epoch_catalogue'),
34 url(r'^gatunek/$', views.tag_catalogue, {'category': 'genre'}, name='genre_catalogue'),
35 url(r'^rodzaj/$', views.tag_catalogue, {'category': 'kind'}, name='kind_catalogue'),
36 url(r'^motyw/$', views.tag_catalogue, {'category': 'theme'}, name='theme_catalogue'),
38 url(r'^galeria/$', views.gallery, name='gallery'),
39 url(r'^kolekcje/$', views.collections, name='catalogue_collections'),
41 url(r'^lektury/$', views.literature, name='book_list'),
42 url(r'^lektury/(?P<slug>[a-zA-Z0-9-]+)/$', views.collection, name='collection'),
43 url(r'^audiobooki/$', views.audiobooks, name='audiobook_list'),
44 url(r'^daisy/$', views.daisy_list, name='daisy_list'),
45 url(r'^nowe/$', ListView.as_view(
46 queryset=Book.objects.filter(parent=None).order_by('-created_at'),
47 template_name='catalogue/recent_list.html'), name='recent_list'),
48 url(r'^nowe/audiobooki/$', ListView.as_view(
49 queryset=Book.objects.filter(media__type='ogg').annotate(m=Max('media__uploaded_at')).order_by('-m'),
50 template_name='catalogue/recent_audiobooks_list.html'), name='recent_audiobooks_list'),
51 url(r'^nowe/daisy/$', ListView.as_view(
52 queryset=Book.objects.filter(media__type='daisy').annotate(m=Max('media__uploaded_at')).order_by('-m'),
53 template_name='catalogue/recent_daisy_list.html'), name='recent_daisy_list'),
55 url(r'^custompdf/(?P<slug>%s)/$' % SLUG, views.CustomPDFFormView(), name='custom_pdf_form'),
57 url(r'^audiobooki/(?P<type>mp3|ogg|daisy|all).xml$', AudiobookFeed(), name='audiobook_feed'),
59 url(r'^pobierz/(?P<key>.*)/(?P<slug>%s).(?P<format_>[a-z0-9]*)$' % SLUG, views.embargo_link, name='embargo_link'),
62 url(r'^zip/pdf\.zip$', views.download_zip, {'format': 'pdf', 'slug': None}, 'download_zip_pdf'),
63 url(r'^zip/epub\.zip$', views.download_zip, {'format': 'epub', 'slug': None}, 'download_zip_epub'),
64 url(r'^zip/mobi\.zip$', views.download_zip, {'format': 'mobi', 'slug': None}, 'download_zip_mobi'),
65 url(r'^zip/mp3/(?P<slug>%s)\.zip' % SLUG, views.download_zip, {'format': 'mp3'}, 'download_zip_mp3'),
66 url(r'^zip/ogg/(?P<slug>%s)\.zip' % SLUG, views.download_zip, {'format': 'ogg'}, 'download_zip_ogg'),
68 # Public interface. Do not change this URLs.
69 url(r'^lektura/(?P<slug>%s)\.html$' % SLUG, views.book_text, name='book_text'),
70 url(r'^lektura/(?P<slug>%s)/audiobook/$' % SLUG, views.player, name='book_player'),
71 url(r'^lektura/(?P<slug>%s)/$' % SLUG, views.book_detail, name='book_detail'),
72 url(r'^lektura/(?P<slug>%s)/motyw/(?P<theme_slug>[a-zA-Z0-9-]+)/$' % SLUG,
73 views.book_fragments, name='book_fragments'),
75 url(r'^okladka-ridero/(?P<slug>%s).png$' % SLUG, views.ridero_cover),
76 url(r'^isbn/(?P<book_format>(pdf|epub|mobi|txt|html))/(?P<slug>%s)/' % SLUG, views.get_isbn),
79 url(r'^b/(?P<pk>\d+)/short\.(?P<lang>.+)\.html', views.book_short, name='catalogue_book_short'),
80 url(r'^b/(?P<pk>\d+)/wide\.(?P<lang>.+)\.html', views.book_wide, name='catalogue_book_wide'),
81 url(r'^f/(?P<pk>\d+)/promo\.(?P<lang>.+)\.html', views.fragment_promo, name='catalogue_fragment_promo'),
82 url(r'^f/(?P<pk>\d+)/short\.(?P<lang>.+)\.html', views.fragment_short, name='catalogue_fragment_short'),
83 url(r'^t/(?P<pk>\d+)/box\.(?P<lang>.+)\.html', views.tag_box, name='catalogue_tag_box'),
84 url(r'^c/(?P<pk>.+)/box\.(?P<lang>.+)\.html', views.collection_box, name='catalogue_collection_box'),
86 # This should be the last pattern.
87 url(r'^galeria/(?P<tags>[a-zA-Z0-9-/]*)/$', views.tagged_object_list, {'list_type': 'gallery'},
88 name='tagged_object_list_gallery'),
89 url(r'^audiobooki/(?P<tags>[a-zA-Z0-9-/]*)/$', views.tagged_object_list, {'list_type': 'audiobooks'},
90 name='tagged_object_list_audiobooks'),
91 url(r'^(?P<tags>[a-zA-Z0-9-/]*)/$', views.tagged_object_list, {'list_type': 'books'},
92 name='tagged_object_list'),