Skip to content

Commit

Permalink
adding main menu browsing
Browse files Browse the repository at this point in the history
  • Loading branch information
shvets committed Mar 5, 2010
1 parent 569a815 commit 8f56ccc
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 33 deletions.
2 changes: 1 addition & 1 deletion etvnet_seek.gemspec
Expand Up @@ -21,7 +21,7 @@ Gem::Specification.new do |s|
s.require_paths = ["lib"]
s.rubyforge_project = %q{etvnet_seek}
s.rubygems_version = %q{1.3.6}
s.summary = %q{Command line tool for getting mms urls from etvnet service.}
s.summary = %q{Accessing etvnet service from command line.}

if s.respond_to? :specification_version then
s.specification_version = 2
Expand Down
3 changes: 2 additions & 1 deletion lib/etvnet_seek/core/archive_media_item.rb
Expand Up @@ -27,7 +27,8 @@ def to_s
buffer += " (#{media_file})" if not media_file.nil? and media_file.size > 0
buffer += " --- #{duration}" if not duration.nil? and duration.size > 0
buffer += " --- #{year}" if not year.nil? and year.size > 2


buffer += " --- #{channel}" if channel
buffer += " --- #{rating_image}" if rating_image
buffer += " --- #{rating}" if rating

Expand Down
21 changes: 19 additions & 2 deletions lib/etvnet_seek/core/base_page.rb
@@ -1,17 +1,34 @@
class BasePage < Page
# def items
# list = []
#
# document.css("#tblCategories a").each do |item|
# text = item.css("img").at(0).attributes['alt'].value
# href = item['href']
#
# list << MediaItem.new(text, href)
# end
#
# list
# end

def items
list = []

document.css("#tblCategories a").each do |item|
text = item.css("img").at(0).attributes['alt'].value
href = item['href']

list << MediaItem.new(text, href)
unless href =~ /(forum|action=browse_persons|valentines2010)/
list << MediaItem.new(text, href)
end
end

list.delete_at(0)

list
end

def title
document.css("title").text
end
Expand Down
3 changes: 2 additions & 1 deletion lib/etvnet_seek/core/browse_media_item.rb
@@ -1,5 +1,5 @@
class BrowseMediaItem < MediaItem
attr_accessor :folder, :showtime, :year, :duration, :image, :rating_image
attr_accessor :folder, :showtime, :year, :duration, :image, :rating_image, :channel

def initialize(text, link)
super(text, link)
Expand Down Expand Up @@ -31,6 +31,7 @@ def to_s
buffer += " (#{media_file})" if not media_file.nil? and media_file.size > 0
buffer += " --- #{year}" if not year.nil? and year.size > 2
buffer += " --- #{duration}" if not duration.nil? and duration.size > 0
buffer += " --- #{channel}" if channel
buffer += " --- #{image}" if image
buffer += " --- #{rating_image}" if rating_image

Expand Down
2 changes: 1 addition & 1 deletion lib/etvnet_seek/core/channels_page.rb
Expand Up @@ -9,7 +9,7 @@ def initialize url = CHANNELS_URL
def items
list = []

document.css("table table table.rounded_white table tr").each_with_index do |item, index|
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
Expand Down
20 changes: 0 additions & 20 deletions lib/etvnet_seek/core/main_page.rb

This file was deleted.

21 changes: 15 additions & 6 deletions lib/etvnet_seek/core/media_page.rb
Expand Up @@ -12,25 +12,34 @@ def items

text += additional_info unless additional_info.nil?

showtime = item.parent.parent.parent.css('td[1]').text.strip
year = item.parent.parent.next.next.content.strip
duration = ""
tr = item.parent.parent.parent

# showtime = item.parent.parent.parent.css('td[1]').text.strip
# year = item.parent.parent.next.next.content.strip
# duration = ""

showtime = tr.css("td[1]").text.strip

year = tr.css("td[4]") ? tr.css("td[4]").text.strip : ""
duration = tr.css("td[5]").text.strip ? tr.css("td[5]").text.strip : ""
channel = tr.css("td[6]") ? tr.css("td[6]").text.strip : ""

if link =~ /action=browse_container/
folder = true
link = link[Page::BASE_URL.size..link.size]
else
folder = false
duration = item.parent.parent.next.next.next.next.content.strip unless
item.parent.parent.next.next.next.next.nil?
# duration = item.parent.parent.next.next.next.next.content.strip unless
# item.parent.parent.next.next.next.next.nil?
end

record = BrowseMediaItem.new(text, link)
record.folder = folder
record.showtime = showtime
record.year = year
record.duration = duration

record.channel = channel

list << record
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/etvnet_seek/core/page_factory.rb
Expand Up @@ -28,7 +28,7 @@ def self.create mode, params = []
when 'search' then
SearchPage.new *params
when 'main' then
MainPage.new
BasePage.new
when 'channels' then
ChannelsPage.new
when 'best_ten' then
Expand Down

0 comments on commit 8f56ccc

Please sign in to comment.