syobocal 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,7 @@ module Syobocal
6
6
  end
7
7
 
8
8
  def url(params = {})
9
- 'http://cal.syoboi.jp/json.php?Req=TitleMedium' + Syobocal::Util.format_params_amp(params)
9
+ "http://cal.syoboi.jp/json.php?Req=TitleMedium" + Syobocal::Util.format_params_amp(params)
10
10
  end
11
11
 
12
12
  def parse(json)
@@ -22,7 +22,7 @@ module Syobocal
22
22
  end
23
23
 
24
24
  def url(params = {})
25
- 'http://cal.syoboi.jp/json.php?Req=TitleLarge' + Syobocal::Util.format_params_amp(params)
25
+ "http://cal.syoboi.jp/json.php?Req=TitleLarge" + Syobocal::Util.format_params_amp(params)
26
26
  end
27
27
 
28
28
  def parse(json)
@@ -38,7 +38,7 @@ module Syobocal
38
38
  end
39
39
 
40
40
  def url(params = {})
41
- 'http://cal.syoboi.jp/json.php?Req=TitleFull' + Syobocal::Util.format_params_amp(params)
41
+ "http://cal.syoboi.jp/json.php?Req=TitleFull" + Syobocal::Util.format_params_amp(params)
42
42
  end
43
43
 
44
44
  def parse(json)
@@ -54,7 +54,7 @@ module Syobocal
54
54
  end
55
55
 
56
56
  def url(params = {})
57
- 'http://cal.syoboi.jp/json.php?Req=ProgramByPID' + Syobocal::Util.format_params_amp(params)
57
+ "http://cal.syoboi.jp/json.php?Req=ProgramByPID" + Syobocal::Util.format_params_amp(params)
58
58
  end
59
59
 
60
60
  def parse(json)
@@ -70,7 +70,7 @@ module Syobocal
70
70
  end
71
71
 
72
72
  def url(params = {})
73
- 'http://cal.syoboi.jp/json.php?Req=ProgramByCount' + Syobocal::Util.format_params_amp(params)
73
+ "http://cal.syoboi.jp/json.php?Req=ProgramByCount" + Syobocal::Util.format_params_amp(params)
74
74
  end
75
75
 
76
76
  def parse(json)
@@ -86,7 +86,7 @@ module Syobocal
86
86
  end
87
87
 
88
88
  def url(params = {})
89
- 'http://cal.syoboi.jp/json.php?Req=ProgramByDate' + Syobocal::Util.format_params_amp(params)
89
+ "http://cal.syoboi.jp/json.php?Req=ProgramByDate" + Syobocal::Util.format_params_amp(params)
90
90
  end
91
91
 
92
92
  def parse(json)
@@ -102,7 +102,7 @@ module Syobocal
102
102
  end
103
103
 
104
104
  def url(params = {})
105
- 'http://cal.syoboi.jp/json.php?Req=SubTitles' + Syobocal::Util.format_params_amp(params)
105
+ "http://cal.syoboi.jp/json.php?Req=SubTitles" + Syobocal::Util.format_params_amp(params)
106
106
  end
107
107
 
108
108
  def parse(json)
@@ -118,7 +118,7 @@ module Syobocal
118
118
  end
119
119
 
120
120
  def url(params = {})
121
- 'http://cal.syoboi.jp/json.php?Req=ChFilter' + Syobocal::Util.format_params_amp(params)
121
+ "http://cal.syoboi.jp/json.php?Req=ChFilter" + Syobocal::Util.format_params_amp(params)
122
122
  end
123
123
 
124
124
  def parse(json)
@@ -134,7 +134,7 @@ module Syobocal
134
134
  end
135
135
 
136
136
  def url(params = {})
137
- 'http://cal.syoboi.jp/json.php?Req=ChIDFilter' + Syobocal::Util.format_params_amp(params)
137
+ "http://cal.syoboi.jp/json.php?Req=ChIDFilter" + Syobocal::Util.format_params_amp(params)
138
138
  end
139
139
 
140
140
  def parse(json)
@@ -5,7 +5,7 @@ module Syobocal
5
5
  end
6
6
 
7
7
  def url(params = {})
8
- 'http://cal.syoboi.jp/rss.php' + Syobocal::Util.format_params(params)
8
+ "http://cal.syoboi.jp/rss.php" + Syobocal::Util.format_params(params)
9
9
  end
10
10
 
11
11
  def parse(rss)
@@ -13,25 +13,25 @@ module Syobocal
13
13
 
14
14
  result = Result.new
15
15
 
