nyaa_anime 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 95cc5ada91e4565d3dcc1b6132a076f27362a7ec
4
- data.tar.gz: 82f3e978ce8f7e0c03765f33f68daffb7cd40439
3
+ metadata.gz: 4ade53184cea136e9606d361cf8bb886d21f5440
4
+ data.tar.gz: ca6c5096f64f89365ce306e41dfb28fd67ccdad7
5
5
  SHA512:
6
- metadata.gz: 3286ec8ae9177438c7e1c91ece7fb460a2e36029353e793b08ff471c48bcbfb3d02989b855a18e0f2b2e1a651e2e1c60d84a46011e5504ba117cdf4791a8ad67
7
- data.tar.gz: 8933a1268ee87fe499f77f128c9b1163156f6d3aea97ca1b4e2b9a312fa04b5d99e05b0848e31ecc6c26be9d434fbd6f0c666e8495602cf9b2bb23cf17d181c6
6
+ metadata.gz: bc83cb8e860153eb3bbfddb217e0da5cfd34771ea3bdf49ba93111bad47e713a6f0e7292a18cd17c607343c3637d3d9ff440b6e0d29ca51af6e29fd0e94be9bc
7
+ data.tar.gz: 9b4a6d21e92bd643e2eb0509189bfc6b610127a7d939222062c9ed77c2b28c7beab063bc9a0acd725d53c6dcd6dd3978366725cde257ef19325f567df57a20f7
data/lib/nyaa_anime.rb CHANGED
@@ -8,6 +8,7 @@ class NyaaAnime
8
8
  require 'colorize'
9
9
  require 'levenshtein'
10
10
  require 'set'
11
+ require 'fileutils'
11
12
 
12
13
  NYAA_URI = "http://nyaa.se"
13
14
  NYAA_SEARCH = "#{NYAA_URI}/?page=rss"
@@ -53,9 +54,10 @@ class NyaaAnime
53
54
  new_titles.merge @new_titles
54
55
  @new_titles.each { |ti| new_downloads[ti] = @downloads[ti] }
55
56
  if @new_titles.any?
56
- puts "#{@new_titles.count} new episode#{"s" if @new_titles.count > 1}!".colorize(:green)
57
+ print @new_titles.count.to_s.colorize(:green)
57
58
  end
58
59
  end
60
+ print " - "
59
61
  @new_titles = new_titles
60
62
  @titles = new_titles.to_a.sort!
61
63
  @downloads = new_downloads
@@ -63,7 +65,7 @@ class NyaaAnime
63
65
  @version_differing_titles = Set.new
64
66
  @other_titles = Set.new
65
67
  if download_count > 0
66
- puts "#{download_count} new episode#{"s" if download_count > 1} found!"
68
+ puts "#{download_count} new episode#{"s" if download_count > 1} found!".colorize(:green)
67
69
  end
68
70
  @titles.each_with_index { |t, i| puts "#{i+1}: #{t.colorize(NEW_COLOR)}" }
69
71
  end
@@ -149,6 +151,7 @@ class NyaaAnime
149
151
  def download(title)
150
152
  torrent = open @downloads[title]
151
153
  filename = torrent.meta["content-disposition"][/filename="(.+\.torrent)"/, 1]
154
+ FileUtils.mkdir_p NYAA_DL_DIR
152
155
  open("#{NYAA_DL_DIR}#{filename}", "w") { |f| f.write torrent.read }
153
156
  puts "#{title}.torrent downloaded."
154
157
  "#{NYAA_DL_DIR}\"#{title}.torrent\""
@@ -1,3 +1,3 @@
1
1
  class NyaaAnime
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nyaa_anime
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Tsubaki Wu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-17 00:00:00.000000000 Z
11
+ date: 2014-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri