etvnet-seek 0.7.2 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +18 -8
- data/README +1 -1
- data/Rakefile +27 -5
- data/VERSION +1 -1
- data/bin/etvnet-seek +8 -3
- data/etvnet-seek.gemspec +79 -42
- data/lib/etvnet_seek/accessor.rb +64 -0
- data/lib/etvnet_seek/commander.rb +37 -21
- data/lib/etvnet_seek/core/access_page.rb +23 -6
- data/lib/etvnet_seek/core/audio_page.rb +26 -0
- data/lib/etvnet_seek/core/best_hundred_page.rb +20 -0
- data/lib/etvnet_seek/core/browse_media_item.rb +1 -0
- data/lib/etvnet_seek/core/catalog_page.rb +26 -14
- data/lib/etvnet_seek/core/channels_page.rb +6 -2
- data/lib/etvnet_seek/core/group_media_item.rb +2 -0
- data/lib/etvnet_seek/core/group_page.rb +9 -23
- data/lib/etvnet_seek/core/home_page.rb +5 -2
- data/lib/etvnet_seek/core/items_page.rb +140 -0
- data/lib/etvnet_seek/core/items_page_factory.rb +47 -0
- data/lib/etvnet_seek/core/login_page.rb +3 -1
- data/lib/etvnet_seek/core/media_info.rb +3 -18
- data/lib/etvnet_seek/core/media_item.rb +10 -2
- data/lib/etvnet_seek/core/media_page.rb +54 -27
- data/lib/etvnet_seek/core/new_item.rb +2 -0
- data/lib/etvnet_seek/core/new_items_page.rb +4 -1
- data/lib/etvnet_seek/core/page.rb +2 -0
- data/lib/etvnet_seek/core/premiere_page.rb +7 -0
- data/lib/etvnet_seek/core/radio_page.rb +23 -0
- data/lib/etvnet_seek/core/search_page.rb +3 -33
- data/lib/etvnet_seek/core/service_call.rb +34 -6
- data/lib/etvnet_seek/core/top_this_week_page.rb +20 -0
- data/lib/etvnet_seek/etvnet_seek.rb +1 -4
- data/lib/etvnet_seek/main.rb +113 -84
- data/spec/etvnet_seek_spec.rb +10 -8
- data/spec/spec_helper.rb +3 -0
- data/spec/unit/pages_spec.rb +77 -0
- metadata +182 -32
- data/lib/etvnet_seek/core/base_page.rb +0 -43
- data/lib/etvnet_seek/core/page_factory.rb +0 -51
data/spec/etvnet_seek_spec.rb
CHANGED
@@ -2,20 +2,22 @@ $LOAD_PATH.unshift File.dirname(__FILE__) + '/lib'
|
|
2
2
|
|
3
3
|
require 'rubygems' unless RUBY_VERSION =~ /1.9.*/
|
4
4
|
|
5
|
-
require '
|
6
|
-
require 'runglish'
|
5
|
+
require 'spec_helper'
|
7
6
|
|
8
|
-
|
7
|
+
require 'etvnet_seek/etvnet_seek'
|
8
|
+
require 'etvnet_seek/main'
|
9
|
+
require 'runglish'
|
9
10
|
|
10
|
-
|
11
|
-
@client = Main.new
|
12
|
-
end
|
11
|
+
describe Main do
|
13
12
|
|
14
13
|
it "should return search menu items" do
|
15
14
|
keywords = "красная шапочка"
|
16
15
|
|
17
|
-
|
18
|
-
|
16
|
+
page = ItemsPageFactory.create "search", keywords
|
17
|
+
|
18
|
+
page.items.size.should > 0
|
19
|
+
|
20
|
+
p page.items
|
19
21
|
end
|
20
22
|
|
21
23
|
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
#$LOAD_PATH.unshift File.dirname(__FILE__) + '/../../app/domain'
|
2
|
+
|
3
|
+
require 'rubygems' unless RUBY_VERSION =~ /1.9.*/
|
4
|
+
|
5
|
+
require 'etvnet_seek/core/home_page'
|
6
|
+
|
7
|
+
#require 'home_page'
|
8
|
+
#require 'announces_page'
|
9
|
+
#require 'freetv_page'
|
10
|
+
#require 'today_page'
|
11
|
+
|
12
|
+
#describe "base page" do
|
13
|
+
# before :all do
|
14
|
+
# @page = AnnouncesPage.new
|
15
|
+
# end
|
16
|
+
#
|
17
|
+
# it "should return navigation menu items" do
|
18
|
+
# @page.navigation_menu.size.should > 0
|
19
|
+
# end
|
20
|
+
#
|
21
|
+
#end
|
22
|
+
|
23
|
+
describe "home page" do
|
24
|
+
before :all do
|
25
|
+
@page = HomePage.new
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should return main menu items" do
|
29
|
+
@page.items.size.should > 0
|
30
|
+
end
|
31
|
+
|
32
|
+
# it "should return [best ten] items" do
|
33
|
+
# @page.best_hundred.size.should > 0
|
34
|
+
# end
|
35
|
+
|
36
|
+
# it "should return [popular movies and serials] items" do
|
37
|
+
# @page.popular_movies_and_serials.size.should > 0
|
38
|
+
# end
|
39
|
+
|
40
|
+
# it "should return [we recommend] items" do
|
41
|
+
# @page.we_recommend.size.should > 0
|
42
|
+
# end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
#describe "announces page" do
|
47
|
+
# before :all do
|
48
|
+
# @page = AnnouncesPage.new
|
49
|
+
# end
|
50
|
+
#
|
51
|
+
# it "should return main menu items" do
|
52
|
+
# @page.items.size.should > 0
|
53
|
+
# end
|
54
|
+
#end
|
55
|
+
|
56
|
+
#describe "free TV page" do
|
57
|
+
# before :all do
|
58
|
+
# @page = FreetvPage.new
|
59
|
+
# end
|
60
|
+
#
|
61
|
+
# it "should return main menu items" do
|
62
|
+
# @page.items.size.should > 0
|
63
|
+
# end
|
64
|
+
#end
|
65
|
+
#
|
66
|
+
#describe "today page" do
|
67
|
+
# before :all do
|
68
|
+
# @page = TodayPage.new({:action => 'today', :channel => 1})
|
69
|
+
# end
|
70
|
+
#
|
71
|
+
# it "should return main menu items" do
|
72
|
+
# @page.category_breadcrumbs.size.should > 0
|
73
|
+
# @page.categories.size.should > 0
|
74
|
+
# @page.items.size.should > 0
|
75
|
+
# end
|
76
|
+
#end
|
77
|
+
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: etvnet-seek
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 63
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 8
|
9
|
+
- 0
|
10
|
+
version: 0.8.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Alexander Shvets
|
@@ -15,13 +15,154 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-12-04 00:00:00 -05:00
|
19
19
|
default_executable: etvnet-seek
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
name: nokogiri
|
25
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 3
|
31
|
+
segments:
|
32
|
+
- 0
|
33
|
+
version: "0"
|
34
|
+
requirement: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
name: libxml-ruby
|
39
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
version: "0"
|
48
|
+
requirement: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
22
52
|
name: json_pure
|
53
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
59
|
+
segments:
|
60
|
+
- 0
|
61
|
+
version: "0"
|
62
|
+
requirement: *id003
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
type: :development
|
65
|
+
prerelease: false
|
66
|
+
name: jeweler
|
67
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
hash: 3
|
73
|
+
segments:
|
74
|
+
- 0
|
75
|
+
version: "0"
|
76
|
+
requirement: *id004
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
type: :development
|
79
|
+
prerelease: false
|
80
|
+
name: gemcutter
|
81
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
hash: 3
|
87
|
+
segments:
|
88
|
+
- 0
|
89
|
+
version: "0"
|
90
|
+
requirement: *id005
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
type: :development
|
93
|
+
prerelease: false
|
94
|
+
name: rake
|
95
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
hash: 3
|
101
|
+
segments:
|
102
|
+
- 0
|
103
|
+
version: "0"
|
104
|
+
requirement: *id006
|
105
|
+
- !ruby/object:Gem::Dependency
|
106
|
+
type: :development
|
107
|
+
prerelease: false
|
108
|
+
name: highline
|
109
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
111
|
+
requirements:
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
hash: 3
|
115
|
+
segments:
|
116
|
+
- 0
|
117
|
+
version: "0"
|
118
|
+
requirement: *id007
|
119
|
+
- !ruby/object:Gem::Dependency
|
120
|
+
type: :development
|
121
|
+
prerelease: false
|
122
|
+
name: zipit
|
123
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
hash: 3
|
129
|
+
segments:
|
130
|
+
- 0
|
131
|
+
version: "0"
|
132
|
+
requirement: *id008
|
133
|
+
- !ruby/object:Gem::Dependency
|
134
|
+
type: :development
|
23
135
|
prerelease: false
|
24
|
-
|
136
|
+
name: ruby-debug-base
|
137
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
hash: 3
|
143
|
+
segments:
|
144
|
+
- 0
|
145
|
+
version: "0"
|
146
|
+
requirement: *id009
|
147
|
+
- !ruby/object:Gem::Dependency
|
148
|
+
type: :development
|
149
|
+
prerelease: false
|
150
|
+
name: ruby-debug-ide
|
151
|
+
version_requirements: &id010 !ruby/object:Gem::Requirement
|
152
|
+
none: false
|
153
|
+
requirements:
|
154
|
+
- - ">="
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
hash: 3
|
157
|
+
segments:
|
158
|
+
- 0
|
159
|
+
version: "0"
|
160
|
+
requirement: *id010
|
161
|
+
- !ruby/object:Gem::Dependency
|
162
|
+
type: :runtime
|
163
|
+
prerelease: false
|
164
|
+
name: json_pure
|
165
|
+
version_requirements: &id011 !ruby/object:Gem::Requirement
|
25
166
|
none: false
|
26
167
|
requirements:
|
27
168
|
- - ">="
|
@@ -32,12 +173,12 @@ dependencies:
|
|
32
173
|
- 2
|
33
174
|
- 0
|
34
175
|
version: 1.2.0
|
35
|
-
|
36
|
-
version_requirements: *id001
|
176
|
+
requirement: *id011
|
37
177
|
- !ruby/object:Gem::Dependency
|
38
|
-
|
178
|
+
type: :runtime
|
39
179
|
prerelease: false
|
40
|
-
|
180
|
+
name: highline
|
181
|
+
version_requirements: &id012 !ruby/object:Gem::Requirement
|
41
182
|
none: false
|
42
183
|
requirements:
|
43
184
|
- - ">="
|
@@ -48,12 +189,12 @@ dependencies:
|
|
48
189
|
- 5
|
49
190
|
- 1
|
50
191
|
version: 1.5.1
|
51
|
-
|
52
|
-
version_requirements: *id002
|
192
|
+
requirement: *id012
|
53
193
|
- !ruby/object:Gem::Dependency
|
54
|
-
|
194
|
+
type: :runtime
|
55
195
|
prerelease: false
|
56
|
-
|
196
|
+
name: libxml-ruby
|
197
|
+
version_requirements: &id013 !ruby/object:Gem::Requirement
|
57
198
|
none: false
|
58
199
|
requirements:
|
59
200
|
- - ">="
|
@@ -64,12 +205,12 @@ dependencies:
|
|
64
205
|
- 1
|
65
206
|
- 3
|
66
207
|
version: 1.1.3
|
67
|
-
|
68
|
-
version_requirements: *id003
|
208
|
+
requirement: *id013
|
69
209
|
- !ruby/object:Gem::Dependency
|
70
|
-
|
210
|
+
type: :runtime
|
71
211
|
prerelease: false
|
72
|
-
|
212
|
+
name: nokogiri
|
213
|
+
version_requirements: &id014 !ruby/object:Gem::Requirement
|
73
214
|
none: false
|
74
215
|
requirements:
|
75
216
|
- - ">="
|
@@ -80,12 +221,12 @@ dependencies:
|
|
80
221
|
- 4
|
81
222
|
- 1
|
82
223
|
version: 1.4.1
|
83
|
-
|
84
|
-
version_requirements: *id004
|
224
|
+
requirement: *id014
|
85
225
|
- !ruby/object:Gem::Dependency
|
86
|
-
|
226
|
+
type: :development
|
87
227
|
prerelease: false
|
88
|
-
|
228
|
+
name: rspec
|
229
|
+
version_requirements: &id015 !ruby/object:Gem::Requirement
|
89
230
|
none: false
|
90
231
|
requirements:
|
91
232
|
- - ">="
|
@@ -96,12 +237,12 @@ dependencies:
|
|
96
237
|
- 2
|
97
238
|
- 9
|
98
239
|
version: 1.2.9
|
99
|
-
|
100
|
-
version_requirements: *id005
|
240
|
+
requirement: *id015
|
101
241
|
- !ruby/object:Gem::Dependency
|
102
|
-
|
242
|
+
type: :development
|
103
243
|
prerelease: false
|
104
|
-
|
244
|
+
name: mocha
|
245
|
+
version_requirements: &id016 !ruby/object:Gem::Requirement
|
105
246
|
none: false
|
106
247
|
requirements:
|
107
248
|
- - ">="
|
@@ -112,8 +253,7 @@ dependencies:
|
|
112
253
|
- 9
|
113
254
|
- 7
|
114
255
|
version: 0.9.7
|
115
|
-
|
116
|
-
version_requirements: *id006
|
256
|
+
requirement: *id016
|
117
257
|
description: Command line tool for getting mms urls from etvnet service.
|
118
258
|
email: alexander.shvets@gmail.com
|
119
259
|
executables:
|
@@ -131,10 +271,12 @@ files:
|
|
131
271
|
- bin/etvnet-seek
|
132
272
|
- bin/etvnet-seek.bat
|
133
273
|
- etvnet-seek.gemspec
|
274
|
+
- lib/etvnet_seek/accessor.rb
|
134
275
|
- lib/etvnet_seek/commander.rb
|
135
276
|
- lib/etvnet_seek/cookie_helper.rb
|
136
277
|
- lib/etvnet_seek/core/access_page.rb
|
137
|
-
- lib/etvnet_seek/core/
|
278
|
+
- lib/etvnet_seek/core/audio_page.rb
|
279
|
+
- lib/etvnet_seek/core/best_hundred_page.rb
|
138
280
|
- lib/etvnet_seek/core/browse_media_item.rb
|
139
281
|
- lib/etvnet_seek/core/catalog_item.rb
|
140
282
|
- lib/etvnet_seek/core/catalog_page.rb
|
@@ -143,6 +285,8 @@ files:
|
|
143
285
|
- lib/etvnet_seek/core/group_media_item.rb
|
144
286
|
- lib/etvnet_seek/core/group_page.rb
|
145
287
|
- lib/etvnet_seek/core/home_page.rb
|
288
|
+
- lib/etvnet_seek/core/items_page.rb
|
289
|
+
- lib/etvnet_seek/core/items_page_factory.rb
|
146
290
|
- lib/etvnet_seek/core/login_page.rb
|
147
291
|
- lib/etvnet_seek/core/media_info.rb
|
148
292
|
- lib/etvnet_seek/core/media_item.rb
|
@@ -150,9 +294,11 @@ files:
|
|
150
294
|
- lib/etvnet_seek/core/new_item.rb
|
151
295
|
- lib/etvnet_seek/core/new_items_page.rb
|
152
296
|
- lib/etvnet_seek/core/page.rb
|
153
|
-
- lib/etvnet_seek/core/
|
297
|
+
- lib/etvnet_seek/core/premiere_page.rb
|
298
|
+
- lib/etvnet_seek/core/radio_page.rb
|
154
299
|
- lib/etvnet_seek/core/search_page.rb
|
155
300
|
- lib/etvnet_seek/core/service_call.rb
|
301
|
+
- lib/etvnet_seek/core/top_this_week_page.rb
|
156
302
|
- lib/etvnet_seek/easy_auth.rb
|
157
303
|
- lib/etvnet_seek/etvnet_seek.rb
|
158
304
|
- lib/etvnet_seek/link_info.rb
|
@@ -162,13 +308,15 @@ files:
|
|
162
308
|
- lib/progressbar.rb
|
163
309
|
- lib/runglish.rb
|
164
310
|
- spec/etvnet_seek_spec.rb
|
311
|
+
- spec/spec_helper.rb
|
312
|
+
- spec/unit/pages_spec.rb
|
165
313
|
has_rdoc: true
|
166
314
|
homepage: http://github.com/shvets/etvnet-seek
|
167
315
|
licenses: []
|
168
316
|
|
169
317
|
post_install_message:
|
170
|
-
rdoc_options:
|
171
|
-
|
318
|
+
rdoc_options: []
|
319
|
+
|
172
320
|
require_paths:
|
173
321
|
- lib
|
174
322
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -198,3 +346,5 @@ specification_version: 3
|
|
198
346
|
summary: Accessing etvnet service from command line.
|
199
347
|
test_files:
|
200
348
|
- spec/etvnet_seek_spec.rb
|
349
|
+
- spec/spec_helper.rb
|
350
|
+
- spec/unit/pages_spec.rb
|
@@ -1,43 +0,0 @@
|
|
1
|
-
class BasePage < Page
|
2
|
-
|
3
|
-
def title
|
4
|
-
document.css("title").text
|
5
|
-
end
|
6
|
-
|
7
|
-
def page_title
|
8
|
-
document.css(".conteiner h1").text
|
9
|
-
end
|
10
|
-
|
11
|
-
protected
|
12
|
-
|
13
|
-
def collect_links path
|
14
|
-
list = []
|
15
|
-
|
16
|
-
document.css("#{path} a").each do |item|
|
17
|
-
href = item.attributes['href'].value
|
18
|
-
text = item.text
|
19
|
-
|
20
|
-
list << MediaItem.new(text, href)
|
21
|
-
end
|
22
|
-
|
23
|
-
list
|
24
|
-
end
|
25
|
-
|
26
|
-
def collect_images path
|
27
|
-
list = []
|
28
|
-
|
29
|
-
document.css("#{path} img").each do |item|
|
30
|
-
list << item.attributes['src'].value.strip
|
31
|
-
end
|
32
|
-
|
33
|
-
list
|
34
|
-
end
|
35
|
-
|
36
|
-
def additional_info node, index
|
37
|
-
children = node.parent.children
|
38
|
-
if children.size > 0
|
39
|
-
element = children.at(index)
|
40
|
-
element.text if element
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|