astro / prittorrent

BitTorrent Content Distribution for Podcasts
http://bitlove.org/
93 stars 19 forks source link

Support custom enclosure guid element to reference media files #33

Closed timpritlove closed 9 years ago

timpritlove commented 9 years ago

This is an alternate solution to #30

If Bitlove would accept a custom Bitlove enclosure-guid element in a feed, any bitlove-aware feed publishing system could reference media files in Bitlove using a self-chosen GUID.

Example:

<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:bitlove="http://bitlove.org" version="2.0">
<channel>

    <item>
        <title>Podcast Episode</title>
        <enclosure url="http://example.com/podlove/file/2342/" length="36557482" type="audio/mp4" />
        <bitlove:enclosure-guid>http://example.com/podlove/file/2342/</bitlove:enclosure-guid>
    </item>

</channel>

The Bitlove Widget could accept the GUID as a valid URL in the torrentByEnclosure JavaScript function and we're set.

astro commented 9 years ago

Thank you very much @timpritlove! This seems to be a much better solution.

timpritlove commented 9 years ago

Let us know when you think you have it ready. We'll put it into Podlove Publisher immediately.

eteubert commented 9 years ago

I have the Publisher commit ready: https://github.com/podlove/podlove-publisher/commit/ad1b0aa9eabba1ec5a3b3dc9d3fb9efc8bed8218

timpritlove commented 9 years ago

Might be worth considering a slightly different namespace if you don't want to spoil "http://bitlove.org" for this and go for something along "http://bitlove.org/api" or "http://bitlove.org/extensions". This would provide the opportunity to place namespace usage documentation under the same URL.

astro commented 9 years ago

About to implement this now... why aren't we reusing RSS guid/ATOM id for this? They seem like the appropriate identifier to use. Is that mangled by Feedburner as well?

timpritlove commented 9 years ago

The RSS GUID is for the , not the enclosure. Multiple feeds might refer to the same item referring to different enclosures (= MP3, M4A, Vorbis, Opus versions of the same item all carry the same GUID).

However, in the absence of the enclosure-guid you could alternatively accept a standard GUID too.

Actually, you could name the element bitlove:guid to make clear, this is an explicit GUID to be used by Bitlove if the normal GUID can't be used. The widget just accepts a "guid" as an argument which can either reference the standard RSS guid OR the explicitly added bitlove:guid. This way, anyone can use the widget with redirected enclosure URLs by referencing the normal item GUID but publishing systems can explicitly support Bitlove by using bitlove:guid.

astro commented 9 years ago

Implemented as proposed.

Please test:

curl "http://api.bitlove.org/by-enclosure.json?guid=podlove-2014-03-13t14:09:09%2b00:00-b45e1d2cabbbccf"

(Note the URL-encoded +)

timpritlove commented 9 years ago

Is there official documentation for this? Did you just implement reference to the episode GUID or is the enclosure-guid element supported too? Can't find the commit covering this...

astro commented 9 years ago

Here you go: http://bitlove.org/help/podcaster/api#by-guid

Commits:

timpritlove commented 9 years ago

So I think this is now <bitlove:guid> which is okay too.

astro commented 9 years ago

No, it is an attribute to the enclosure element! (Github swallowed your angle brackets.)

ATOM/RSS id/guid elements of items work as fallback though.

timpritlove commented 9 years ago

Ah okay, so <enclosure bitlove:guid="**guid**" …>

astro commented 9 years ago

Right.

Is my documentation clear on this?