16
- channel = rss.elements['rdf:RDF/channel']
17
- result.title = channel.elements['title'].text
18
- result.link = channel.elements['link'].text
19
- result.description = channel.elements['description'].text
20
-
21
- rss.elements.each('rdf:RDF/item'){|item|
22
- tv = item.elements['tv:feed']
16
+ channel = rss.elements["rdf:RDF/channel"]
17
+ result.title = channel.elements["title"].text
18
+ result.link = channel.elements["link"].text
19
+ result.description = channel.elements["description"].text
20
+
21
+ rss.elements.each("rdf:RDF/item") { |item|
22
+ tv = item.elements["tv:feed"]
23
23
  result << {
24
24
  :about => item.attribute("rdf:about").to_s,
25
- :title => item.elements['title'].text,
26
- :link => item.elements['link'].text,
27
- :description => item.elements['description'].text,
28
- :dc_date => Time.parse(item.elements['dc:date'].text),
29
- :dc_publisher => item.elements['dc:publisher'].text,
30
- :tv_genre => tv.elements['tv:genre'].text,
31
- :tv_start_datetime => Time.parse(tv.elements['tv:startDatetime'].text),
32
- :tv_end_datetime => Time.parse(tv.elements['tv:endDatetime'].text),
33
- :tv_iepg_url => tv.elements['tv:iepgUrl'].text,
34
- :tv_performer => tv.elements['tv:performer'].text,
25
+ :title => item.elements["title"].text,
26
+ :link => item.elements["link"].text,
27
+ :description => item.elements["description"].text,
28
+ :dc_date => Time.parse(item.elements["dc:date"].text),
29
+ :dc_publisher => item.elements["dc:publisher"].text,
30
+ :tv_genre => tv.elements["tv:genre"].text,
31
+ :tv_start_datetime => Time.parse(tv.elements["tv:startDatetime"].text),
32
+ :tv_end_datetime => Time.parse(tv.elements["tv:endDatetime"].text),
33
+ :tv_iepg_url => tv.elements["tv:iepgUrl"].text,
34
+ :tv_performer => tv.elements["tv:performer"].text,
35
35
  }
36
36
  }
37
37
 
@@ -5,7 +5,7 @@ module Syobocal
5
5
  end
6
6
 
7
7
  def url(params = {})
8
- 'http://cal.syoboi.jp/rss2.php' + Syobocal::Util.format_params(params)
8
+ "http://cal.syoboi.jp/rss2.php" + Syobocal::Util.format_params(params)
9
9
  end
10
10
 
11
11
  def parse(rss)
@@ -13,18 +13,18 @@ module Syobocal
13
13
 
14
14
  result = Result.new
15
15
 
16
- channel = rss.elements['rss/channel']
17
- result.title = channel.elements['title'].text
18
- result.link = channel.elements['link'].text
19
- result.dc_language = channel.elements['dc:language'].text
20
- result.pub_date = Time.parse(channel.elements['pubDate'].text)
21
-
22
- rss.elements.each('rss/channel/item'){|item|
16
+ channel = rss.elements["rss/channel"]
17
+ result.title = channel.elements["title"].text
18
+ result.link = channel.elements["link"].text
19
+ result.dc_language = channel.elements["dc:language"].text
20
+ result.pub_date = Time.parse(channel.elements["pubDate"].text)
21
+
22
+ rss.elements.each("rss/channel/item") { |item|
23
23
  result << {
24
- :title => item.elements['title'].text,
25
- :link => item.elements['link'].text,
26
- :description => item.elements['description'].text,
27
- :pub_date => Time.parse(item.elements['pubDate'].text),
24
+ :title => item.elements["title"].text,
25
+ :link => item.elements["link"].text,
26
+ :description => item.elements["description"].text,
27
+ :pub_date => Time.parse(item.elements["pubDate"].text),
28
28
  }
29
29
  }
30
30
 
@@ -3,17 +3,17 @@ module Syobocal
3
3
  def self.format_params(params)
4
4
  return "" if params.length == 0
5
5
 
6
- '?' + params.to_a.map{|tuple|
7
- tuple[0].to_s + '=' + tuple[1].to_s
8
- }.join('&')
6
+ "?" + params.to_a.map { |tuple|
7
+ tuple[0].to_s + "=" + tuple[1].to_s
8
+ }.join("&")
9
9
  end
10
10
 
11
11
  def self.format_params_amp(params)
12
12
  return "" if params.length == 0
13
13
 
14
- "&" + params.to_a.map{|tuple|
15
- tuple[0].to_s + '=' + tuple[1].to_s
16
- }.join('&')
14
+ "&" + params.to_a.map { |tuple|
15
+ tuple[0].to_s + "=" + tuple[1].to_s
16
+ }.join("&")
17
17
  end
18
18
  end
19
19
  end
@@ -1,3 +1,3 @@
1
1
  module Syobocal
2
- VERSION = "0.10.0"
2
+ VERSION = "0.11.0"
3
3
  end
@@ -0,0 +1,15 @@
1
+ require "syobocal"
2
+
3
+ path = "data/db_title_lookup.json"
4
+
5
+ if File.exist? path
6
+ puts "Nothing to do. '#{path}' already exists."
7
+ else
8
+ puts "Downloading to '#{path}'."
9
+
10
+ open(path, "w") do |f|
11
+ f.print JSON.pretty_generate(Syobocal::DB::TitleLookup.get({ "TID" => "*" }))
12
+ end
13
+
14
+ puts "Completed."
15
+ end
@@ -0,0 +1,20 @@
1
+ require "syobocal"
2
+ require "pp"
3
+
4
+ path = "data/db_title_lookup.json"
5
+
6
+ json = JSON.parse(File.read(path))
7
+
8
+ sections = []
9
+
10
+ json.each do |title|
11
+ puts title["tid"]
12
+
13
+ parser = Syobocal::Comment::Parser.new(title["comment"])
14
+
15
+ pp parser.parse
16
+ pp parser.staffs
17
+ pp parser.casts
18
+ pp parser.musics
19
+ pp parser.links
20
+ end
@@ -4,25 +4,27 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require "syobocal/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "syobocal"
8
- spec.version = Syobocal::VERSION
9
- spec.authors = ["xmisao"]
10
- spec.email = ["mail@xmisao.com"]
7
+ spec.name = "syobocal"
8
+ spec.version = Syobocal::VERSION
9
+ spec.authors = ["xmisao"]
10
+ spec.email = ["mail@xmisao.com"]
11
11
 
12
- spec.summary = "Simple gem for Syoboi Calendar"
13
- spec.description = "Syoboi Calendar is the oldest and biggest ANIME information site, supported and hosted by anime fans in Japan. This gem make it easy to download information using web APIs of this site."
14
- spec.homepage = "https://github.com/xmisao/syobocal"
15
- spec.license = "MIT"
12
+ spec.summary = "Simple gem for Syoboi Calendar"
13
+ spec.description = "Syoboi Calendar is the oldest and biggest ANIME information site, supported and hosted by anime fans in Japan. This gem make it easy to download information using web APIs of this site."
14
+ spec.homepage = "https://github.com/xmisao/syobocal"
15
+ spec.license = "MIT"
16
16
 
17
17
  # Specify which files should be added to the gem when it is released.
18
18
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
+ spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
20
20
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
21
  end
22
- spec.bindir = "exe"
23
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ["lib"]
25
25
 
26
26
  spec.add_development_dependency "bundler", "~> 2.0"
27
27
  spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "minitest", "~> 5.0"
29
+ spec.add_development_dependency "rufo", "~> 0.7"
28
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syobocal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - xmisao
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-10 00:00:00.000000000 Z
11
+ date: 2019-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rufo
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.7'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.7'
41
69
  description: Syoboi Calendar is the oldest and biggest ANIME information site, supported
42
70
  and hosted by anime fans in Japan. This gem make it easy to download information
43
71
  using web APIs of this site.
@@ -57,16 +85,35 @@ files:
57
85
  - Rakefile
58
86
  - bin/console
59
87
  - bin/setup
88
+ - data/.gitkeep
60
89
  - exe/syobocal
61
90
  - exe/syobocal-anime
62
91
  - lib/syobocal.rb
63
92
  - lib/syobocal/calchk.rb
93
+ - lib/syobocal/comment/cast.rb
94
+ - lib/syobocal/comment/element/blank.rb
95
+ - lib/syobocal/comment/element/header1.rb
96
+ - lib/syobocal/comment/element/header2.rb
97
+ - lib/syobocal/comment/element/link.rb
98
+ - lib/syobocal/comment/element/list.rb
99
+ - lib/syobocal/comment/element/root.rb
100
+ - lib/syobocal/comment/element/row.rb
101
+ - lib/syobocal/comment/element/text.rb
102
+ - lib/syobocal/comment/element/text_node.rb
103
+ - lib/syobocal/comment/music.rb
104
+ - lib/syobocal/comment/music_data.rb
105
+ - lib/syobocal/comment/parser.rb
106
+ - lib/syobocal/comment/person.rb
107
+ - lib/syobocal/comment/section.rb
108
+ - lib/syobocal/comment/staff.rb
64
109
  - lib/syobocal/db.rb
65
110
  - lib/syobocal/json.rb
66
111
  - lib/syobocal/rss.rb
67
112
  - lib/syobocal/rss2.rb
68
113
  - lib/syobocal/util.rb
69
114
  - lib/syobocal/version.rb
115
+ - scripts/download_db_title_lookup.rb
116
+ - scripts/parse_comment.rb
70
117
  - syobocal.gemspec
71
118
  homepage: https://github.com/xmisao/syobocal
72
119
  licenses: