crunchyroll 0.9.5 → 0.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b4eab0bece63654e326b039bb58f8230feb5cb5e
4
- data.tar.gz: a43f486a641e8e6a9d3cb3b449c5b1f6993c4604
3
+ metadata.gz: 85ab318fb2e676e603eb3247309d454a3b912de2
4
+ data.tar.gz: 58f0acac77485d87c945db353bc7ead687ea4301
5
5
  SHA512:
6
- metadata.gz: eb1c8bf25ce3d2673afbd7809cdb6ffa96252ce79ab15c5aa9730b5dc6af43e964a66ed975136ff8ec2bc25bca1022d80d505571d387ccf39639a15fe370d9da
7
- data.tar.gz: 5d598b94278b14f98408aa6cb5be997420a3864c0d2585164fff133bf91a25e29df75da1286763145431779de8fb3309a6de7b037f19725e84c3535878f4a6b6
6
+ metadata.gz: ae0641019426f32d9ff0694a1c0f1db0f0aec833fb330a6a50510ab14e9696aeffd05434302d8c23064f91048373791e82be4b927072ed7ea8291467791f8c6f
7
+ data.tar.gz: 927236237254e4636c832a7015cf5c5574924503ffa25e27145fa635f78ce7ff4dc8f2c1e0dba8119d378c9bbc0d851aafa78e4905ef478349d7d0efead02f17
@@ -1,23 +1,23 @@
1
- ##
2
- # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
3
- # Version 2, December 2004
4
- #
5
- # Everyone is permitted to copy and distribute verbatim or modified
6
- # copies of this license document, and changing it is allowed as long
7
- # as the name is changed.
8
- #
9
- # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
10
- # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
11
- #
12
- # 0. You just DO WHAT THE FUCK YOU WANT TO.
13
- ##
14
-
15
- require 'open-uri'
16
- require 'nokogiri'
17
- require 'active_support/time'
18
- require 'time_difference'
19
- require 'chronic'
20
-
21
- require 'crunchyroll/utils'
22
- require 'crunchyroll/crunchyroll'
1
+ ##
2
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
3
+ # Version 2, December 2004
4
+ #
5
+ # Everyone is permitted to copy and distribute verbatim or modified
6
+ # copies of this license document, and changing it is allowed as long
7
+ # as the name is changed.
8
+ #
9
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
10
+ # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
11
+ #
12
+ # 0. You just DO WHAT THE FUCK YOU WANT TO.
13
+ ##
14
+
15
+ require 'open-uri'
16
+ require 'nokogiri'
17
+ require 'active_support/time'
18
+ require 'time_difference'
19
+ require 'chronic'
20
+
21
+ require 'crunchyroll/utils'
22
+ require 'crunchyroll/crunchyroll'
23
23
  require 'crunchyroll/version'
