Class: ChannelsPage

Inherits:
MediaPage show all
Defined in:
lib/etvnet_seek/core/channels_page.rb

Constant Summary collapse

BROWSE_URL =
BASE_URL + "/cgi-bin/video/eitv_browse.fcgi"
CHANNELS_URL =
BROWSE_URL + "?action=channels"

Constants inherited from Page

Page::BASE_URL

Instance Attribute Summary

Attributes inherited from Page

#document

Attributes inherited from ServiceCall

#url

Instance Method Summary collapse

Methods inherited from BasePage

#page_title, #title

Methods inherited from ServiceCall

#get, #post

Constructor Details

#initialize(url = CHANNELS_URL) ⇒ ChannelsPage

Returns a new instance of ChannelsPage.



5
6
7
# File 'lib/etvnet_seek/core/channels_page.rb', line 5

def initialize url = CHANNELS_URL
  super(url)
end

Instance Method Details

#itemsObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/etvnet_seek/core/channels_page.rb', line 9

def items
  list = []

  document.css("table table table.rounded_white table tr").each do |item|
    links = item.css("table tr td a")

    text = item.children.at(0).text.strip

    if text.size > 0
      link = nil
      archive_link = nil

      if links.size > 0
        href = links[0]
        archive_href = links[1]

        link = href.attributes['href'].value unless href.nil?

        archive_link = archive_href.attributes['href'].value unless archive_href.nil?
      end

      list << ChannelMediaItem.new(text, link, archive_link) unless link.nil?
    end
  end

  list
end