source: telemeta/urls.py @ 5889b86

cremcrem2crem3devdev2diademsdj1.6feature/breadcrumbsfeature/ts-0.5feature/ts-0.5.4feature/writecacheformagenericinstru_searchlamlam2mapsv3mergenlivemultiprobproductionrelease/1.4.4sabiodsearchsecurityserversocialstoragetelecastertestvideo
Last change on this file since 5889b86 was 5889b86, checked in by olivier <>, 5 years ago

reduce geo navigator loading time, counting related resources on demand ; display both collections and items count in gmap info boxes

  • Property mode set to 100644
File size: 7.7 KB
Line 
1# -*- coding: utf-8 -*-
2# Copyright (C) 2007 Samalyse SARL
3#
4# Copyright (c) 2007-2009 Guillaume Pellerin <yomguy@parisson.com>
5
6# This software is a computer program whose purpose is to backup, analyse,
7# transcode and stream any audio content with its metadata over a web frontend.
8
9# This software is governed by the CeCILL  license under French law and
10# abiding by the rules of distribution of free software.  You can  use,
11# modify and/ or redistribute the software under the terms of the CeCILL
12# license as circulated by CEA, CNRS and INRIA at the following URL
13# "http://www.cecill.info".
14
15# As a counterpart to the access to the source code and  rights to copy,
16# modify and redistribute granted by the license, users are provided only
17# with a limited warranty  and the software's author,  the holder of the
18# economic rights,  and the successive licensors  have only  limited
19# liability.
20
21# In this respect, the user's attention is drawn to the risks associated
22# with loading,  using,  modifying and/or developing or reproducing the
23# software by the user in light of its specific status of free software,
24# that may mean  that it is complicated to manipulate,  and  that  also
25# therefore means  that it is reserved for developers  and  experienced
26# professionals having in-depth computer knowledge. Users are therefore
27# encouraged to load and test the software's suitability as regards their
28# requirements in conditions enabling the security of their systems and/or
29# data to be ensured and,  more generally, to use and operate it in the
30# same conditions as regards security.
31
32# The fact that you are presently reading this means that you have had
33# knowledge of the CeCILL license and that you accept its terms.
34#
35# Author: Olivier Guilyardi <olivier@samalyse.com>
36
37from django.conf.urls.defaults import *
38from telemeta.models import MediaItem, MediaCollection
39from telemeta.core import ComponentManager
40from telemeta.web import WebView
41import os.path
42import telemeta.config
43
44telemeta.config.check()
45
46# initialization
47comp_mgr = ComponentManager()
48web_view = WebView(comp_mgr)
49
50# query sets for Django generic views
51all_items = { 'queryset': MediaItem.objects.all(), }
52all_collections = { 'queryset': MediaCollection.objects.all(), }
53
54# ID's regular expressions
55export_extensions = "|".join(web_view.list_export_extensions())
56
57htdocs = os.path.dirname(__file__) + '/htdocs'
58
59urlpatterns = patterns('',
60    url(r'^$', web_view.index, name="telemeta-home"),
61
62    # items
63    url(r'^items/$', 'django.views.generic.list_detail.object_list', 
64        dict(all_items, paginate_by=20, template_name="telemeta/mediaitem_list.html"),
65        name="telemeta-items"),
66    url(r'^items/(?P<public_id>[A-Z0-9_]+)/$', web_view.item_detail, 
67        name="telemeta-item-detail"),
68    url(r'^items/(?P<public_id>[A-Z0-9_]+)/dc/$', web_view.item_detail, 
69        {'template': 'telemeta/mediaitem_detail_dc.html'},
70        name="telemeta-item-dublincore"),
71    url(r'^items/(?P<public_id>[A-Z0-9_]+)/dc/xml/$', web_view.item_detail, 
72        {'format': 'dublin_core_xml'},
73        name="telemeta-item-dublincore-xml"),
74    url(r'^items/download/(?P<public_id>[A-Z0-9_]+)\.(?P<extension>' 
75            + export_extensions + ')$', 
76        web_view.item_export,
77        name="telemeta-item-export"),
78    url(r'^items/(?P<public_id>[A-Z0-9_]+)/visualize/(?P<visualizer_id>[0-9a-z_]+)/(?P<width>[0-9A-Z]+)x(?P<height>[0-9A-Z]+)/$', 
79        web_view.item_visualize,
80        name="telemeta-item-visualize"),
81    url(r'^items/(?P<public_id>[A-Z0-9_]+)/item_xspf.xml$', 
82        web_view.item_playlist, 
83        dict(template="telemeta/mediaitem_xspf.xml", mimetype="application/xspf+xml"),
84        name="telemeta-item-xspf"),
85
86    # collections
87    url(r'^collections/$', 'django.views.generic.list_detail.object_list',
88        dict(all_collections, paginate_by=20, 
89            template_name="telemeta/collection_list.html"),
90        name="telemeta-collections"),
91    url(r'^collections/?page=(?P<page>[0-9]+)$', 
92        'django.views.generic.list_detail.object_list',
93        dict(all_collections, paginate_by=20)),
94    url(r'^collections/(?P<public_id>[A-Z0-9_]+)/$', web_view.collection_detail,
95        dict(template="telemeta/collection_detail.html"), name="telemeta-collection-detail"),
96    url(r'^collections/(?P<public_id>[A-Z0-9_]+)/dc/$', web_view.collection_detail,
97        dict(template="telemeta/collection_detail_dc.html"), name="telemeta-collection-dublincore"),
98    url(r'^collections/(?P<public_id>[A-Z0-9_]+)/collection_xspf.xml$', 
99        web_view.collection_playlist, 
100        dict(template="telemeta/collection_xspf.xml", mimetype="application/xspf+xml"),
101        name="telemeta-collection-xspf"),
102    url(r'^collections/(?P<public_id>[A-Z0-9_]+)/collection.m3u$',
103        web_view.collection_playlist, 
104        dict(template="telemeta/collection.m3u", mimetype="audio/mpegurl"),
105        name="telemeta-collection-m3u"),
106
107    # search
108    url(r'^search/$', web_view.search, name="telemeta-search"),
109    url(r'^search/collections/$', web_view.search, {'type': 'collections'}, 
110        name="telemeta-search-collections"),
111    url(r'^search/items/$', web_view.search, {'type': 'items'}, 
112        name="telemeta-search-items"),
113    url(r'^search/criteria/$', web_view.edit_search, name="telemeta-search-criteria"),
114
115    # administration       
116    url(r'^admin/$', web_view.admin_index, name="telemeta-admin"),       
117
118    # enumerations administration
119    url(r'^admin/enumerations/(?P<enumeration_id>[0-9a-z]+)/$', 
120        web_view.edit_enumeration ,
121        name="telemeta-enumeration-edit"),       
122    url(r'^admin/enumerations/(?P<enumeration_id>[0-9a-z]+)/add/$', 
123        web_view.add_to_enumeration,
124        name="telemeta-enumeration-add"),       
125    url(r'^admin/enumerations/(?P<enumeration_id>[0-9a-z]+)/update/$', 
126        web_view.update_enumeration,
127        name="telemeta-enumeration-update"),       
128    url(r'^admin/enumerations/(?P<enumeration_id>[0-9a-z]+)/'
129        + r'(?P<value_id>[0-9]+)/$',
130        web_view.edit_enumeration_value,
131        name="telemeta-enumeration-record-edit"),   
132    url(r'^admin/enumerations/(?P<enumeration_id>[0-9a-z]+)/'
133        + r'(?P<value_id>[0-9]+)/update/$',
134        web_view.update_enumeration_value, 
135        name="telemeta-enumeration-record-update"),   
136
137    # Geographic browsing
138    url(r'^geo/$', web_view.list_continents, name="telemeta-geo-continents"),
139    url(r'^geo/(?P<continent>[a-z_]+)/$', web_view.list_countries, 
140        name="telemeta-geo-countries"),
141    url(r'^geo/collections/(?P<continent>[a-z_]+)/(?P<country>[a-z_]+)/$', 
142        web_view.list_country_collections, 
143        name="telemeta-geo-country-collections"),
144    url(r'^geo/items/(?P<continent>[a-z_]+)/(?P<country>[a-z_]+)/$', 
145        web_view.list_country_items, 
146        name="telemeta-geo-country-items"),
147    url(r'^dynjs/continents.js$', web_view.get_continents_js, name="telemeta-continents-js"),
148    url(r'^geo/country_info/(?P<id>[0-9A-Z]+)/$', 
149        web_view.country_info, name="telemeta-country-info"),
150
151    # CSS+Images (FIXME: for developement only)
152    url(r'^css/(?P<path>.*)$', 'django.views.static.serve', 
153        {'document_root': htdocs+'/css'},
154        name="telemeta-css"),
155    url(r'^images/(?P<path>.*)$', 'django.views.static.serve', 
156        {'document_root': htdocs+'/images'},
157        name="telemeta-images"),
158    url(r'^js/(?P<path>.*)$', 'django.views.static.serve', 
159        {'document_root': htdocs+'/js'},
160        name="telemeta-js"),
161    url(r'^swf/(?P<path>.*)$', 'django.views.static.serve', 
162        {'document_root': htdocs+'/swf'},
163        name="telemeta-swf"),
164    url(r'^timeside/(?P<path>.*)$', 'django.views.static.serve', 
165        {'document_root': htdocs+'/timeside'},
166        name="telemeta-timeside"),
167
168    # OAI-PMH Data Provider
169    url(r'^oai/.*$', web_view.handle_oai_request, name="telemeta-oai")
170)
Note: See TracBrowser for help on using the repository browser.