syoboi_calendar 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -11,7 +11,8 @@ $ gem install syoboi_calendar
11
11
  ## Usage
12
12
 
13
13
  ```
14
- require "syoboi_calender"
14
+ require "syoboi_calendar"
15
+ require "date"
15
16
 
16
17
  client = SyoboiCalendar.new(
17
18
  :user => "r7kamura",
@@ -19,7 +20,7 @@ client = SyoboiCalendar.new(
19
20
  )
20
21
  programs = client.search(
21
22
  :first => true,
22
- :range => "2012/4/1-2012/4/30"
23
+ :range => Date.today .. Date.today + 7
23
24
  )
24
25
 
25
26
  p programs[0].name #=> "さんかれあ #1 私が…ゾンビに…なったら"
@@ -65,6 +65,21 @@ class SyoboiCalendar
65
65
  end
66
66
  end
67
67
 
68
+ def staff
69
+ staff_map.values
70
+ end
71
+
72
+ def role
73
+ staff_map.keys
74
+ end
75
+
76
+ def staff_map
77
+ @staff_map ||= begin
78
+ update_detail_from_comment
79
+ @staff_map
80
+ end
81
+ end
82
+
68
83
  def url
69
84
  @url ||= begin
70
85
  update_detail_from_comment
@@ -72,6 +87,15 @@ class SyoboiCalendar
72
87
  end
73
88
  end
74
89
 
90
+ def parsed_subtitles
91
+ results = []
92
+ subtitles.split("\r\n").each do |subtitle_str|
93
+ next unless subtitle_str =~ /\A\*(\d+)\*(.+)\Z/
94
+ results << { number: $1.to_i, subtitle: $2 }
95
+ end
96
+ results
97
+ end
98
+
75
99
  private
76
100
 
77
101
  # update params from detail data
@@ -106,6 +130,7 @@ class SyoboiCalendar
106
130
  hash = parse_comment
107
131
  @url = hash[:url]
108
132
  @voice_actor_map = hash[:voice_actor_map]
133
+ @staff_map = hash[:staff_map]
109
134
  @is_already_updated_from_comment = true
110
135
  end
111
136
 
@@ -113,6 +138,7 @@ class SyoboiCalendar
113
138
  {
114
139
  :url => extract_url,
115
140
  :voice_actor_map => extract_voice_actor_map,
141
+ :staff_map => extract_staff_map,
116
142
  }
117
143
  end
118
144
 
@@ -125,8 +151,18 @@ class SyoboiCalendar
125
151
  # *{section1}:key1:val1\r\n:key2:val2\r\n
126
152
  # *{section2}:key1:val1\r\n:key2:val2\r\n
127
153
  def extract_voice_actor_map
154
+ extract_some_map(/^キャスト/)
155
+ end
156
+
157
+ # staff is like following format
158
+ # *{section1}:key1:val1\r\n:key2:val2\r\n
159
+ def extract_staff_map
160
+ extract_some_map(/^スタッフ/)
161
+ end
162
+
163
+ def extract_some_map(section_regex)
128
164
  sections = comment.split(/^\*/)
129
- section = sections.select { |sec| sec =~ /^キャスト/ }[0] or return
165
+ section = sections.select { |sec| sec =~ section_regex }[0] or return
130
166
  lines = section.split(/\r\n/)
131
167
  lines.inject({}) do |hash, line|
132
168
  _, character, actor = line.split(/:/)
@@ -1,3 +1,3 @@
1
1
  class SyoboiCalendar
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -5,37 +5,56 @@ require "spec_helper"
5
5
  describe "SyoboiCalendar::Title" do
6
6
  before do
7
7
  @title = SyoboiCalendar::Title.new(
8
- :tid => "2466",
9
- :name => "アクセル・ワールド",
8
+ tid: "2466",
9
+ name: "アクセル・ワールド",
10
10
  )
11
+ @title.stub(:comment) {
12
+ %w[
13
+ *リンク
14
+ -[[公式 http://www.accel-world.net/]]
15
+ -[[BS11デジタル http://www.bs11.jp/anime/1699/]]
16
+ *スタッフ
17
+ :原作:川原礫(電撃文庫)
18
+ :原作イラスト:HIMA
19
+ *オープニングテーマ1「Chase the world」
20
+ :作詞:井上秋緒
21
+ :作曲・編曲:浅倉大介
22
+ :歌:May\'n
23
+ :使用話数:#2~#13
24
+ *エンディングテーマ1「→unfinished→」
25
+ :作詞・歌:KOTOKO
26
+ :作曲・編曲:八木沼悟志
27
+ :使用話数:#2~#4、#6~#13
28
+ *キャスト
29
+ :黒雪姫/ブラック・ロータス:三澤紗千香
30
+ :有田春雪/シルバー・クロウ:梶裕貴
31
+ ].join("\r\n").gsub("$", " ")
32
+ }
33
+ @title.stub(:subtitles) { "*01*Acceleration;加速\r\n*02*Transformation;変移" }
11
34
  end
12
35
 
36
+ # リンク
13
37
  describe "#url" do
14
- before do
15
- @title.stub(:comment) {
16
- %w[
17
- *リンク
18
- -[[テレビ東京$http://www.tv-tokyo.co.jp/anime/mukashibanashi/]]
19
- *スタッフ
20
- *オープニングテーマ「一人のキミが生まれたとさ」
21
- :作詞・作曲:大倉智之(INSPi)
22
- :編曲:吉田圭介(INSPi)、貞国公洋
23
- :コーラス:INSPi
24
- :歌:中川翔子
25
- *エンディングテーマ「あるこう」
26
- :作詞:吉田圭介(INSPi)、大倉智之(INSPi)
27
- :作曲:吉田圭介(INSPi)
28
- :編曲:齋藤真也
29
- :歌:中川翔子
30
- *キャスト
31
- :語り手:柄本明
32
- :語り手:松金よね子
33
- ].join("\r\n").gsub("$", " ")
34
- }
35
- end
36
-
37
38
  it "return url of official website" do
38
- @title.url.should == "http://www.tv-tokyo.co.jp/anime/mukashibanashi/"
39
+ @title.url.should == "http://www.accel-world.net/"
39
40
  end
40
41
  end
42
+
43
+ # スタッフ
44
+ it { @title.staff.should == ['川原礫(電撃文庫)', 'HIMA'] }
45
+ it { @title.role.should == ['原作', '原作イラスト'] }
46
+ it { @title.staff_map.should == { "原作"=>"川原礫(電撃文庫)", "原作イラスト"=>"HIMA" } }
47
+
48
+ # キャスト
49
+ it { @title.voice_actors.should == ['三澤紗千香', '梶裕貴'] }
50
+ it { @title.characters.should == ['黒雪姫/ブラック・ロータス', '有田春雪/シルバー・クロウ'] }
51
+ it { @title.voice_actor_map.should == { "黒雪姫/ブラック・ロータス"=>"三澤紗千香", "有田春雪/シルバー・クロウ"=>"梶裕貴" } }
52
+
53
+ # サブタイトル
54
+ it "#parsed_subtitles" do
55
+ @title.parsed_subtitles.should == [
56
+ { number: 1, subtitle: "Acceleration;加速" },
57
+ { number: 2, subtitle: "Transformation;変移" }
58
+ ]
59
+ end
41
60
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syoboi_calendar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-22 00:00:00.000000000 Z
12
+ date: 2013-04-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mechanize
16
- requirement: &70208228304300 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '2.3'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70208228304300
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '2.3'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: rake
27
- requirement: &70208228303400 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: 0.9.2
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *70208228303400
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 0.9.2
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: rspec
38
- requirement: &70208228302780 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: 2.9.0
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *70208228302780
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 2.9.0
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: webmock
49
- requirement: &70208228302120 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ! '>='
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: 1.8.6
55
70
  type: :development
56
71
  prerelease: false
57
- version_requirements: *70208228302120
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 1.8.6
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: simplecov
60
- requirement: &70208228301540 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ! '>='
@@ -65,10 +85,15 @@ dependencies:
65
85
  version: 0.6.1
66
86
  type: :development
67
87
  prerelease: false
68
- version_requirements: *70208228301540
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: 0.6.1
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: simplecov-vim
71
- requirement: &70208228300620 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
72
97
  none: false
73
98
  requirements:
74
99
  - - ! '>='
@@ -76,7 +101,12 @@ dependencies:
76
101
  version: 0.0.1
77
102
  type: :development
78
103
  prerelease: false
79
- version_requirements: *70208228300620
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: 0.0.1
80
110
  description: Simple gem for Syoboi Calendar
81
111
  email:
82
112
  - r7kamura@gmail.com
@@ -87,7 +117,6 @@ files:
87
117
  - .gitignore
88
118
  - .travis.yml
89
119
  - Gemfile
90
- - Gemfile.lock
91
120
  - LICENSE
92
121
  - README.md
93
122
  - Rakefile
@@ -122,7 +151,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
151
  version: '0'
123
152
  segments:
124
153
  - 0
125
- hash: 1762739173120087868
154
+ hash: 126664899332603518
126
155
  required_rubygems_version: !ruby/object:Gem::Requirement
127
156
  none: false
128
157
  requirements:
@@ -131,10 +160,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
160
  version: '0'
132
161
  segments:
133
162
  - 0
134
- hash: 1762739173120087868
163
+ hash: 126664899332603518
135
164
  requirements: []
136
165
  rubyforge_project:
137
- rubygems_version: 1.8.15
166
+ rubygems_version: 1.8.23
138
167
  signing_key:
139
168
  specification_version: 3
140
169
  summary: Search Japanese Anime Lineup
data/Gemfile.lock DELETED
@@ -1,60 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- syoboi_calendar (0.1.2)
5
- mechanize (>= 2.3)
6
-
7
- GEM
8
- remote: http://rubygems.org/
9
- specs:
10
- addressable (2.2.7)
11
- crack (0.3.1)
12
- diff-lcs (1.1.3)
13
- domain_name (0.5.2)
14
- unf (~> 0.0.3)
15
- mechanize (2.3)
16
- domain_name (~> 0.5, >= 0.5.1)
17
- mime-types (~> 1.17, >= 1.17.2)
18
- net-http-digest_auth (~> 1.1, >= 1.1.1)
19
- net-http-persistent (~> 2.5, >= 2.5.2)
20
- nokogiri (~> 1.4)
21
- ntlm-http (~> 0.1, >= 0.1.1)
22
- webrobots (~> 0.0, >= 0.0.9)
23
- mime-types (1.18)
24
- multi_json (1.2.0)
25
- net-http-digest_auth (1.2)
26
- net-http-persistent (2.6)
27
- nokogiri (1.5.2)
28
- ntlm-http (0.1.1)
29
- rake (0.9.2.2)
30
- rspec (2.9.0)
31
- rspec-core (~> 2.9.0)
32
- rspec-expectations (~> 2.9.0)
33
- rspec-mocks (~> 2.9.0)
34
- rspec-core (2.9.0)
35
- rspec-expectations (2.9.1)
36
- diff-lcs (~> 1.1.3)
37
- rspec-mocks (2.9.0)
38
- simplecov (0.6.1)
39
- multi_json (~> 1.0)
40
- simplecov-html (~> 0.5.3)
41
- simplecov-html (0.5.3)
42
- simplecov-vim (0.0.1)
43
- unf (0.0.5)
44
- unf_ext
45
- unf_ext (0.0.4)
46
- webmock (1.8.6)
47
- addressable (>= 2.2.7)
48
- crack (>= 0.1.7)
49
- webrobots (0.0.13)
50
-
51
- PLATFORMS
52
- ruby
53
-
54
- DEPENDENCIES
55
- rake (>= 0.9.2)
56
- rspec (>= 2.9.0)
57
- simplecov (>= 0.6.1)
58
- simplecov-vim (>= 0.0.1)
59
- syoboi_calendar!
60
- webmock (>= 1.8.6)