Sha256: f51387c7f70aca6b31b28f1081a0bb13b822111e847c564e0573f16cb41561ca

Contents?: true

Size: 718 Bytes

Versions: 7

Compression:

Stored size: 718 Bytes

Contents

require 'uri'

require 'rack'

require 'murlsh'

module Murlsh

  # Serve podcast RSS feed.
  class PodcastServer < Server

    # Respond to a GET request for podcast RSS feed.
    def get(req)
      page = 1
      per_page = config.fetch('num_posts_feed', 25)

      result_set = Murlsh::UrlResultSet.new(req['q'], page, per_page,
        :content_type => 'audio/mpeg')

      feed_url = URI.join(config.fetch('root_url'), 'podcast.rss')
      body = Murlsh::RssBody.new(config, req, feed_url, result_set.results)

      resp = Rack::Response.new(body, 200,
        'Content-Type' => 'application/rss+xml')
      if u = body.updated
        resp['Last-Modified'] = u.httpdate
      end
      resp
    end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
murlsh-1.9.3 lib/murlsh/podcast_server.rb
murlsh-1.9.2 lib/murlsh/podcast_server.rb
murlsh-1.9.1 lib/murlsh/podcast_server.rb
murlsh-1.9.0 lib/murlsh/podcast_server.rb
murlsh-1.8.0 lib/murlsh/podcast_server.rb
murlsh-1.7.1 lib/murlsh/podcast_server.rb
murlsh-1.7.0 lib/murlsh/podcast_server.rb