Skip to content

Instantly share code, notes, and snippets.

@mrvdb
Created December 28, 2012 13:55
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mrvdb/4398058 to your computer and use it in GitHub Desktop.
diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py
index c3d0604..6c2f8d0 100644
--- a/mediagoblin/user_pages/views.py
+++ b/mediagoblin/user_pages/views.py
@@ -16,6 +16,9 @@
import logging
import datetime
+import mimetypes
+
+from urlparse import urljoin
from mediagoblin import messages, mg_globals
from mediagoblin.db.util import DESCENDING
@@ -479,22 +482,28 @@ def atom_feed(request):
links=atomlinks)
for entry in cursor:
+ # Collect metadata of original
+ fileurl = mg_globals.app.public_store.file_url(
+ entry.media_files[u'original'])
+ mimetype,encoding = mimetypes.guess_type(fileurl)
+ original_url = urljoin(request.urlgen('index',qualified=True),fileurl)
+
feed.add(entry.get('title'),
entry.description_html,
id=entry.url_for_self(request.urlgen, qualified=True),
content_type='html',
+
author={
'name': entry.get_uploader.username,
'uri': request.urlgen(
'mediagoblin.user_pages.user_home',
qualified=True, user=entry.get_uploader.username)},
updated=entry.get('created'),
- links=[{
- 'href': entry.url_for_self(
- request.urlgen,
- qualified=True),
- 'rel': 'alternate',
- 'type': 'text/html'}])
+ links=[
+ {'href': entry.url_for_self(request.urlgen,qualified=True),
+ 'rel': 'alternate', 'type': 'text/html'},
+ {'href': original_url, 'rel': 'enclosure','type': mimetype}
+ ])
return feed.get_response()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment