syoboi_calendar 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,234 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2
+ "http://www.w3.org/TR/html4/loose.dtd">
3
+ <html lang="ja">
4
+ <head>
5
+ <meta http-equiv="Content-Style-Type" content="text/css">
6
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7
+ <meta http-equiv="X-UA-Compatible" content="IE=7">
8
+ <link rel="stylesheet" type="text/css" href="/css/common.css">
9
+
10
+
11
+ <!-- HtmlStyle -->
12
+ <style type="text/css">
13
+ .EPGMark { float:left; }
14
+ span.chGroup { display:none; }
15
+
16
+ #filter_browser th,
17
+ #filter_browser td { background-color:#E3F0FD; border:1px solid #B1D0EF; }
18
+ table.mcal div.box.mark { border:1px solid #e00; outline:2px solid #fa0; }
19
+
20
+ table.findform { margin-left:auto; margin-right:auto; border:2px solid #B1D0EF; }
21
+ table.findform th { text-align:right; color:#444; padding:2px 2px; }
22
+ table.findform th {
23
+ padding:0px 8px; vertical-align:top; border-top:0px dashed #B1D0EF; }
24
+ table.findform td {
25
+ padding:0px 8px; border-top:0px dashed #B1D0EF;
26
+ }
27
+ table.findform td.sd_selector {
28
+ text-align:center;
29
+ }
30
+
31
+ label.checked { font-weight:bold; }
32
+
33
+ table.sd_selector { margin-left:auto; margin-right:auto; }
34
+ table.sd_selector td { text-align:center; border:0px solid #B1D0EF; }
35
+ table.sd_selector td.checked { background-color:#B1D0EF; font-weight:bold; }
36
+ table.sd_selector td label { padding:.1em 1em; display:block; }
37
+ </style>
38
+ <!-- /HtmlStyle -->
39
+
40
+
41
+ <style type="text/css">
42
+ </style>
43
+
44
+ <script type="text/javascript">
45
+ var _SYOBOCAL_PATH = "/";
46
+ var _SYOBOCAL_LOGIN = 0;
47
+ var _SYOBOCAL_DS = 5;
48
+ </script>
49
+
50
+ <title>検索 - しょぼいカレンダー</title>
51
+
52
+ </head>
53
+ <body>
54
+
55
+ <table width="100%" id="header">
56
+ <tr>
57
+ <td>
58
+ <form action="/find" method="GET" name="QuickFindForm">
59
+ <input type="hidden" name="type" value="quick">
60
+ <input type="hidden" name="sd" value="1">
61
+ <a class="title" href="/">しょぼいカレンダー</a>
62
+
63
+
64
+ <span class="username">
65
+ <a href="/usr" rel="nofollow">ログイン</a>
66
+ </span>
67
+
68
+ <input type="text" id="headSearchBox" name="kw" size="16" value="" tabindex="1" autocomplete="off" placeholder="キー ワード/日付" title="日付(M/D)やキーワードを入力して検索">
69
+ <input type="submit" id="headSearchButton" name="exec" value="検索" tabindex="2" style="padding:0 .5em;">
70
+ </form>
71
+ </td>
72
+ <td class="menu">
73
+ <a href="/">番組表</a>
74
+ | <a href="/list">一覧</a>
75
+ | <a href="/find">検索</a>
76
+ | <a href="/config" rel="nofollow">設定</a>
77
+ || <a href="http://jbbs.livedoor.jp/anime/3083/">掲示板</a>
78
+ | <a href="http://sites.google.com/site/syobocal/">その他</a>
79
+ | <a href="javascript:undefined" id="linkSheetButton" rel="nofollow">リンク<span class="mark">▼</span><span class="mark" style="display:none">▲</span></a>
80
+ </td>
81
+ </tr>
82
+ </table>
83
+ <div id="headSearchResult" style="display:none"></div>
84
+
85
+ <div id="linkSheet" style="display:none"></div>
86
+ <div id="popup" style="display:none; position:absolute;"></div>
87
+
88
+
89
+
90
+ <noscript>
91
+ <div class="errmsg">JavaScript が off のため、一部の機能が正常に動作しません</div>
92
+ </noscript>
93
+
94
+ <div id="main">
95
+ <h1>検索</h1>
96
+ <div class="section">
97
+
98
+ <form action="/find" method="get" name="findform">
99
+
100
+
101
+ <table class="sd_selector">
102
+ <tr>
103
+ <td width="50%">
104
+ <label for="sd0"><input type="radio" id="sd0" name="sd" value="0" checked>タイトルを検索</label> </td>
105
+ <td width="50%">
106
+ <label for="sd2"><input type="radio" id="sd2" name="sd" value="2" >放送時間を検索</label> </td>
107
+ </tr>
108
+ </table>
109
+ <table class="TableColor findform">
110
+ <tr>
111
+ <td colspan="2">
112
+ </td>
113
+ </tr>
114
+ <tr>
115
+ <th>タイトル</th>
116
+ <td>
117
+ <input type="text" id="kw_input" name="kw" style="width:18em" value="ひだまりスケッチ">
118
+ <input type="submit" value=" 検索 "><br>
119
+
120
+ </td>
121
+ </tr>
122
+ <tr class="sd2">
123
+ <th>チャンネル</th>
124
+ <td>
125
+ <input type="text" id="st_input" name="ch" style="width:18em" value="">
126
+ <br>
127
+ <label for=uuc1><input type=checkbox id=uuc1 name=uuc value=1 checked>設定したチャネルのみ</label>&nbsp; </td>
128
+ </tr>
129
+ <tr class="sd2">
130
+ <th>サブタイトル</th>
131
+ <td>
132
+ <input type="text" id="st_input" name="st" style="width:18em" value="">
133
+ </td>
134
+ </tr>
135
+ <tr class="sd2">
136
+ <th>コメント</th>
137
+ <td>
138
+ <input type="text" id="cm_input" name="cm" style="width:18em" value="">
139
+ </td>
140
+ </tr>
141
+ <tr>
142
+ <th>日付</th>
143
+ <td>
144
+ <label for="r0"><input type="radio" id="r0" name="r" value="0" checked>すべて</label> <label for="r1"><input type="radio" id="r1" name="r" value="1" >過去</label> <label for="r2"><input type="radio" id="r2" name="r" value="2" >今日以降</label><br>
145
+ <label for="r3"><input type="radio" id="r3" name="r" value="3" >範囲指定</label> <input type="text" name="rd" style="width:11em" value="">
146
+ <br>
147
+ <small>例) 2002/3/1- , -2003/9/1 , 2003/4/1-2003/9/1</small>
148
+ </td>
149
+ </tr>
150
+ <tr class="sd2">
151
+ <th>フラグ検索</th>
152
+ <td>
153
+ <label for=pfn2><input type=checkbox id=pfn2 name=pfn value=2 >新番組</label>&nbsp; <label for=pfl4><input type=checkbox id=pfl4 name=pfl value=4 >最終回</label>&nbsp; <label for=pfs1><input type=checkbox id=pfs1 name=pfs value=1 >注目</label>&nbsp; </td>
154
+ </tr>
155
+ <tr class="sd2">
156
+ <th>表示形式</th>
157
+ <td>
158
+ <label for="v0"><input type="radio" id="v0" name="v" value="0" checked>リスト</label> <label for="v1"><input type="radio" id="v1" name="v" value="1" >表</label> </td>
159
+ </tr>
160
+ <!--
161
+ <tr>
162
+ <th>表示順</th>
163
+ <td>
164
+ <select name="s">
165
+ <option value="0">日付、チャンネル</option>
166
+ <option value="1" selected>チャンネル、日付</option>
167
+ <option value="2">タイトル、チャンネル、日付</option>
168
+ </select>
169
+ </td>
170
+ </tr>
171
+ -->
172
+ </table>
173
+ </form>
174
+ </div>
175
+
176
+ <br>
177
+ <table border=0 align="center" width="100%">
178
+ <tr>
179
+ <td valign="top" width="35%"><h2>タイトル情報の検索結果 - <b>4</b> 件</h2>
180
+ <small><b style="margin-right:.75em">キーワード:</b>ひだまりスケッチ (<a href="/relation?kw=%E3%81%B2%E3%81%A0%E3%81%BE%E3%82%8A%E3%82%B9%E3%82%B1%E3%83%83%E3%83%81" rel="nofollow">関連検索</a>)<br/></small><table class="tframe" cellspacing=1 width="100%"><tr><td><a href="/tid/2246">ひだまりスケッチ×SP</a><br><div class="findComment">2011-10~2011-11<br>スタッフ&nbsp;&gt;&nbsp;原作&nbsp;&gt;&nbsp;蒼樹うめ「<b>ひだまりスケッチ</b>」<br></div></td></tr><tr><td><a href="/tid/1809">ひだまり スケッチ×☆☆☆</a><br><div class="findComment">2010-1~2010-3<br>スタッフ&nbsp;&gt;&nbsp;原作&nbsp;&gt;&nbsp;蒼樹うめ「<b>ひ だまりスケッチ</b>」<br></div></td></tr><tr><td><a href="/tid/1407">ひだまりスケッチ×365</a><br><div class="findComment">2008-7~2008-9<br>-「<b>ひだまりスケッチ</b>」「<b>ひだまりスケッチ</b>×365」の全30話(特別編含む)から人気投票で選ばれた13話を放送<br>スタッフ&nbsp;&gt;&nbsp;原作&nbsp;&gt;&nbsp;蒼樹うめ「<b>ひだまりスケッチ</b>」<br></div></td></tr><tr><td><a href="/tid/982">ひだまりスケッチ</a><br><div class="findComment">2007-1~2007-3<br>-「<b>ひだまりスケッチ</b>」「<b>ひだまりスケッチ</b>×365」の全30話(特別編含む)から人気投票で選ばれた13話を放送<br></div></td></tr></table>
181
+ <br><h2>外部サイトの検索結果 - <b>10</b> 件</h2>
182
+ <table class="tframe" cellspacing=1 width="100%">
183
+ <tr><td><a href="http://ja.wikipedia.org/wiki/ひだまりスケッチ" target="_blank" rel="nofollow">ひだまりスケッチ</a> <span class="findSource">(Wikipedia)</span></td></tr>
184
+ <tr><td><a href="http://ja.wikipedia.org/wiki/ひだまりスケッチ_(アニメ)" target="_blank" rel="nofollow">ひだまりスケッチ_( アニメ)</a> <span class="findSource">(Wikipedia)</span></td></tr>
185
+ <tr><td><a href="http://ja.wikipedia.org/wiki/ひだまりスケッチ365" target="_blank" rel="nofollow">ひだまりスケッチ365</a> <span class="findSource">(Wikipedia)</span></td></tr>
186
+ <tr><td><a href="http://ja.wikipedia.org/wiki/ひだまりスケッチ×365" target="_blank" rel="nofollow">ひだまりスケッチ×365</a> <span class="findSource">(Wikipedia)</span></td></tr>
187
+ <tr><td><a href="http://ja.wikipedia.org/wiki/ひだまりスケッチ×365_キャラクターソング" target="_blank" rel="nofollow">ひだ まりスケッチ×365_キャラクターソング</a> <span class="findSource">(Wikipedia)</span></td></tr>
188
+ <tr><td><a href="http://ja.wikipedia.org/wiki/ひだまりスケッチ×SP" target="_blank" rel="nofollow">ひだまりスケッチ×SP</a> <span class="findSource">(Wikipedia)</span></td></tr>
189
+ <tr><td><a href="http://ja.wikipedia.org/wiki/ひだまりスケッチ×☆☆☆" target="_blank" rel="nofollow">ひだまりスケッチ×☆☆☆</a> <span class="findSource">(Wikipedia)</span></td></tr>
190
+ <tr><td><a href="http://ja.wikipedia.org/wiki/ひだまりスケッチ_どこでもすごろく×365" target="_blank" rel="nofollow">ひだま りスケッチ_どこでもすごろく×365</a> <span class="findSource">(Wikipedia)</span></td></tr>
191
+ <tr><td><a href="http://ja.wikipedia.org/wiki/ひだまりスケッチのディスコグラフィ" target="_blank" rel="nofollow">ひだまりスケッチのディスコグラフィ</a> <span class="findSource">(Wikipedia)</span></td></tr>
192
+ <tr><td><a href="http://ja.wikipedia.org/wiki/ひだまりスケッチ_オリジナルサウンドトラック" target="_blank" rel="nofollow"> ひだまりスケッチ_オリジナルサウンドトラック</a> <span class="findSource">(Wikipedia)</span></td></tr>
193
+ </table><br>
194
+ </td>
195
+ </tr>
196
+ </table>
197
+
198
+ <br>
199
+
200
+ <hr>
201
+ <center>
202
+
203
+ <form action="http://www.google.co.jp/search" method="GET">
204
+ <input type="hidden" name="hl" value="ja">
205
+ <input type="hidden" name="as_sitesearch" value="cal.syoboi.jp">
206
+ <input type="text" name="q" value="ひだまりスケッチ">
207
+ <input type="submit" value="cal.syoboi.jp 内検索(Google)">
208
+ </form>
209
+
210
+
211
+ </center>
212
+
213
+ </div> <!-- /.main -->
214
+
215
+
216
+ <div id="footer">
217
+ <div style="font-size:8pt" title="処理時間 0.0139 秒">すべてのデータは手入力されており、間違った情報が登録されている場合が あります。<br>
218
+ データの修正依頼は<a href="http://jbbs.livedoor.jp/anime/3083/">掲示板</a>から。意見や要望や不具合の報告は<a href="/tuuhou">通報ページ</a>から。</div>
219
+ </div>
220
+ <script type="text/javascript" src="/js/jquery-1.3.2.min.js"></script>
221
+ <script type="text/javascript" src="/js/common.js?20091203"></script>
222
+ <script type="text/javascript" src="/js/filter_browser.js"></script><script type="text/javascript" src="/js/find.js"></script>
223
+ <script type="text/javascript">
224
+ var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
225
+ document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
226
+ </script>
227
+ <script type="text/javascript">
228
+ try {
229
+ var pageTracker = _gat._getTracker("UA-51343-1");
230
+ pageTracker._trackPageview();
231
+ } catch(err) {}</script>
232
+
233
+ </body>
234
+ </html>
@@ -0,0 +1,29 @@
1
+ $LOAD_PATH.unshift File.expand_path("../", __FILE__)
2
+ $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
3
+
4
+ require "simplecov"
5
+ SimpleCov.start
6
+
7
+ require "syoboi_calendar"
8
+ require "webmock/rspec"
9
+
10
+ WebMock.allow_net_connect!
11
+
12
+ module SyoboiCalendar::Fixture
13
+ extend self
14
+
15
+ FIXTURE_DIR = File.expand_path("../fixtures", __FILE__)
16
+
17
+ private
18
+
19
+ def method_missing(method_name, *args)
20
+ cache[method_name] ||= begin
21
+ path = "#{FIXTURE_DIR}/#{method_name}"
22
+ File.exist?(path) ? cache[method_name] = File.read(path) : nil
23
+ end
24
+ end
25
+
26
+ def cache
27
+ @cache ||= {}
28
+ end
29
+ end
@@ -0,0 +1,36 @@
1
+ require "spec_helper"
2
+
3
+ describe "SyoboiCalendar::Agent" do
4
+ describe "#initialize" do
5
+ before do
6
+ login_url = SyoboiCalendar::Agent::LOGIN_URL
7
+ search_url = SyoboiCalendar::Agent::SEARCH_URL
8
+ stub_request(:post, /.*#{Regexp.escape(login_url)}.*/)
9
+ stub_request(:get, /.*#{Regexp.escape(login_url)}.*/).\
10
+ to_return(
11
+ :body => SyoboiCalendar::Fixture.response_from_login,
12
+ :headers => { "Content-Type" => "text/html" }
13
+ )
14
+ end
15
+
16
+ context "when passed user and pass" do
17
+ it do
18
+ user = "user"
19
+ pass = "pass"
20
+ agent = SyoboiCalendar::Agent.new(
21
+ :user => user,
22
+ :pass => pass,
23
+ )
24
+ agent.should be_login
25
+ end
26
+ end
27
+
28
+ context "when not passed user and pass" do
29
+ it do
30
+ agent = SyoboiCalendar::Agent.new
31
+ agent.should_not be_login
32
+ end
33
+ end
34
+ end
35
+ end
36
+
@@ -0,0 +1,69 @@
1
+ # encoding: UTF-8
2
+
3
+ require "spec_helper"
4
+
5
+ describe "SyoboiCalendar::Client" do
6
+ before do
7
+ login_url = SyoboiCalendar::Agent::LOGIN_URL
8
+ search_url = SyoboiCalendar::Agent::SEARCH_URL
9
+
10
+ stub_request(:post, /.*#{Regexp.escape(login_url)}.*/)
11
+ stub_request(:get, /.*#{Regexp.escape(login_url)}.*/).\
12
+ to_return(
13
+ :body => SyoboiCalendar::Fixture.response_from_login,
14
+ :headers => { "Content-Type" => "text/html" }
15
+ )
16
+ stub_request(:get, /.*#{Regexp.escape(search_url)}.*sd=2.*/).\
17
+ to_return(
18
+ :body => SyoboiCalendar::Fixture.response_from_search_programs,
19
+ :headers => { "Content-Type" => "text/html" }
20
+ )
21
+ stub_request(:get, /.*#{Regexp.escape(search_url)}.*sd=0.*/).\
22
+ to_return(
23
+ :body => SyoboiCalendar::Fixture.response_from_search_titles,
24
+ :headers => { "Content-Type" => "text/html" }
25
+ )
26
+
27
+ user = "testuserforruby"
28
+ pass = user
29
+ @client = SyoboiCalendar::Client.new(:user => user, :pass => pass)
30
+ @guest = SyoboiCalendar::Client.new
31
+ end
32
+
33
+ describe "#search" do
34
+ before do
35
+ @args_program = { :range => "2012/4/1-2012/4/30" }
36
+ @args_title = { :mode => :title, :keyword => "ひだまりスケッチ" }
37
+ end
38
+
39
+ it do
40
+ @client.search(@args_program).should be_kind_of Array
41
+ end
42
+
43
+ context "in default" do
44
+ subject { @client.search(@args_program)[0] }
45
+ it "should return Programs" do
46
+ should be_kind_of SyoboiCalendar::Program
47
+ end
48
+ end
49
+
50
+ context "when passed mode of title" do
51
+ subject { @guest.search(@args_title)[0] }
52
+ it "should return Titles" do
53
+ should be_kind_of SyoboiCalendar::Title
54
+ end
55
+ end
56
+ end
57
+
58
+ describe "#login?" do
59
+ context "in logined user" do
60
+ subject { @client }
61
+ it { should be_login }
62
+ end
63
+
64
+ context "in guest user" do
65
+ subject { @guest }
66
+ it { should_not be_login }
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,19 @@
1
+ # encoding: UTF-8
2
+
3
+ require "spec_helper"
4
+
5
+ describe "SyoboiCalendar::Program" do
6
+ before do
7
+ @program = SyoboiCalendar::Program.new(
8
+ :tid => 2481,
9
+ :pid => 217175,
10
+ :name => "聖闘士星矢Ω #1 星矢によって救われた命!甦れ聖闘士伝説!",
11
+ :channel_name => "テレビ朝日",
12
+ )
13
+ end
14
+
15
+ describe "#saisoku?" do
16
+ subject { @program }
17
+ it { should be_saisoku }
18
+ end
19
+ end
@@ -0,0 +1,41 @@
1
+ # encoding: UTF-8
2
+
3
+ require "spec_helper"
4
+
5
+ describe "SyoboiCalendar::Title" do
6
+ before do
7
+ @title = SyoboiCalendar::Title.new(
8
+ :tid => "2466",
9
+ :name => "アクセル・ワールド",
10
+ )
11
+ end
12
+
13
+ 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
+ it "return url of official website" do
38
+ @title.url.should == "http://www.tv-tokyo.co.jp/anime/mukashibanashi/"
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/syoboi_calendar/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Ryo NAKAMURA"]
6
+ gem.email = ["r7kamura@gmail.com"]
7
+ gem.description = "Simple gem for Syoboi Calendar"
8
+ gem.summary = "Search Japanese Anime Lineup"
9
+ gem.homepage = "http://github.com/r7kamura/syoboi_calendar"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "syoboi_calendar"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = SyoboiCalendar::VERSION
17
+
18
+ gem.add_dependency "mechanize", ">= 2.3"
19
+ gem.add_development_dependency "rake", ">= 0.9.2"
20
+ gem.add_development_dependency "rspec", ">= 2.9.0"
21
+ gem.add_development_dependency "webmock", ">= 1.8.6"
22
+ gem.add_development_dependency "simplecov", ">= 0.6.1"
23
+ gem.add_development_dependency "simplecov-vim", ">= 0.0.1"
24
+ end