nyaa 0.1.0 → 0.1.1

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.
Files changed (4) hide show
  1. data/README.md +12 -3
  2. data/lib/nyaa.rb +8 -1
  3. data/lib/nyaa/version.rb +1 -1
  4. metadata +2 -2
data/README.md CHANGED
@@ -1,4 +1,13 @@
1
- nyaa
2
- ====
1
+ # nyaa
3
2
 
4
- CLI to NyaaTorrents
3
+ Nyaa is a CLI to NyaaTorrents. You can browse, search, and download. Nifty.
4
+
5
+ ## Installation
6
+
7
+ gem install nyaa
8
+
9
+ ## Usage
10
+
11
+ ## License
12
+
13
+ See LICENSE
@@ -4,6 +4,7 @@ require 'nokogiri'
4
4
  require 'rest_client'
5
5
  require 'trollop'
6
6
  require 'formatador'
7
+ require 'uri'
7
8
 
8
9
  class Nyaa
9
10
  BASE_URL = 'http://www.nyaa.eu/?page=torrents'
@@ -41,7 +42,7 @@ class Nyaa
41
42
  }
42
43
 
43
44
  def initialize(query, opts)
44
- @query = query
45
+ @query = URI.escape(query)
45
46
  @opts = opts
46
47
  @opts[:size] = PSIZE if opts[:size] > PSIZE
47
48
  @opts[:size] = 1 if opts[:size] <= 1
@@ -103,6 +104,12 @@ class Nyaa
103
104
  def display(data, results)
104
105
  f = Formatador.new
105
106
  f.display_line( "\t[yellow]NyaaTorrents >> Browse | Anime, manga, and music[/]\n" )
107
+
108
+ if data[0].nil?
109
+ f.display_line( "[normal]No matches found. Try another category. See --help.[/]\n")
110
+ f.display_line("\t[yellow]Exiting.[/]")
111
+ exit
112
+ end
106
113
  f.display_line( "[bold]#{data[0][:cat]}\n[/]" )
107
114
 
108
115
  results.each do |item|
@@ -1,3 +1,3 @@
1
1
  class Nyaa
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nyaa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-11 00:00:00.000000000 Z
12
+ date: 2012-08-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: trollop