Class: MediaPage

Inherits:
ItemsPage show all
Defined in:
lib/etvnet_seek/core/media_page.rb

Constant Summary

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 ItemsPage

#categories, #category_breadcrumbs, #description, #navigation_menu, #page_browser, #page_title, #see_too_items, #title, #title_items

Methods inherited from Page

#initialize

Methods inherited from ServiceCall

#get, #initialize, #post

Constructor Details

This class inherits a constructor from Page

Instance Method Details

#info_movie_additional_infoObject



59
60
61
# File 'lib/etvnet_seek/core/media_page.rb', line 59

def info_movie_additional_info
  document.css(".all-inner-pages .description")[1].inner_html
end

#info_movie_additional_info2Object



63
64
65
# File 'lib/etvnet_seek/core/media_page.rb', line 63

def info_movie_additional_info2
  document.css(".all-inner-pages .acc_container").inner_html
end

#info_movie_breadcrumbsObject



47
48
49
# File 'lib/etvnet_seek/core/media_page.rb', line 47

def info_movie_breadcrumbs
  document.css(".path_movie_info_menu").inner_html
end

#info_movie_descriptonObject



55
56
57
# File 'lib/etvnet_seek/core/media_page.rb', line 55

def info_movie_descripton
 document.css(".all-inner-pages .description")[0].children.at(0).text
end

#info_movie_screenshotsObject



51
52
53
# File 'lib/etvnet_seek/core/media_page.rb', line 51

def info_movie_screenshots
  collect_images ".all-inner-pages .screenshots"
end

#itemsObject



6
7
8
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
36
37
38
39
40
41
42
43
44
45
# File 'lib/etvnet_seek/core/media_page.rb', line 6

def items
  list = []

  document.css(".conteiner table#table-onecolumn tr").each do |item|
    unless item.css("td[1]").text.empty?
      showtime = item.css("td[1]").text.strip
      name = item.css("td[2]").text.strip
      rating_image = item.css("td[3] img").at(0) ? item.css("td[3] img").at(0).attributes['src'].value.strip : ""
      rating = item.css("td[4]") ? item.css("td[4]").text.strip : ""
      duration = item.css("td[5]") ? item.css("td[5]").text.strip : ""
      year = item.css("td[6]") ? item.css("td[6]").text.strip : ""
      channel = item.css("td[7]") ? item.css("td[7]").text.strip : ""

      link = item.css("td[2] a").at(0).attributes['href'].value

      additional_info = additional_info(item.css("td[2] a").at(0), 2)

      folder = false

      if not additional_info.nil? and additional_info.strip.size > 0
        if(additional_info.strip.scan(/\((\d*)(.*)\)/)).size > 0
          folder = true
        end
      end

      record = BrowseMediaItem.new(name, link)
      record.folder = folder
      record.showtime = showtime
      record.year = year
      record.duration = duration
      record.channel = channel
      record.rating_image = rating_image
      record.rating = rating

      list << record
    end
  end

  list
end