crunchyroll 0.9.7 → 0.9.7.2

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: aa7b5b6f50a304f382f6dd45c23b55c20ac0bccd
4
- data.tar.gz: 06c462b28f14f45fc1dc2c563f394c9d43e956fc
3
+ metadata.gz: ace63fc12051acb24b34657618d904a16998eab5
4
+ data.tar.gz: 51112dcc884d4521460b71542b044953c49831e8
5
5
  SHA512:
6
- metadata.gz: c8ff6b0c352f3a94d610903630de1a09076f8ad441931494d0d45de8fe045bc764ab5a4845b59c939ea9ed3725598bf63b84f1d600423acbbef986ddd720c412
7
- data.tar.gz: 88ed058e218a0591efc876ac4107a2a58242bbafbded35c8f35c28bbbb6f42e2b29da45ab3b99469df659a40c2a684540b6259aee08c8a455e625b7efd22efed
6
+ metadata.gz: 9d6258bafc4aa1746b87be0f9a62f8c7b8a78b121132519e62fbe9a7001a534e16a3c3b41fcc366b53bb44da8bac5bcb8d99906dbc87ccefafadf0c9e4180dae
7
+ data.tar.gz: 203860d3db27a0e44e447e526311012dec648e9f2503478fd7a15e8c78274332644f03f284b51ef7a560c2bb498a769ec0069767c2dc3f8097b1e4b0a98e273e
@@ -20,9 +20,11 @@ Chronic.time_class = Time.zone
20
20
  module Crunchyroll
21
21
  class << self
22
22
 
23
- def find(series, time_zone = 'Rome')
23
+ def find(series, time_zone = 'Rome', proxy = 'http://108.165.33.12:3128')
24
+ ENV['http_proxy'] ||= proxy
25
+
24
26
  title, url = [''] * 2
25
- cr = 'http://www.crunchyroll.com/lineup' # TODO: restore some proxy from usa
27
+ cr = 'http://www.crunchyroll.com/lineup'
26
28
  Nokogiri::HTML(open(cr)).xpath('//a[@class="portrait-element block-link titlefix element-lineup-anime"]').each do |r|
27
29
  if r['title'].downcase.include? series.downcase
28
30
  title = r['title']
@@ -31,13 +33,15 @@ class << self
31
33
  end
32
34
  end
33
35
 
36
+ ENV.delete('http_proxy')
37
+
34
38
  return false if title.empty? || url.empty?
35
39
 
36
40
  air = Nokogiri::HTML(open(url)).xpath('//ul[@id="sidebar_elements"]/li').select { |e| e.at_xpath('.//p[@class="strong"]') }[0]
37
41
  return false unless air
38
42
 
39
43
  air = air.text
40
- day_literal = (air.scan(/\d+:/)[0] + air.split(/\d+:/)[1]).split[0]
44
+ day_literal = air.split('Simulcast on ')[1].split[0][0..-2]
41
45
  date = Time.parse(air.format_cr_date)
42
46
  date = Chronic.parse("this #{day_literal} at #{date.hour}:#{date.min}").in_time_zone time_zone
43
47
 
@@ -1,14 +1,14 @@
1
1
  ##
2
2
  # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
3
3
  # Version 2, December 2004
4
- #
4
+ #
5
5
  # Everyone is permitted to copy and distribute verbatim or modified
6
6
  # copies of this license document, and changing it is allowed as long
7
7
  # as the name is changed.
8
- #
8
+ #
9
9
  # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
10
10
  # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
11
- #
11
+ #
12
12
  # 0. You just DO WHAT THE FUCK YOU WANT TO.
13
13
  ##
14
14
 
@@ -16,7 +16,7 @@ module Utils
16
16
  refine Time do
17
17
  def left(end_time)
18
18
  diff = TimeDifference.between(self, end_time).in_general
19
-
19
+
20
20
  secs = diff[:seconds].to_i
21
21
  mins = diff[:minutes].to_i
22
22
  hours = diff[:hours ].to_i
@@ -42,7 +42,7 @@ module Utils
42
42
  def format_cr_date
43
43
  s = ''
44
44
  self.split('Simulcast on ')[1][0..-5].split.each { |d| s += d.end_with?(?s) ? d[0..-2] : d; s += ' ' }
45
-
45
+
46
46
  am_pm = s.strip[-2..-1]
47
47
  s = s.strip[0..-3]
48
48
 
@@ -52,4 +52,4 @@ module Utils
52
52
  return "#{day} #{time}"
53
53
  end
54
54
  end
55
- end
55
+ end
@@ -14,6 +14,6 @@
14
14
 
15
15
  module Crunchyroll
16
16
  def self.version
17
- '0.9.7'
17
+ '0.9.7.2'
18
18
  end
19
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crunchyroll
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.7
4
+ version: 0.9.7.2
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-11-19 00:00:00.000000000 Z
11
+ date: 2014-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri