Opened 13 years ago
Last modified 8 years ago
#328 closed enhancement
Atom feed thumbnails — at Version 10
Reported by: | maiki interi | Owned by: | Inconexo ø |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | programming | Keywords: | kuneco |
Cc: | Parent Tickets: |
Description (last modified by )
Not entirely on topic with `#658 </issues/658>`_ or `#659 </issues/659>`_, but related. My expectation was for the atom feed to contain the thumbnail of the image (or equivalent of other media types). This is important to me, as I want to widgetize/aggregate the feed on other sites. I found two places where feeds are generated, ``mediagoblin/user_pages/views.py`` and ``mediagoblin/listings/views.py``: :: for entry in cursor: feed.add(entry.get('title'), entry.get('description_html'), content_type='html', author=request.matchdict['user'], updated=entry.get('created'), url=entry.url_for_self(request.urlgen)) I am not sure what the thumbnail is, but I am betting it is a **summary** or maybe **content** (see the `werkzeug atom docs <http://werkzeug.pocoo.org/docs/contrib/atom/>`_). I think this is important, even if we are moving to make it a full ActivityStream, since the federation I have in mind is something akin to a dashboard view of new photos posted on my friends' sites. So, can we get a thumbnail in there? =]
Change History (12)
comment:2 by , 13 years ago
I have done a try. Not very happy because I had to: 1) Write html code inside python code. I don't feel that very orthodox. 2) Img comes inside html content. I don't know if there is a better way to include this, but I haven't found it inside the atom library documentation. Please, tell me any comment that would improve my implementation. git: [https://gitorious.org/\ :sub:`inconexo/mediagoblin/inconexos-mediagoblin](https://gitorious.org/`\ inconexo/mediagoblin/inconexos-mediagoblin) branch: 676\_feed\_thumbs
comment:3 by , 13 years ago
Status: | New → Feedback |
---|
comment:3 by , 13 years ago
Owner: | set to |
---|
Hey Inconexo, thanks for the work on this. :) I think the best route would be to actually shift over the work to making our own atom feed generator... I think we'll need to for `#659 </issues/659>`_ anyway. And this would avoid such grossness as we're extending that code. Inconexo: if you're interested in pushing us toward a beautiful federated future, a good way to start might be to help write an atom feed generator using lxml :) `http://lxml.de/tutorial.html <http://lxml.de/tutorial.html>`_ If you're interested in this, let me know! If you are interested but have no experience with lxml, read that tutorial and ping me on irc... you'll find it's pretty easy though, I think.
comment:4 by , 13 years ago
Well, finally, feed library is written. Please notice I am a beginner with Python. Please comment any problem and I will fix it. I have kept two goals: 1) Same interface as Werkzeurg's. This way, changing one feed generator to other is changing the import. 2) Extensibility. I have made a generator class. If we wanted to generate RSS or other feed systems, we could write another generator, reusing a lot of code. I have also added thumbnails capabilities. First, I added media:thumbnails elements, but it doesn't seem to work with firefox' and other's agregators. Any help with that is appreciated. So, I used the same old trick: including the thumbnail inside the content. Anyway, you can take a look: git: [https://gitorious.org/\ :sub:`inconexo/mediagoblin/inconexos-mediagoblin](https://gitorious.org/`\ inconexo/mediagoblin/inconexos-mediagoblin) branch: feed\_library
comment:5 by , 13 years ago
Milestone: | 0.2.0 → 0.2.1 |
---|
comment:5 by , 13 years ago
Okay, this one diverged somewhat into "we need a feed library". And one was created. This is actually bug `#711 </issues/711>`_. So made this one block'd by 711. When 711 is done, we should revisit this one.
comment:6 by , 13 years ago
The original url for this bug was http://bugs.foocorp.net/issues/676 .
Relations:
#310: related, #311: related, #358: blocked
comment:7 by , 13 years ago
Keywords: | kuneco added |
---|---|
Milestone: | 0.2.1 |
comment:8 by , 12 years ago
To post media in the atom feed, we'll need to add something like:
<link rel="enclosure" type="image/jpeg" href="http://farm9.staticflickr.com/8343/8187137313_2e211c431f_b.jpg" />
to the atom feed. At least this is what the flickr atom feed does.
comment:9 by , 12 years ago
I pushed a Work-In-Progess branch 328_media_in_atom_feed to my repo at git://gitorious.org/~spaetz/mediagoblin/spaetz-mediagoblin.git
It does not implement a new Atom feed generator, but at least it embeds the posted media as a
<link href="....jpg" rel="enclosure"/> which is what the flickr atom feed also does to convey the posted media.
I stumbled upon 2 roadblocks while implementing: mg_globals.public_store.file_url(media_entry) returns a relativ URL without HOST and we need a real fully external URL there. How can we achieve that?
Second, how can I determine the media type of the media so that browsers detect it correctly? Right now I hardcoded 'type': 'image/jpeg' which is obviously bad.
comment:10 by , 12 years ago
Description: | modified (diff) |
---|
Given that this is about thumbnails and not enclosing the actual media item, it's not corrrect to use <link href="..." rel="enclosure"/>. That's for enclosing media items like for podcasts, picturecasts, etc. Flickr encloses the entire media item.
To have thumbnails, you should use the MRSS module:
http://www.feedforall.com/mediarss.htm
Firefox feed preview shows enclosures, but not thumbnails (weirdly, I helped write that).
What YouTube does is create an HTML thingy with the thumbnail in that and put that in the description. I suggest you do something like that. That's very common with podcast-like feeds.