refactoring
[mygpo.git] / mygpo / urls.py
blob6aa84365f2d421b6d551c367de82d6b91a9b9216
2 # This file is part of my.gpodder.org.
4 # my.gpodder.org is free software: you can redistribute it and/or modify it
5 # under the terms of the GNU Affero General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or (at your
7 # option) any later version.
9 # my.gpodder.org is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
12 # License for more details.
14 # You should have received a copy of the GNU Affero General Public License
15 # along with my.gpodder.org. If not, see <http://www.gnu.org/licenses/>.
19 import os.path
20 from django.conf.urls.defaults import *
21 from registration.views import activate, register
22 from registration.forms import RegistrationFormUniqueEmail
23 from django.contrib.auth.views import logout
26 # Uncomment the next two lines to enable the admin:
27 from django.contrib import admin
28 admin.autodiscover()
30 urlpatterns = patterns('',
31 # Example:
32 # (r'^mygpo/', include('mygpo.foo.urls')),
33 (r'^$', 'mygpo.web.views.home'),
34 (r'^media/logo/(?P<size>\d+)/(?P<filename>[^/]*)\.jpg$', 'mygpo.web.views.cover_art'),
35 (r'^logo/(?P<size>\d+)/(?P<filename>[^/]*)\.jpg$', 'mygpo.web.views.cover_art'),
36 (r'^subscriptions/$', 'mygpo.web.views.subscriptions'),
37 (r'^download/subscriptions\.opml$', 'mygpo.web.views.all_subscriptions_download'),
38 (r'^subscriptions/all.opml$', 'mygpo.web.views.all_subscriptions_download'),
39 (r'^login/$', 'mygpo.web.users.login_user'),
40 (r'^logout/$', logout, {'next_page': '/'}),
41 (r'^migrate/$', 'mygpo.web.users.migrate_user'),
42 (r'^register/resend-activation$', 'mygpo.web.views.resend_activation'),
43 (r'^register/restore_password$', 'mygpo.web.users.restore_password'),
44 (r'^register/$', register, {'backend': 'registration.backends.default.DefaultBackend', 'form_class': RegistrationFormUniqueEmail}),
45 (r'^registration_complete/$', 'django.views.generic.simple.direct_to_template', {'template': 'registration/registration_complete.html'}),
46 (r'^activate/(?P<activation_key>\w+)$', activate, {'backend': 'registration.backends.default.DefaultBackend'}),
48 (r'^podcast/(?P<pid>\w+)$', 'mygpo.web.views.podcast'),
49 (r'^podcast/(?P<pid>\w+)/subscribe$', 'mygpo.web.views.podcast_subscribe'),
50 (r'^podcast/(?P<pid>\w+)/unsubscribe/(?P<device_id>\d+)', 'mygpo.web.views.podcast_unsubscribe'),
52 (r'^episode/(?P<id>\d+)$', 'mygpo.web.views.episode.episode'),
53 (r'^episode/(?P<id>\d+)/add-chapter$', 'mygpo.web.views.episode.add_chapter'),
54 (r'^episode/(?P<id>\d+)/remove-chapter/(?P<chapter_id>\d+)$', 'mygpo.web.views.episode.remove_chapter'),
55 (r'^episode/(?P<id>\d+)/toggle-favorite', 'mygpo.web.views.episode.toggle_favorite'),
57 (r'^favorites/', 'mygpo.web.views.episode.list_favorites'),
59 (r'account/$', 'mygpo.web.views.settings.account'),
60 (r'account/privacy$', 'mygpo.web.views.settings.privacy'),
61 (r'account/delete$', 'mygpo.web.views.settings.delete_account'),
62 (r'share/$', 'mygpo.web.views.settings.share'),
64 (r'user/(?P<username>\w+)/subscriptions$', 'mygpo.web.views.user_subscriptions'),
65 (r'user/(?P<username>\w+)/subscriptions\.opml$', 'mygpo.web.views.user_subscriptions_opml'),
66 (r'user/(?P<username>\w+)/favorites.xml$', 'mygpo.userfeeds.views.favorite_feed'),
68 (r'^history/$', 'mygpo.web.views.history'),
70 (r'^directory/$', 'mygpo.web.views.public.browse'),
71 (r'^directory/(?P<category>[^/]+)$', 'mygpo.web.views.public.category'),
73 (r'^toplist/$', 'mygpo.web.views.toplist'),
74 (r'^toplist/episodes$', 'mygpo.web.views.episode_toplist'),
75 (r'^toplist.opml$', 'mygpo.api.simple.toplist', {'count': 50, 'format': 'opml'}),
77 (r'^gpodder-examples.opml$', 'mygpo.web.views.gpodder_example_podcasts'),
79 (r'^suggestions/$', 'mygpo.web.views.suggestions'),
81 (r'^devices/$', 'mygpo.web.views.device.overview'),
82 (r'^device/(?P<device_id>\d+)$', 'mygpo.web.views.device.show'),
83 (r'^device/(?P<device_id>\d+).opml$', 'mygpo.web.views.device.opml'),
84 (r'^device/(?P<device_id>\d+)/sync$', 'mygpo.web.views.device.sync'),
85 (r'^device/(?P<device_id>\d+)/unsync$', 'mygpo.web.views.device.unsync'),
86 (r'^device/(?P<device_id>\d+)/delete$', 'mygpo.web.views.device.delete'),
87 (r'^device/(?P<device_id>\d+)/undelete$', 'mygpo.web.views.device.undelete'),
88 (r'^device/(?P<device_id>\d+)/history$', 'mygpo.web.views.history'),
89 (r'^device/(?P<device_id>\d+)/edit$', 'mygpo.web.views.device.edit'),
91 (r'^search/', 'mygpo.search.views.search'),
93 #Legacy API
94 (r'^upload$', 'mygpo.api.legacy.upload'),
95 (r'^getlist$', 'mygpo.api.legacy.getlist'),
97 #Simple API
98 (r'^subscriptions/(?P<username>\w+)/(?P<device_uid>[\w.-]+)\.(?P<format>\w+)', 'mygpo.api.simple.subscriptions'),
99 (r'^subscriptions/(?P<username>\w+)\.(?P<format>\w+)', 'mygpo.api.simple.all_subscriptions'),
100 (r'^toplist/(?P<count>\d+)\.(?P<format>\w+)', 'mygpo.api.simple.toplist'),
101 (r'^search\.(?P<format>\w+)', 'mygpo.api.simple.search'),
102 (r'^suggestions/(?P<count>\d+)\.(?P<format>\w+)', 'mygpo.api.simple.suggestions'),
104 #Advanced API
105 (r'^api/[12]/subscriptions/(?P<username>\w+)/(?P<device_uid>[\w.-]+)\.json', 'mygpo.api.advanced.subscriptions'),
106 (r'^api/(?P<version>[12])/episodes/(?P<username>\w+)\.json', 'mygpo.api.advanced.episodes'),
107 (r'^api/[12]/devices/(?P<username>\w+)/(?P<device_uid>[\w.-]+)\.json', 'mygpo.api.advanced.device'),
108 (r'^api/[12]/devices/(?P<username>\w+)\.json', 'mygpo.api.advanced.devices'),
110 (r'^api/2/auth/(?P<username>\w+)/(?P<device_uid>[\w.-]+)/login\.json', 'mygpo.api.advanced.auth.login'),
111 (r'^api/2/auth/(?P<username>\w+)/(?P<device_uid>[\w.-]+)/logout\.json', 'mygpo.api.advanced.auth.logout'),
112 (r'^api/2/auth/(?P<username>\w+)/(?P<device_uid>[\w.-]+)/validate\.json', 'mygpo.api.advanced.auth.validate'),
114 (r'^api/2/chapters/(?P<username>\w+)\.json', 'mygpo.api.advanced.episode.chapters'),
116 #Subscribe with my.gpodder.org
117 (r'^subscribe', 'mygpo.web.views.podcast_subscribe_url'),
120 (r'^online-help', 'django.views.generic.simple.direct_to_template', {'template': 'online-help.html'}),
122 # Uncomment the admin/doc line below and add 'django.contrib.admindocs'
123 # to INSTALLED_APPS to enable admin documentation:
124 # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
126 # Uncomment the next line to enable the admin:
127 (r'^admin/(.*)', admin.site.root),
129 (r'^accounts/', include('registration.urls')),
131 (r'^publisher/$', 'mygpo.publisher.views.home'),
132 (r'^publisher/(?P<username>\w+)/update', 'mygpo.publisher.views.update_published_podcasts'),
133 (r'^publisher/podcast/(?P<id>\d+)$', 'mygpo.publisher.views.podcast'),
134 (r'^publisher/podcast/(?P<id>\d+)/update$', 'mygpo.publisher.views.update_podcast'),
135 (r'^publisher/podcast/(?P<id>\d+)/episodes$', 'mygpo.publisher.views.episodes'),
136 (r'^publisher/episode/(?P<id>\d+)$', 'mygpo.publisher.views.episode'),
137 (r'^publisher/podcast/search$', 'mygpo.publisher.views.search_podcast'),
138 (r'^publisher/group/(?P<group_id>\d+)$', 'mygpo.publisher.views.group'),
140 (r'^publisher/link/$', 'mygpo.publisher.views.link'),
141 (r'^publisher/advertise', 'mygpo.publisher.views.advertise'),
143 #Subscribe with my.gpodder.org
144 (r'^subscribe', 'mygpo.web.views.podcast_subscribe_url'),
145 #(r'^authors/$', 'mygpo.web.views.author'),
148 (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': os.path.abspath('%s/../htdocs/media/' % os.path.dirname(__file__))}),