nyaa 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +1 -1
- data/README.md +7 -4
- data/bin/nyaa +6 -8
- data/lib/nyaa.rb +2 -0
- data/lib/nyaa/HELP +50 -0
- data/lib/nyaa/cli.rb +6 -5
- data/lib/nyaa/constants.rb +1 -1
- data/lib/nyaa/downloader.rb +1 -6
- data/lib/nyaa/ui.rb +4 -1
- data/lib/nyaa/utils.rb +24 -0
- data/lib/nyaa/version.rb +2 -1
- metadata +12 -17
- data/screenshots/v1.0.0_browse.png +0 -0
- data/screenshots/v1.0.0_help.png +0 -0
- data/screenshots/v1.0.0_search.png +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9622770089db1b59e44caa99baf401ac01f26886
|
4
|
+
data.tar.gz: 564720b84300fbbbc007f342cc36ed836aed5e81
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2b3559c0302529a8d6c5f071fa36991bc3e960e07bec51c903b4f2b79a013981c51da6edcf0c3079dfd60fb50339c2838ec4f55aaee753ad90c8c4d36ac7e7d9
|
7
|
+
data.tar.gz: db3cc7c7e3c56a443737142ee6133fae27b1fe3cd0d2887959fb3f37230cf86e823e7ffde5c5a5b83008d75f141a978bb91170fd8f08703a5e7d0a7635e96001
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -10,7 +10,9 @@ Nyaa is a CLI to Nyaa.eu. You can browse, search, and download. Nifty.
|
|
10
10
|
* Download it or open a browser window from the interface
|
11
11
|
* Nyaa status aware: (aplus, trusted, remake, etc.)
|
12
12
|
* Batch mode for scripts (first page only atm)
|
13
|
-
* Supports unicode characters (requires `libncursesw5-dev` and `ruby1.9`
|
13
|
+
* Supports unicode characters (requires `libncursesw5-dev` and `ruby1.9` or
|
14
|
+
greater)
|
15
|
+
* Tested on Ruby 1.8.7-p371, 1.9.3-p327, 2.0.0-p0
|
14
16
|
|
15
17
|
## Installation
|
16
18
|
|
@@ -26,16 +28,17 @@ Development release:
|
|
26
28
|
|
27
29
|
To browse, simply run `nyaa`. The default category is english anime.
|
28
30
|
|
29
|
-
![](
|
31
|
+
![](http://i.imgur.com/Tzi6zo1.png)
|
30
32
|
|
31
33
|
Nyaa supports all the aspects of search of the main site. You can search by category and/or filters. To download an item, highlight it, and type `g`. To open the description page in a browser, type `i`. A sample query:
|
32
34
|
|
33
35
|
nyaa -f trusted_only psycho pass
|
34
|
-
|
36
|
+
|
37
|
+
![](http://i.imgur.com/mhBQHS1.png)
|
35
38
|
|
36
39
|
For a list of categories and filters, see `nyaa -h`.
|
37
40
|
|
38
|
-
![](
|
41
|
+
![](http://i.imgur.com/In44LcD.png)
|
39
42
|
|
40
43
|
## Contributing
|
41
44
|
1. Fork it
|
data/bin/nyaa
CHANGED
@@ -47,15 +47,13 @@ curses_mode do
|
|
47
47
|
refresh
|
48
48
|
|
49
49
|
case getch
|
50
|
-
when Key::UP
|
51
|
-
when Key::DOWN
|
52
|
-
when '
|
53
|
-
when '
|
54
|
-
when '
|
55
|
-
when 'g' then nyaa.get(cursor)
|
50
|
+
when *[Key::UP,'k'] then cursor = nyaa.move(cursor, -1)
|
51
|
+
when *[Key::DOWN,'j'] then cursor = nyaa.move(cursor, 1)
|
52
|
+
when *[Key::NPAGE,'n'] then nyaa.next_page
|
53
|
+
when *[Key::PPAGE,'p'] then nyaa.prev_page
|
54
|
+
when *[Key::ENTER,'g'] then nyaa.get(cursor)
|
56
55
|
when 'i' then nyaa.open(cursor)
|
57
|
-
when '
|
58
|
-
when 'p' then nyaa.prev_page
|
56
|
+
when '?' then nyaa.help
|
59
57
|
when 'q' then @search.purge && break
|
60
58
|
#when Key::RESIZE then nyaa.status("Window size changed!", :failure)
|
61
59
|
end
|
data/lib/nyaa.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
$:.unshift File.dirname(__FILE__) # For use/testing when no gem is installed
|
3
3
|
# stdlib
|
4
|
+
require 'fileutils'
|
4
5
|
require 'optparse'
|
5
6
|
require 'open-uri'
|
6
7
|
require 'curses'
|
@@ -21,5 +22,6 @@ require 'nyaa/torrent'
|
|
21
22
|
require 'nyaa/search'
|
22
23
|
|
23
24
|
# internal tools
|
25
|
+
require 'nyaa/utils'
|
24
26
|
require 'nyaa/ui'
|
25
27
|
require 'nyaa/downloader'
|
data/lib/nyaa/HELP
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
= NYAA
|
2
|
+
|
3
|
+
Nyaa is a command line interface to the nyaa.eu website.
|
4
|
+
|
5
|
+
= COMMANDS
|
6
|
+
|
7
|
+
↑ or k
|
8
|
+
Scroll up through the list of torrents
|
9
|
+
|
10
|
+
↓ or j
|
11
|
+
Scroll down through the list of torrents
|
12
|
+
|
13
|
+
p or PageUp
|
14
|
+
Skip back a page through the list of torrents
|
15
|
+
|
16
|
+
n or PageDown
|
17
|
+
Skip forward a page through the list of torrents
|
18
|
+
|
19
|
+
i
|
20
|
+
Opens the torrent description page in the default web browser.
|
21
|
+
|
22
|
+
g or ENTER
|
23
|
+
Downloads the torrent into the output directory. This defaults
|
24
|
+
to the current directory, but can be changed. See `nyaa --help`.
|
25
|
+
|
26
|
+
q
|
27
|
+
Quits
|
28
|
+
|
29
|
+
?
|
30
|
+
Opens this help document
|
31
|
+
|
32
|
+
= VIEW
|
33
|
+
|
34
|
+
The header shows the current category you're browsing (e.g.
|
35
|
+
"Anime >> English-translated Anime") in addition to:
|
36
|
+
|
37
|
+
* "Size" refers to size of the files in the torrent
|
38
|
+
* "SE" is the number of seeders
|
39
|
+
* "LE" is the number of leechers
|
40
|
+
|
41
|
+
In the footer, "view" shows which results are currently being displayed,
|
42
|
+
and the total results for your search. "recv" shows the number results
|
43
|
+
currently loaded/fetched. If you page through results too fast, you
|
44
|
+
might have to wait a second for more results to be fetched. "page" shows
|
45
|
+
how many pages of results there are.
|
46
|
+
|
47
|
+
You probably also noticed that some torrents are different colors. The
|
48
|
+
colors correspond to the filters on nyaa.eu. For example, trusted torrents
|
49
|
+
are green and A+ torrents are blue. These colors depend on your terminal
|
50
|
+
color settings, so they might different in your terminal.
|
data/lib/nyaa/cli.rb
CHANGED
@@ -39,12 +39,13 @@ module Nyaa
|
|
39
39
|
puts opts
|
40
40
|
puts %s{
|
41
41
|
Categories:
|
42
|
-
anime_all, anime_raw, anime_english, anime_nonenglish, anime_music_video
|
43
|
-
books_all, books_raw, books_english, books_nonenglish
|
44
|
-
live_all, live_raw, live_english, live_nonenglish, live_promo
|
45
|
-
audio_all, audio_lossless, audio_lossy
|
42
|
+
anime_all, anime_raw, anime_english, anime_nonenglish, anime_music_video,
|
43
|
+
books_all, books_raw, books_english, books_nonenglish,
|
44
|
+
live_all, live_raw, live_english, live_nonenglish, live_promo,
|
45
|
+
audio_all, audio_lossless, audio_lossy,
|
46
46
|
pictures_all, pictures_photos, pictures_graphics,
|
47
|
-
software_all, software_apps, software_games
|
47
|
+
software_all, software_apps, software_games,
|
48
|
+
all_categories
|
48
49
|
|
49
50
|
Filters:
|
50
51
|
show_all, filter_remakes, trusted_only, aplus_only}
|
data/lib/nyaa/constants.rb
CHANGED
data/lib/nyaa/downloader.rb
CHANGED
@@ -6,7 +6,7 @@ module Nyaa
|
|
6
6
|
|
7
7
|
def initialize(url, path, retries = 3)
|
8
8
|
self.target = url
|
9
|
-
self.destination =
|
9
|
+
self.destination = Nyaa::Utils.safe_path(path)
|
10
10
|
self.retries = retries
|
11
11
|
self.response = request
|
12
12
|
self.filename = name_from_disposition
|
@@ -56,10 +56,5 @@ module Nyaa
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
def sane_dir(path)
|
60
|
-
path = Dir.pwd if path.nil? || !File.writable?(path)
|
61
|
-
FileUtils.mkdir_p path unless File.directory?(path)
|
62
|
-
path
|
63
|
-
end
|
64
59
|
end
|
65
60
|
end
|
data/lib/nyaa/ui.rb
CHANGED
@@ -5,6 +5,8 @@ module Nyaa
|
|
5
5
|
class UI
|
6
6
|
attr_accessor :menusize, :page
|
7
7
|
|
8
|
+
DOC = "#{Nyaa::Utils.gem_libdir}/HELP"
|
9
|
+
|
8
10
|
def initialize (config, search)
|
9
11
|
@config = config
|
10
12
|
@status = { :text => 'Ready.', :type => :default }
|
@@ -122,8 +124,9 @@ module Nyaa
|
|
122
124
|
end
|
123
125
|
end
|
124
126
|
|
125
|
-
# TODO: Pop up help window
|
126
127
|
def help
|
128
|
+
system("less #{DOC}")
|
129
|
+
clear
|
127
130
|
end
|
128
131
|
|
129
132
|
def move(cursor, increment)
|
data/lib/nyaa/utils.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
module Nyaa
|
2
|
+
module Utils
|
3
|
+
|
4
|
+
def self.safe_path(path)
|
5
|
+
path = Dir.pwd if path.nil? || !File.writable?(path)
|
6
|
+
FileUtils.mkdir_p path unless File.directory?(path)
|
7
|
+
path
|
8
|
+
end
|
9
|
+
|
10
|
+
# Get gem's lib directory
|
11
|
+
def self.gem_libdir
|
12
|
+
paths = [
|
13
|
+
"#{File.dirname(File.expand_path($0))}/../lib/#{Nyaa::NAME}",
|
14
|
+
"#{Gem.dir}/gems/#{Nyaa::NAME}-#{Nyaa::VERSION}/lib/#{Nyaa::NAME}"
|
15
|
+
]
|
16
|
+
paths.each do |i|
|
17
|
+
return i if File.readable?(i)
|
18
|
+
end
|
19
|
+
|
20
|
+
raise "Could not find 'lib' directory in: #{paths}"
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
data/lib/nyaa/version.rb
CHANGED
metadata
CHANGED
@@ -1,30 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nyaa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.4
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- David Palma
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-01-23 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: nokogiri
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 1.5.5
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 1.5.5
|
30
27
|
description: Browse and download from NyaaTorrents from the command-line. Supports
|
@@ -35,46 +32,44 @@ executables:
|
|
35
32
|
extensions: []
|
36
33
|
extra_rdoc_files: []
|
37
34
|
files:
|
38
|
-
- .gitignore
|
35
|
+
- ".gitignore"
|
39
36
|
- Gemfile
|
40
37
|
- LICENSE
|
41
38
|
- README.md
|
42
39
|
- Rakefile
|
43
40
|
- bin/nyaa
|
44
41
|
- lib/nyaa.rb
|
42
|
+
- lib/nyaa/HELP
|
45
43
|
- lib/nyaa/cli.rb
|
46
44
|
- lib/nyaa/constants.rb
|
47
45
|
- lib/nyaa/downloader.rb
|
48
46
|
- lib/nyaa/search.rb
|
49
47
|
- lib/nyaa/torrent.rb
|
50
48
|
- lib/nyaa/ui.rb
|
49
|
+
- lib/nyaa/utils.rb
|
51
50
|
- lib/nyaa/version.rb
|
52
51
|
- nyaa.gemspec
|
53
|
-
- screenshots/v1.0.0_browse.png
|
54
|
-
- screenshots/v1.0.0_help.png
|
55
|
-
- screenshots/v1.0.0_search.png
|
56
52
|
homepage: https://github.com/mistofvongola/nyaa
|
57
53
|
licenses: []
|
54
|
+
metadata: {}
|
58
55
|
post_install_message:
|
59
56
|
rdoc_options: []
|
60
57
|
require_paths:
|
61
58
|
- - lib
|
62
59
|
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
-
none: false
|
64
60
|
requirements:
|
65
|
-
- -
|
61
|
+
- - ">="
|
66
62
|
- !ruby/object:Gem::Version
|
67
63
|
version: '0'
|
68
64
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
-
none: false
|
70
65
|
requirements:
|
71
|
-
- -
|
66
|
+
- - ">="
|
72
67
|
- !ruby/object:Gem::Version
|
73
68
|
version: '0'
|
74
69
|
requirements: []
|
75
70
|
rubyforge_project:
|
76
|
-
rubygems_version:
|
71
|
+
rubygems_version: 2.0.3
|
77
72
|
signing_key:
|
78
|
-
specification_version:
|
73
|
+
specification_version: 4
|
79
74
|
summary: The nyaa gem is a CLI to NyaaTorrents.
|
80
75
|
test_files: []
|
Binary file
|
data/screenshots/v1.0.0_help.png
DELETED
Binary file
|
Binary file
|