1 from django
.conf
.urls
import *
2 from django
.contrib
.auth
.views
import logout
3 from django
.views
.generic
.base
import TemplateView
, RedirectView
5 from mygpo
.web
.logo
import CoverArt
8 urlpatterns
= patterns('mygpo.web.views',
9 url(r
'^$', 'home', name
='home'),
10 url(r
'^logo/(?P<size>\d+)/(?P<prefix>.{3})/(?P<filename>[^/]*)$', CoverArt
.as_view(), name
='logo'),
11 url(r
'^tags/', 'mytags', name
='tags'),
15 url
='http://gpoddernet.readthedocs.org/en/latest/user/index.html'),
19 TemplateView
.as_view(template_name
='developer.html')),
22 TemplateView
.as_view(template_name
='contribute.html'),
26 TemplateView
.as_view(template_name
='privacy_policy.html'),
27 name
='privacy-policy'),
31 urlpatterns
+= patterns('mygpo.web.views.subscriptions',
32 url(r
'^user/(?P<username>[\w.+-]+)/subscriptions$', 'for_user', name
='shared-subscriptions'),
33 url(r
'^user/(?P<username>[\w.+-]+)/subscriptions\.opml$', 'for_user_opml', name
='shared-subscriptions-opml'),
36 urlpatterns
+= patterns('mygpo.web.views.podcast',
37 url(r
'^subscribe', 'subscribe_url', name
='subscribe-by-url'),
39 # Podcast Views with UUIDs
40 url(r
'^podcast/(?P<podcast_id>[0-9a-f]{32})/?$',
44 url(r
'^podcast/(?P<podcast_id>[0-9a-f]{32})/subscribe$',
48 url(r
'^podcast/(?P<podcast_id>[0-9a-f]{32})/subscribe/\+all$',
50 name
='subscribe-all-id'),
52 url(r
'^podcast/(?P<podcast_id>[0-9a-f]{32})/unsubscribe/(?P<device_uid>[\w.-]+)',
54 name
='unsubscribe-id'),
56 url(r
'^podcast/(?P<podcast_id>[0-9a-f]{32})/unsubscribe/\+all$',
58 name
='unsubscribe-all-id'),
60 url(r
'^podcast/(?P<podcast_id>[0-9a-f]{32})/add-tag',
64 url(r
'^podcast/(?P<podcast_id>[0-9a-f]{32})/remove-tag',
66 name
='remove-tag-id'),
68 url(r
'^podcast/(?P<podcast_id>[0-9a-f]{32})/set-public',
70 name
='podcast-public-id',
71 kwargs
={'public': True}),
73 url(r
'^podcast/(?P<podcast_id>[0-9a-f]{32})/set-private',
75 name
='podcast-private-id',
76 kwargs
={'public': False}),
78 url(r
'^podcast/(?P<podcast_id>[0-9a-f]{32})/-episodes',
80 name
='podcast-all-episodes-id'),
82 url(r
'^podcast/(?P<podcast_id>[0-9a-f]{32})/-flattr',
84 name
='podcast-flattr-id'),
87 # Podcast Views with Slugs
88 url(r
'^podcast/(?P<slug>[\w-]+)/?$',
92 url(r
'^podcast/(?P<slug>[\w-]+)/subscribe$',
94 name
='subscribe-slug'),
96 url(r
'^podcast/(?P<slug>[\w-]+)/subscribe/\+all$',
98 name
='subscribe-all-slug'),
100 url(r
'^podcast/(?P<slug>[\w-]+)/unsubscribe/(?P<device_uid>[\w.-]+)',
102 name
='unsubscribe-slug'),
104 url(r
'^podcast/(?P<slug>[\w-]+)/unsubscribe/\+all$',
105 'unsubscribe_all_slug',
106 name
='unsubscribe-all-slug'),
108 url(r
'^podcast/(?P<slug>[\w-]+)/add-tag',
110 name
='add-tag-slug'),
112 url(r
'^podcast/(?P<slug>[\w-]+)/remove-tag',
114 name
='remove-tag-slug'),
116 url(r
'^podcast/(?P<slug>[\w-]+)/set-public',
118 name
='podcast-public-slug',
119 kwargs
={'public': True}),
121 url(r
'^podcast/(?P<slug>[\w-]+)/set-private',
123 name
='podcast-private-slug',
124 kwargs
={'public': False}),
126 url(r
'^podcast/(?P<slug>[\w-]+)/-episodes',
128 name
='podcast-all-episodes-slug'),
130 url(r
'^podcast/(?P<slug>[\w-]+)/-flattr',
131 'flattr_podcast_slug',
132 name
='podcast-flattr-slug'),
136 urlpatterns
+= patterns('mygpo.web.views.episode',
143 url(r
'^podcast/(?P<p_id>[0-9a-f]{32})/(?P<e_id>[0-9a-f]{32})$',
147 url(r
'^podcast/(?P<p_id>[0-9a-f]{32})/(?P<e_id>[0-9a-f]{32})/toggle-favorite',
148 'toggle_favorite_id',
149 name
='episode-fav-id'),
151 url(r
'^podcast/(?P<p_id>[0-9a-f]{32})/(?P<e_id>[0-9a-f]{32})/add-action',
153 name
='add-episode-action-id'),
155 url(r
'^podcast/(?P<p_id>[0-9a-f]{32})/(?P<e_id>[0-9a-f]{32})/-flattr',
157 name
='flattr-episode-id'),
159 url(r
'^podcast/(?P<p_id>[0-9a-f]{32})/(?P<e_id>[0-9a-f]{32})/\+history',
160 'episode_history_id',
161 name
='episode-history-id'),
165 url(r
'^podcast/(?P<p_slug>[\w-]+)/(?P<e_slug>[\w-]+)$',
167 name
='episode-slug'),
169 url(r
'^podcast/(?P<p_slug>[\w-]+)/(?P<e_slug>[\w-]+)/toggle-favorite',
170 'toggle_favorite_slug',
171 name
='episode-fav-slug'),
173 url(r
'^podcast/(?P<p_slug>[\w-]+)/(?P<e_slug>[\w-]+)/add-action',
175 name
='add-episode-action-slug'),
177 url(r
'^podcast/(?P<p_slug>[\w-]+)/(?P<e_slug>[\w-]+)/-flattr',
178 'flattr_episode_slug', name
='flattr-episode-slug'),
180 url(r
'^podcast/(?P<p_slug>[\w-]+)/(?P<e_slug>[\w-]+)/\+history',
181 'episode_history_slug',
182 name
='episode-history-slug'),
185 from mygpo
.web
.views
.settings
import DefaultPrivacySettings
, \
186 PodcastPrivacySettings
, ProfileView
, FlattrSettingsView
, \
187 FlattrTokenView
, FlattrLogout
, AccountRemoveGoogle
189 urlpatterns
+= patterns('mygpo.web.views.settings',
190 url(r
'^account/$', 'account', name
='account'),
191 url(r
'^account/privacy$', 'privacy', name
='privacy'),
193 url(r
'^account/profile$',
194 ProfileView
.as_view(),
197 url(r
'^account/google/remove$',
198 AccountRemoveGoogle
.as_view(),
199 name
='account-google-remove'),
201 url(r
'^account/flattr$',
202 FlattrSettingsView
.as_view(),
203 name
='flattr-settings'),
205 url(r
'^account/flattr/token$',
206 FlattrTokenView
.as_view(),
207 name
='flattr-token'),
209 url(r
'^account/flattr/logout$',
210 FlattrLogout
.as_view(),
211 name
='flattr-logout'),
213 url(r
'^account/privacy/default-public$',
214 DefaultPrivacySettings
.as_view(public
=True),
215 name
='privacy_default_public'),
217 url(r
'^account/privacy/default-private$',
218 DefaultPrivacySettings
.as_view(public
=False),
219 name
='privacy_default_private'),
221 url(r
'^account/privacy/(?P<podcast_id>[\w]+)/public$',
222 PodcastPrivacySettings
.as_view(public
=True),
223 name
='privacy_podcast_public'),
225 url(r
'^account/privacy/(?P<podcast_id>[\w]+)/private$',
226 PodcastPrivacySettings
.as_view(public
=False),
227 name
='privacy_podcast_private'),
229 url(r
'^account/delete$', 'delete_account',name
='delete-account'),
232 urlpatterns
+= patterns('mygpo.web.views.device',
233 url(r
'^devices/$', 'overview', name
='devices'),
234 url(r
'^devices/create-device$', 'create', name
='device-create'),
235 url(r
'^device/(?P<uid>[\w.-]+)\.opml$', 'opml', name
='device-opml'),
236 url(r
'^device/(?P<uid>[\w.-]+)$', 'show', name
='device'),
237 url(r
'^device/(?P<uid>[\w.-]+)/symbian.opml$', 'symbian_opml', name
='device-symbian-opml'),
238 url(r
'^device/(?P<uid>[\w.-]+)/sync$', 'sync', name
='device-sync'),
239 url(r
'^device/(?P<uid>[\w.-]+)/unsync$', 'unsync', name
='device-unsync'),
240 url(r
'^device/(?P<uid>[\w.-]+)/resync$', 'resync', name
='trigger-sync'),
241 url(r
'^device/(?P<uid>[\w.-]+)/delete$', 'delete', name
='device-delete'),
242 url(r
'^device/(?P<uid>[\w.-]+)/remove$', 'delete_permanently', name
='device-delete-permanently'),
243 url(r
'^device/(?P<uid>[\w.-]+)/undelete$', 'undelete', name
='device-undelete'),
244 url(r
'^device/(?P<uid>[\w.-]+)/edit$', 'edit', name
='device-edit'),
245 url(r
'^device/(?P<uid>[\w.-]+)/update$', 'update', name
='device-update'),
246 url(r
'^device/(?P<uid>[\w.-]+)/upload-opml$', 'upload_opml', name
='device-upload-opml'),
250 from mygpo
.web
.views
.users
import LoginView
, GoogleLogin
, GoogleLoginCallback
252 urlpatterns
+= patterns('mygpo.web.views.users',
254 url(r
'^register/restore_password$',
256 name
='restore-password'),
262 url(r
'^login/google$',
263 GoogleLogin
.as_view(),
264 name
='login-google'),
266 url(r
'^login/oauth2callback$',
267 GoogleLoginCallback
.as_view(),
268 name
='login-google-callback'),
270 url(r
'^logout/$', logout
, {'next_page': '/'}, name
='logout'),