logged in users can now add tags to podcasts
[mygpo.git] / mygpo / urls.py
blob3c437bc79f36a03a4c92ce5315a713980581f035
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.show'),
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'),
51 (r'^podcast/(?P<pid>\w+)/add-tag', 'mygpo.web.views.podcast.add_tag'),
52 (r'^podcast/(?P<pid>\w+)/remove-tag', 'mygpo.web.views.podcast.remove_tag'),
54 (r'^episode/(?P<id>\d+)$', 'mygpo.web.views.episode.episode'),
55 (r'^episode/(?P<id>\d+)/add-chapter$', 'mygpo.web.views.episode.add_chapter'),
56 (r'^episode/(?P<id>\d+)/remove-chapter/(?P<chapter_id>\d+)$', 'mygpo.web.views.episode.remove_chapter'),
57 (r'^episode/(?P<id>\d+)/toggle-favorite', 'mygpo.web.views.episode.toggle_favorite'),
59 (r'^favorites/', 'mygpo.web.views.episode.list_favorites'),
61 (r'account/$', 'mygpo.web.views.settings.account'),
62 (r'account/privacy$', 'mygpo.web.views.settings.privacy'),
63 (r'account/delete$', 'mygpo.web.views.settings.delete_account'),
64 (r'share/$', 'mygpo.web.views.settings.share'),
66 (r'user/(?P<username>\w+)/subscriptions$', 'mygpo.web.views.user_subscriptions'),
67 (r'user/(?P<username>\w+)/subscriptions\.opml$', 'mygpo.web.views.user_subscriptions_opml'),
68 (r'user/(?P<username>\w+)/favorites.xml$', 'mygpo.userfeeds.views.favorite_feed'),
70 (r'^history/$', 'mygpo.web.views.history'),
72 (r'^directory/$', 'mygpo.web.views.public.browse'),
73 (r'^directory/(?P<category>[^/]+)$', 'mygpo.web.views.public.category'),
75 (r'^toplist/$', 'mygpo.web.views.toplist'),
76 (r'^toplist/episodes$', 'mygpo.web.views.episode_toplist'),
77 (r'^toplist.opml$', 'mygpo.api.simple.toplist', {'count': 50, 'format': 'opml'}),
79 (r'^gpodder-examples.opml$', 'mygpo.web.views.gpodder_example_podcasts'),
81 (r'^suggestions/$', 'mygpo.web.views.suggestions'),
83 (r'^devices/$', 'mygpo.web.views.device.overview'),
84 (r'^device/(?P<device_id>\d+)$', 'mygpo.web.views.device.show'),
85 (r'^device/(?P<device_id>\d+).opml$', 'mygpo.web.views.device.opml'),
86 (r'^device/(?P<device_id>\d+)/sync$', 'mygpo.web.views.device.sync'),
87 (r'^device/(?P<device_id>\d+)/unsync$', 'mygpo.web.views.device.unsync'),
88 (r'^device/(?P<device_id>\d+)/delete$', 'mygpo.web.views.device.delete'),
89 (r'^device/(?P<device_id>\d+)/undelete$', 'mygpo.web.views.device.undelete'),
90 (r'^device/(?P<device_id>\d+)/history$', 'mygpo.web.views.history'),
91 (r'^device/(?P<device_id>\d+)/edit$', 'mygpo.web.views.device.edit'),
93 (r'^search/', 'mygpo.search.views.search'),
95 #Legacy API
96 (r'^upload$', 'mygpo.api.legacy.upload'),
97 (r'^getlist$', 'mygpo.api.legacy.getlist'),
99 #Simple API
100 (r'^subscriptions/(?P<username>\w+)/(?P<device_uid>[\w.-]+)\.(?P<format>\w+)', 'mygpo.api.simple.subscriptions'),
101 (r'^subscriptions/(?P<username>\w+)\.(?P<format>\w+)', 'mygpo.api.simple.all_subscriptions'),
102 (r'^toplist/(?P<count>\d+)\.(?P<format>\w+)', 'mygpo.api.simple.toplist'),
103 (r'^search\.(?P<format>\w+)', 'mygpo.api.simple.search'),
104 (r'^suggestions/(?P<count>\d+)\.(?P<format>\w+)', 'mygpo.api.simple.suggestions'),
106 #Advanced API
107 (r'^api/[12]/subscriptions/(?P<username>\w+)/(?P<device_uid>[\w.-]+)\.json', 'mygpo.api.advanced.subscriptions'),
108 (r'^api/(?P<version>[12])/episodes/(?P<username>\w+)\.json', 'mygpo.api.advanced.episodes'),
109 (r'^api/[12]/devices/(?P<username>\w+)/(?P<device_uid>[\w.-]+)\.json', 'mygpo.api.advanced.device'),
110 (r'^api/[12]/devices/(?P<username>\w+)\.json', 'mygpo.api.advanced.devices'),
112 (r'^api/2/auth/(?P<username>\w+)/(?P<device_uid>[\w.-]+)/login\.json', 'mygpo.api.advanced.auth.login'),
113 (r'^api/2/auth/(?P<username>\w+)/(?P<device_uid>[\w.-]+)/logout\.json', 'mygpo.api.advanced.auth.logout'),
114 (r'^api/2/auth/(?P<username>\w+)/(?P<device_uid>[\w.-]+)/validate\.json', 'mygpo.api.advanced.auth.validate'),
115 (r'^api/2/tags/(?P<count>\d+)\.json', 'mygpo.api.advanced.directory.top_tags'),
116 (r'^api/2/tag/(?P<tag>[^/]+)/(?P<count>\d+)\.json', 'mygpo.api.advanced.directory.tag_podcasts'),
117 (r'^api/2/data/podcast\.json', 'mygpo.api.advanced.directory.podcast_info'),
118 (r'^api/2/data/episode\.json', 'mygpo.api.advanced.directory.episode_info'),
120 (r'^api/2/chapters/(?P<username>\w+)\.json', 'mygpo.api.advanced.episode.chapters'),
121 (r'^api/2/updates/(?P<username>\w+)/(?P<device_uid>[\w.-]+)\.json', 'mygpo.api.advanced.updates'),
123 #Subscribe with my.gpodder.org
124 (r'^subscribe', 'mygpo.web.views.podcast_subscribe_url'),
127 (r'^online-help', 'django.views.generic.simple.direct_to_template', {'template': 'online-help.html'}),
129 # Uncomment the admin/doc line below and add 'django.contrib.admindocs'
130 # to INSTALLED_APPS to enable admin documentation:
131 # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
133 # Uncomment the next line to enable the admin:
134 (r'^admin/(.*)', admin.site.root),
136 (r'^accounts/', include('registration.urls')),
138 (r'^publisher/$', 'mygpo.publisher.views.home'),
139 (r'^publisher/(?P<username>\w+)/update', 'mygpo.publisher.views.update_published_podcasts'),
140 (r'^publisher/podcast/(?P<id>\d+)$', 'mygpo.publisher.views.podcast'),
141 (r'^publisher/podcast/(?P<id>\d+)/update$', 'mygpo.publisher.views.update_podcast'),
142 (r'^publisher/podcast/(?P<id>\d+)/episodes$', 'mygpo.publisher.views.episodes'),
143 (r'^publisher/episode/(?P<id>\d+)$', 'mygpo.publisher.views.episode'),
144 (r'^publisher/podcast/search$', 'mygpo.publisher.views.search_podcast'),
145 (r'^publisher/group/(?P<group_id>\d+)$', 'mygpo.publisher.views.group'),
147 (r'^publisher/link/$', 'mygpo.publisher.views.link'),
148 (r'^publisher/advertise', 'mygpo.publisher.views.advertise'),
150 #Subscribe with my.gpodder.org
151 (r'^subscribe', 'mygpo.web.views.podcast_subscribe_url'),
152 #(r'^authors/$', 'mygpo.web.views.author'),
155 (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': os.path.abspath('%s/../htdocs/media/' % os.path.dirname(__file__))}),