File tree Expand file tree Collapse file tree 3 files changed +3
-56
lines changed
Expand file tree Collapse file tree 3 files changed +3
-56
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
77gem "activesupport" , require : "active_support/all"
88gem "libxml-ruby"
99gem "mechanize"
10- gem "multi_xml"
1110gem "rake" , require : false
1211gem "slack-notifier" , ">= 2.4.0"
13- gem "syobocalite" , ">= 1.0 .0"
12+ gem "syobocalite" , ">= 1.1 .0"
Original file line number Diff line number Diff line change 5656 rake (13.2.1 )
5757 rubyntlm (0.6.3 )
5858 slack-notifier (2.4.0 )
59- syobocalite (1.0.1 )
59+ syobocalite (1.1.0 )
6060 activesupport
6161 multi_xml
6262 tzinfo (2.0.6 )
@@ -71,10 +71,9 @@ DEPENDENCIES
7171 activesupport
7272 libxml-ruby
7373 mechanize
74- multi_xml
7574 rake
7675 slack-notifier (>= 2.4.0 )
77- syobocalite (>= 1.0 .0 )
76+ syobocalite (>= 1.1 .0 )
7877
7978BUNDLED WITH
8079 2.5.3
Original file line number Diff line number Diff line change 1- require "open-uri"
2-
31class Syobocalite ::Program
4- USER_AGENT = "anime_bot (+https://github.com/ruby-jp/anime_bot)"
5-
62 # Slackに投稿するための文言に整形する
73 # @return [String]
84 def format
@@ -35,51 +31,4 @@ def display_flag
3531 str << "【再】" if re_air?
3632 str
3733 end
38-
39- # 注
40- def remark?
41- flag & 0x01 != 0
42- end
43-
44- # 新
45- def new?
46- flag & 0x02 != 0
47- end
48-
49- # 終
50- def final?
51- flag & 0x04 != 0
52- end
53-
54- # 再
55- def re_air?
56- flag & 0x08 != 0
57- end
58-
59- private
60-
61- # @see https://sites.google.com/site/syobocal/spec/proginfo-flag
62- # @return [Integer]
63- def flag
64- @flag ||= get_db_flag
65- end
66-
67- # @see https://docs.cal.syoboi.jp/spec/db.php/
68- # @return [Integer]
69- def get_db_flag
70- params = {
71- "Command" => "ProgLookup" ,
72- "Fields" => "Flag" ,
73- "TID" => tid ,
74- "PID" => pid ,
75- }
76-
77- headers = {
78- "User-Agent" => USER_AGENT ,
79- }
80-
81- xml = URI . open ( "https://cal.syoboi.jp/db.php?#{ params . to_param } " , headers ) . read
82- response = MultiXml . parse ( xml )
83- response [ "ProgLookupResponse" ] [ "ProgItems" ] [ "ProgItem" ] [ "Flag" ] . to_i
84- end
8534end
You can’t perform that action at this time.
0 commit comments