Class: Murlsh::M3uServer
Overview
Serve m3u file of audio urls.
Constant Summary collapse
- AudioContentTypes =
%w{ application/ogg audio/mpeg audio/ogg }
Instance Attribute Summary
Attributes inherited from Server
Instance Method Summary collapse
-
#get(req) ⇒ Object
Respond to a GET request for m3u file.
Methods inherited from Server
Constructor Details
This class inherits a constructor from Murlsh::Server
Instance Method Details
#get(req) ⇒ Object
Respond to a GET request for m3u file.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/murlsh/m3u_server.rb', line 19 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 => AudioContentTypes) feed_url = URI.join(config.fetch('root_url'), 'm3u.m3u') body = Murlsh::M3uBody.new(config, req, feed_url, result_set.results) resp = Rack::Response.new(body, 200, 'Content-Type' => 'audio/x-mpegurl') if u = body.updated resp['Last-Modified'] = u.httpdate end resp end |