Class: Murlsh::M3uBody

Inherits:
Object
  • Object
show all
Includes:
FeedBody
Defined in:
lib/murlsh/m3u_body.rb

Overview

m3u builder.

Instance Attribute Summary

Attributes included from FeedBody

#config, #feed_url, #req, #updated, #urls

Instance Method Summary collapse

Methods included from FeedBody

#each, #feed_title, #initialize

Instance Method Details

#buildObject

m3u builder.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/murlsh/m3u_body.rb', line 8

def build
  if defined?(@body)
    @body
  else
    result = "# #{feed_url}\r\n\r\n"
    urls.each do |mu|
      Murlsh::Plugin.hooks('url_display_pre') do |p|
        p.run mu, req, config
      end

      result << "#{mu.url}\r\n"
      @updated = @updated ? [@updated, mu.time].max : mu.time
    end

    @body = result
  end
end