@@ -1,88 +1,89 @@
1
- ##
2
- # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
3
- # Version 2, December 2004
4
- #
5
- # Everyone is permitted to copy and distribute verbatim or modified
6
- # copies of this license document, and changing it is allowed as long
7
- # as the name is changed.
8
- #
9
- # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
10
- # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
11
- #
12
- # 0. You just DO WHAT THE FUCK YOU WANT TO.
13
- ##
14
-
15
-
16
- using Utils
17
- Time.zone = 'MST'
18
- Chronic.time_class = Time.zone
19
-
20
- module Crunchyroll
21
- class << self
22
-
23
- def find(series, time_zone = 'Rome')
24
- url = ''
25
- title = ''
26
- cr = 'http://www.iamalittlekitty.info/index.php?q=aHR0cDovL3d3dy5jcnVuY2h5cm9sbC5jb20vbGluZXVw&hl=3ed'
27
- Nokogiri::HTML(open(cr)).xpath('//a[@class="portrait-element block-link titlefix element-lineup-anime"]').each { |r|
28
- if r['title'].downcase.include? series.downcase
29
- title = r['title']
30
- url = r['href' ]
31
- break
32
- end
33
- }
34
- return false if title.empty? || url.empty?
35
-
36
- air = Nokogiri::HTML(open(url)).xpath('//ul[@id="sidebar_elements"]/li').select { |e| e.at_xpath('.//p[@class="strong"]') }[0]
37
- return false unless air
38
-
39
- air = air.text
40
- day_literal = air.split('Simulcast on ')[1].split(' ')[0][0..-2]
41
- date = Time.parse(air.format_cr_date)
42
- date = Chronic.parse("this #{day_literal} at #{date.hour}:#{date.min}").in_time_zone time_zone
43
-
44
- {
45
- :title => title,
46
- :where => 'Crunchyroll',
47
- :day => day_literal,
48
- :hour => date.hour <= 9 ? "0#{date.hour}" : date.hour,
49
- :min => date.min <= 9 ? "0#{date.min}" : date.min,
50
- :left => Time.now.left(date)
51
- }
52
- end
53
- alias_method :get, :find
54
-
55
- def today(time_zone = 'Rome')
56
- url = 'http://horriblesubs.info/release-schedule/'
57
- tomorrow = Date.tomorrow
58
- today = Time.now
59
-
60
- [].tap { |releases|
61
- Nokogiri::HTML(open(url)).xpath('//div[@class="today-releases"]/div[@class="series-name"]').each { |r|
62
- title = r.at_xpath('.//child::text()').to_s.squeeze(' ')
63
- time = r.at_xpath('.//span').text
64
- date = Chronic.parse("today at #{time}").in_time_zone time_zone
65
-
66
- time_diff = TimeDifference.between(today, date).in_general
67
- airs = if date.day == tomorrow.day && time_diff[:days] == 0
68
- :tomorrow
69
- else
70
- time_diff[:days] == 0 ? :today : :aired
71
- end
72
-
73
- releases << {
74
- :title => title,
75
- :where => 'Crunchyroll',
76
- :date => date,
77
- :airs => airs,
78
- :day => date.strftime("%A"),
79
- :hour => date.hour,
80
- :min => date.min,
81
- :left => today.left(date)
82
- }
83
- }
84
- }.sort_by { |h| h[:date] }
85
- end
86
-
87
- end
88
- end
1
+ ##
2
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
3
+ # Version 2, December 2004
4
+ #
5
+ # Everyone is permitted to copy and distribute verbatim or modified
6
+ # copies of this license document, and changing it is allowed as long
7
+ # as the name is changed.
8
+ #
9
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
10
+ # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
11
+ #
12
+ # 0. You just DO WHAT THE FUCK YOU WANT TO.
13
+ ##
14
+
15
+ using Utils
16
+
17
+ Time.zone = 'MST'
18
+ Chronic.time_class = Time.zone
19
+
20
+ module Crunchyroll
21
+ class << self
22
+
23
+ def find(series, time_zone = 'Rome')
24
+ url = ''
25
+ title = ''
26
+ cr = 'http://www.iamalittlekitty.info/index.php?q=aHR0cDovL3d3dy5jcnVuY2h5cm9sbC5jb20vbGluZXVw&hl=3ed'
27
+ Nokogiri::HTML(open(cr)).xpath('//a[@class="portrait-element block-link titlefix element-lineup-anime"]').each { |r|
28
+ if r['title'].downcase.include? series.downcase
29
+ title = r['title']
30
+ url = r['href' ]
31
+ break
32
+ end
33
+ }
34
+ return false if title.empty? || url.empty?
35
+
36
+ air = Nokogiri::HTML(open(url)).xpath('//ul[@id="sidebar_elements"]/li').select { |e| e.at_xpath('.//p[@class="strong"]') }[0]
37
+ return false unless air
38
+
39
+ air = air.text
40
+ day_literal = air.split('Simulcast on ')[1].split(' ')[0][0..-2]
41
+ date = Time.parse(air.format_cr_date)
42
+ date = Chronic.parse("this #{day_literal} at #{date.hour}:#{date.min}").in_time_zone time_zone
43
+
44
+ {
45
+ :title => title,
46
+ :where => 'Crunchyroll',
47
+ :day => day_literal,
48
+ :hour => date.hour <= 9 ? "0#{date.hour}" : date.hour,
49
+ :min => date.min <= 9 ? "0#{date.min}" : date.min,
50
+ :left => Time.now.left(date)
51
+ }
52
+ end
53
+ alias_method :get, :find
54
+
55
+ def today(time_zone = 'Rome')
56
+ url = 'http://horriblesubs.info/release-schedule/'
57
+ tomorrow = Date.tomorrow
58
+ today = Time.now
59
+
60
+ [].tap { |releases|
61
+ Nokogiri::HTML(open(url)).xpath('//div[@class="today-releases"]/div[@class="series-name"]').each { |r|
62
+ title = r.at_xpath('.//child::text()').to_s.squeeze(' ')
63
+ time = r.at_xpath('.//span').text
64
+ date = Chronic.parse("today at #{time}").in_time_zone time_zone
65
+ date -= 3600 if date.dst?
66
+
67
+ time_diff = TimeDifference.between(today, date).in_general
68
+ airs = if date.day == tomorrow.day && time_diff[:days] == 0
69
+ :tomorrow
70
+ else
71
+ time_diff[:days] == 0 ? :today : :aired
72
+ end
73
+
74
+ releases << {
75
+ :title => title,
76
+ :where => 'Crunchyroll',
77
+ :date => date,
78
+ :airs => airs,
79
+ :day => date.strftime("%A"),
80
+ :hour => date.hour,
81
+ :min => date.min,
82
+ :left => today.left(date)
83
+ }
84
+ }
85
+ }.sort_by { |h| h[:date] }
86
+ end
87
+
88
+ end
89
+ end
@@ -1,55 +1,55 @@
1
- ##
2
- # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
3
- # Version 2, December 2004
4
- #
5
- # Everyone is permitted to copy and distribute verbatim or modified
6
- # copies of this license document, and changing it is allowed as long
7
- # as the name is changed.
8
- #
9
- # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
10
- # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
11
- #
12
- # 0. You just DO WHAT THE FUCK YOU WANT TO.
13
- ##
14
-
15
- module Utils
16
- refine Time do
17
- def left(end_time)
18
- diff = TimeDifference.between(self, end_time).in_general
19
-
20
- secs = diff[:seconds].to_i
21
- mins = diff[:minutes].to_i
22
- hours = diff[:hours ].to_i
23
- days = diff[:days ].to_i
24
-
25
- if days > 0
26
- "#{days} days, #{hours} hours, #{mins} minutes and #{secs} seconds"
27
- elsif hours > 0
28
- "#{hours} hours, #{mins} minutes and #{secs} seconds"
29
- elsif mins > 0
30
- "#{mins} minutes and #{secs} seconds"
31
- elsif secs >= 0
32
- "#{secs} seconds"
33
- end
34
- end
35
- end
36
-
37
- refine String do
38
- def to_24h
39
- DateTime.parse(self).strftime("%H:%M")
40
- end
41
-
42
- def format_cr_date
43
- s = ''
44
- self.split('Simulcast on ')[1][0..-5].split.each { |d| s += d.end_with?(?s) ? d[0..-2] : d; s += ' ' }
45
-
46
- am_pm = s.strip[-2..-1]
47
- s = s.strip[0..-3]
48
-
49
- day_time = s.split
50
- day = day_time.shift
51
- time = day_time.shift.to_24h
52
- return "#{day} #{time}"
53
- end
54
- end
1
+ ##
2
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
3
+ # Version 2, December 2004
4
+ #
5
+ # Everyone is permitted to copy and distribute verbatim or modified
6
+ # copies of this license document, and changing it is allowed as long
7
+ # as the name is changed.
8
+ #
9
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
10
+ # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
11
+ #
12
+ # 0. You just DO WHAT THE FUCK YOU WANT TO.
13
+ ##
14
+
15
+ module Utils
16
+ refine Time do
17
+ def left(end_time)
18
+ diff = TimeDifference.between(self, end_time).in_general
19
+
20
+ secs = diff[:seconds].to_i
21
+ mins = diff[:minutes].to_i
22
+ hours = diff[:hours ].to_i
23
+ days = diff[:days ].to_i
24
+
25
+ if days > 0
26
+ "#{days} days, #{hours} hours, #{mins} minutes and #{secs} seconds"
27
+ elsif hours > 0
28
+ "#{hours} hours, #{mins} minutes and #{secs} seconds"
29
+ elsif mins > 0
30
+ "#{mins} minutes and #{secs} seconds"
31
+ elsif secs >= 0
32
+ "#{secs} seconds"
33
+ end
34
+ end
35
+ end
36
+
37
+ refine String do
38
+ def to_24h
39
+ DateTime.parse(self).strftime("%H:%M")
40
+ end
41
+
42
+ def format_cr_date
43
+ s = ''
44
+ self.split('Simulcast on ')[1][0..-5].split.each { |d| s += d.end_with?(?s) ? d[0..-2] : d; s += ' ' }
45
+
46
+ am_pm = s.strip[-2..-1]
47
+ s = s.strip[0..-3]
48
+
49
+ day_time = s.split
50
+ day = day_time.shift
51
+ time = day_time.shift.to_24h
52
+ return "#{day} #{time}"
53
+ end
54
+ end
55
55
  end
