summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--feeds.py43
-rw-r--r--urls.py3
2 files changed, 45 insertions, 1 deletions
diff --git a/feeds.py b/feeds.py
index c5bdbde..98e1fb8 100644
--- a/feeds.py
+++ b/feeds.py
@@ -1,4 +1,6 @@
+from datetime import datetime, time
import hashlib
+from pytz import utc
from django.contrib.sites.models import Site
from django.contrib.syndication.views import Feed
@@ -9,6 +11,7 @@ from django.views.decorators.http import condition
from main.utils import retrieve_latest
from main.models import Arch, Repo, Package
from news.models import News
+from releng.models import Release
class GuidNotPermalinkFeed(Rss201rev2Feed):
@@ -152,4 +155,44 @@ class NewsFeed(Feed):
def item_author_name(self, item):
return item.author.get_full_name()
+
+class ReleaseFeed(Feed):
+ feed_type = GuidNotPermalinkFeed
+
+ title = 'Arch Linux: Releases'
+ link = '/download/'
+ description = 'Release ISOs'
+ subtitle = description
+
+ __name__ = 'release_feed'
+
+ def items(self):
+ return Release.objects.filter(available=True)[:10]
+
+ def item_title(self, item):
+ return item.version
+
+ def item_description(self, item):
+ return item.info_html()
+
+ # TODO: individual release pages
+ item_link = '/download/'
+
+ def item_pubdate(self, item):
+ return datetime.combine(item.release_date, time()).replace(tzinfo=utc)
+
+ def item_guid(self, item):
+ # http://diveintomark.org/archives/2004/05/28/howto-atom-id
+ date = item.release_date
+ return 'tag:%s,%s:%s' % (Site.objects.get_current().domain,
+ date.strftime('%Y-%m-%d'), item.iso_url())
+
+ def item_enclosure_url(self, item):
+ domain = Site.objects.get_current().domain
+ proto = 'https'
+ return "%s://%s/%s.torrent" % (proto, domain, item.iso_url())
+
+ item_enclosure_mime_type = 'application/x-bittorrent'
+ item_enclosure_length = 0
+
# vim: set ts=4 sw=4 et:
diff --git a/urls.py b/urls.py
index 1bdf1a5..8288297 100644
--- a/urls.py
+++ b/urls.py
@@ -6,7 +6,7 @@ from django.views.decorators.cache import cache_page
from django.views.generic import TemplateView, RedirectView
from django.views.i18n import null_javascript_catalog
-from feeds import PackageFeed, NewsFeed
+from feeds import PackageFeed, NewsFeed, ReleaseFeed
import sitemaps
our_sitemaps = {
@@ -32,6 +32,7 @@ feeds_patterns = patterns('',
cache_page(300)(PackageFeed())),
(r'^packages/(?P<arch>[A-z0-9]+)/(?P<repo>[A-z0-9\-]+)/$',
cache_page(300)(PackageFeed())),
+ (r'^releases/$', cache_page(300)(ReleaseFeed())),
)
# Sitemaps