astro / prittorrent

BitTorrent Content Distribution for Podcasts

Home Page:http://bitlove.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

API / gpodder.net Integration

stefankoegl opened this issue · comments

It would be great if there would be an API so that bitlove can be integrated in other applications / webservices. For my use case I would need an endpoint to retrieve torrent links (and bitlove URLs) for a given podcast feed URL.

I'd imagine something like

  GET /api/feed?url=http%3A%2F%2Fexample.com%2Fmypodcast.rss

  {
      "web": "http://bitlove.org/example/mypodcast",
      "feed": "http://bitlove.org/example/mypodcast/feed",
      "episodes": [
          {
            "web": "http://bitlove.org/example/mypodcast#directlink",
            "file": "http://example.com/mypodcast/episode1.mp3",
            "bittorrent": "http://bitlove.org/t/....e6ab17c48.torrent",
            "size": "5456546",
            ... more meta data
          }
       ]
  }

The additional meta data could be the number of completed downloads, number of seeders / leechers, current bandwith, Flattr links, etc, whatever you like to provide.

Great that you're adding that here. I'm going to implement something along this proposal in a few days.

Two things that came to mind:

  • Did you notice that this data is almost fully included in the exported feeds? I'm not opposed to a slim JSON export unless ... more meta data means all data from the original feed. I could easily add the original enclosure URL to the exported feeds.
  • Using the feed URL as key may not always work, as I encourage users to add feeds that are not hosted by Feedburner, unlike their end-user feeds.

I don't feel revealing the original feed URL because it can be regarded private data. Would you mind an entry point like http://bitlove.org/astro/bitlove-show/feed.json?

Perhaps I can add lookup by item id? Note that this can result in multiple items of different feeds. You can map them to your original items by comparing additional metadata like alternate links. I don't intend on ever modifying them.

Please give me feedback, I would love to cooperate with gpodder.net.

Thanks for the feedback! Generally I see two "tasks" that I would like to automate:

  • Matching podcasts in gpodder.net with podcasts in bitlove. If you don't like to reveal the original feed URL, it would be good to have a list of recently added feeds (not episodes) that can be easily parsed / crawled. Matching could then be done semi-automatically, for example by adding titles and approving matches
  • Once a gpodder.net and a bitlove feed are assigned, I need some way to match their episodes. As the bitlove feeds refer to the original media files, and gpodder.net uses those URLs to identify episodes, this should be easy to do.

Do you think you could provide a page / API endpoint to get the newest feeds so that I could start working on the first point?

Here's a first attempt at matching episodes (enclosures):

curl "http://api.bitlove.org/by-enclosure.json?url=http://chaosradio.ccc.de/archive/chaosradio_30.mp3&url=http://chaosradio.ccc.de/archive/chaosradio_31.mp3&url=http://chaosradio.ccc.de/archive/chaosradio_32.mp3&url2=http://chaosradio.ccc.de/archive/chaosradio_33.mp3&url3=http://chaosradio.ccc.de/archive/chaosradio_34.mp3"

The feed data can be cached pretty indefinitely. Tracker statistics however are always in flux.

Next, how about crawling the directory through OPML?

I've made a python library available that wraps the current bitlove api: http://pypi.python.org/pypi/bitlove/0.1