nicovideo 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +8 -0
- data/config/hoe.rb +4 -2
- data/lib/nicovideo.rb +1 -0
- data/lib/nicovideo/page.rb +4 -4
- data/lib/nicovideo/version.rb +1 -1
- data/test/test_thumbnail.rb +31 -0
- data/test/test_videopage.rb +7 -0
- metadata +3 -2
data/ChangeLog
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
2008-07-17 version 0.1.5
|
2
|
+
|
3
|
+
* fixed subtitle of Nicovideo (SP1 -> summer)
|
4
|
+
|
5
|
+
2008-03-20 version 0.1.4
|
6
|
+
|
7
|
+
* added function Nicovideo#newarrival and Nicovideo::VideoPage#type
|
8
|
+
|
1
9
|
2008-03-16 version 0.1.3
|
2
10
|
|
3
11
|
* fixed unable to download with mechanize 0.7.1 or later
|
data/config/hoe.rb
CHANGED
@@ -58,7 +58,8 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
|
58
58
|
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
|
59
59
|
|
60
60
|
# == Optional
|
61
|
-
p.changes = p.paragraphs_of("History.txt", 0..1).join("\\n\\n")
|
61
|
+
#p.changes = p.paragraphs_of("History.txt", 0..1).join("\\n\\n")
|
62
|
+
p.changes = p.paragraphs_of("ChangeLog", 0..1).join("\\n\\n")
|
62
63
|
#p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
|
63
64
|
p.extra_deps = [
|
64
65
|
['mechanize', '>=0.6.0']
|
@@ -66,6 +67,7 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
|
66
67
|
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
67
68
|
end
|
68
69
|
|
69
|
-
CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
70
|
+
#CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
71
|
+
CHANGES = hoe.paragraphs_of('ChangeLog', 0..1).join("\\n\\n")
|
70
72
|
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
71
73
|
hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
data/lib/nicovideo.rb
CHANGED
data/lib/nicovideo/page.rb
CHANGED
@@ -6,8 +6,8 @@ module Nicovideo
|
|
6
6
|
NV_DEBUG_LEVEL = 0
|
7
7
|
|
8
8
|
BASE_URL = 'http://www.nicovideo.jp'
|
9
|
-
BASE_TITLE1 = '‐ニコニコ動画\(
|
10
|
-
BASE_TITLE2 = 'ニコニコ動画\(
|
9
|
+
BASE_TITLE1 = '‐ニコニコ動画\(夏\)'.toutf8
|
10
|
+
BASE_TITLE2 = 'ニコニコ動画\(夏\)‐'.toutf8
|
11
11
|
|
12
12
|
def initialize agent
|
13
13
|
@agent = agent
|
@@ -41,7 +41,7 @@ module Nicovideo
|
|
41
41
|
def register_getter(params)
|
42
42
|
params.each {|p|
|
43
43
|
p_noq = p.sub(/\?$/,'')
|
44
|
-
eval
|
44
|
+
eval <<-E
|
45
45
|
@#{p_noq} = nil
|
46
46
|
def #{p}
|
47
47
|
if @#{p_noq}.nil?
|
@@ -49,7 +49,7 @@ module Nicovideo
|
|
49
49
|
end
|
50
50
|
@#{p_noq}
|
51
51
|
end
|
52
|
-
E
|
52
|
+
E
|
53
53
|
}
|
54
54
|
end
|
55
55
|
|
data/lib/nicovideo/version.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
require 'kagemusha'
|
3
|
+
require 'open-uri'
|
4
|
+
|
5
|
+
class Test_Thumbnail < Test::Unit::TestCase
|
6
|
+
def setup
|
7
|
+
@client = Nicovideo::Thumbnail.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_get
|
11
|
+
thumbnail = @client.get("sm2424611")
|
12
|
+
assert("sm2424611", thumbnail["video_id"])
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_get_nonexistent_video
|
16
|
+
assert_raise(::Errno::ENOENT) {
|
17
|
+
@client.get "sm1"
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_get_timeout
|
22
|
+
Kagemusha.new(Kernel) do |m|
|
23
|
+
m.def(:open) { sleep 30 }
|
24
|
+
m.swap {
|
25
|
+
assert_raise(TimeoutError) {
|
26
|
+
@client.get("sm2424611")
|
27
|
+
}
|
28
|
+
}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/test/test_videopage.rb
CHANGED
@@ -23,6 +23,13 @@ class TestNicovideoVideoPage < Test::Unit::TestCase
|
|
23
23
|
sleep 5
|
24
24
|
end
|
25
25
|
|
26
|
+
def test_type
|
27
|
+
vp = @nv.watch(@vid_valid) {|vp|
|
28
|
+
assert_instance_of(String, vp.type)
|
29
|
+
puts vp.type
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
26
33
|
def test_watch_valid
|
27
34
|
vp = nil
|
28
35
|
assert_nothing_raised {
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: nicovideo
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.1.
|
7
|
-
date: 2008-
|
6
|
+
version: 0.1.5
|
7
|
+
date: 2008-07-17 00:00:00 +09:00
|
8
8
|
summary: utils for nicovideo
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- sample/nv_ranking.rb
|
68
68
|
test_files:
|
69
69
|
- test/test_openlist.rb
|
70
|
+
- test/test_thumbnail.rb
|
70
71
|
- test/test_nicovideo.rb
|
71
72
|
- test/test_mylist.rb
|
72
73
|
- test/test_ranking.rb
|