@@ -1,19 +1,19 @@
1
- ##
2
- # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
3
- # Version 2, December 2004
4
- #
5
- # Everyone is permitted to copy and distribute verbatim or modified
6
- # copies of this license document, and changing it is allowed as long
7
- # as the name is changed.
8
- #
9
- # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
10
- # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
11
- #
12
- # 0. You just DO WHAT THE FUCK YOU WANT TO.
13
- ##
14
-
15
- module Crunchyroll
16
- def self.version
17
- '0.9.5'
18
- end
19
- end
1
+ ##
2
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
3
+ # Version 2, December 2004
4
+ #
5
+ # Everyone is permitted to copy and distribute verbatim or modified
6
+ # copies of this license document, and changing it is allowed as long
7
+ # as the name is changed.
8
+ #
9
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
10
+ # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
11
+ #
12
+ # 0. You just DO WHAT THE FUCK YOU WANT TO.
13
+ ##
14
+
15
+ module Crunchyroll
16
+ def self.version
17
+ '0.9.6'
18
+ end
19
+ end
metadata CHANGED
@@ -1,81 +1,25 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crunchyroll
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 0.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giovanni Capuano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-26 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: nokogiri
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: time_difference
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: chronic
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: activesupport
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
11
+ date: 2014-11-19 00:00:00.000000000 Z
12
+ dependencies: []
69
13
  description: Find and get infos about series airing on Crunchyroll.
70
14
  email: webmaster@giovannicapuano.net
71
15
  executables: []
72
16
  extensions: []
73
17
  extra_rdoc_files: []
74
18
  files:
19
+ - lib/crunchyroll.rb
75
20
  - lib/crunchyroll/crunchyroll.rb
76
21
  - lib/crunchyroll/utils.rb
77
22
  - lib/crunchyroll/version.rb
78
- - lib/crunchyroll.rb
79
23
  homepage: http://www.giovannicapuano.net
80
24
  licenses:
81
25
  - WTFPL
@@ -96,7 +40,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
40
  version: '0'
97
41
  requirements: []
98
42
  rubyforge_project:
99
- rubygems_version: 2.0.3
43
+ rubygems_version: 2.2.2
100
44
  signing_key:
101
45
  specification_version: 4
102
46
  summary: Find a series airing on Crunchyroll.