nehm 2.2 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +10 -5
- data/lib/nehm/command.rb +1 -0
- data/lib/nehm/commands/help_command.rb +10 -12
- data/lib/nehm/commands/list_command.rb +2 -1
- data/lib/nehm/commands/search_command.rb +2 -1
- data/lib/nehm/track.rb +1 -1
- data/lib/nehm/track_manager.rb +8 -6
- data/lib/nehm/tracks_view_command.rb +15 -1
- data/lib/nehm/version.rb +1 -1
- data/nehm.gemspec +0 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ef72ee45232c3392418a466fdbb1dc7dc190c65
|
4
|
+
data.tar.gz: b5158776e4e34d80ef33d00ee778beb51e478d05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb586861dc9ed9e2065adfeb3eac510a7793db7590150c0a030ceaade3e1c053737c43fe37d013bfb617d3b0c3213189b1d060a7b88606947fe1cf5e400d80f4
|
7
|
+
data.tar.gz: 32e2611f1e840d59d7a2c91d80318b05c8c84d8fa335fbf7d81ff57e8e5b9219eab2ff911712eb0cdd5c845855272b568e76822f55a051d820abedfbab3ab2d9
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -7,13 +7,14 @@
|
|
7
7
|
<a href="http://badge.fury.io/rb/nehm"><img src="https://badge.fury.io/rb/nehm.svg" alt="Gem Version"></img></a>
|
8
8
|
<a href="https://gemnasium.com/bogem/nehm"><img src="https://gemnasium.com/bogem/nehm.svg" alt="Dependency staus"></img></a>
|
9
9
|
<a href="https://codeclimate.com/github/bogem/nehm"><img src="https://codeclimate.com/github/bogem/nehm/badges/gpa.svg" alt="Code climate"></img></a>
|
10
|
+
<a href="https://github.com/bogem/nehm/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License"></img></a>
|
10
11
|
</div>
|
11
12
|
|
12
13
|
---
|
13
14
|
<div align="center">
|
14
15
|
<a href="https://www.dropbox.com/s/m4heiyq7vbpc4qs/1help.png" target="_blank"><img src="https://raw.github.com/bogem/nehm/master/Pictures/1help.png" alt="Help"></img></a>
|
15
16
|
<a href="https://www.dropbox.com/s/b68flm7hv5myhk4/2get.png" target="_blank"><img src="https://raw.github.com/bogem/nehm/master/Pictures/2get.png" alt="Get"></img></a>
|
16
|
-
<a href="https://www.dropbox.com/s/
|
17
|
+
<a href="https://www.dropbox.com/s/0cmcn59ho7kcjke/3list.png" target="_blank"><img src="https://raw.github.com/bogem/nehm/master/Pictures/3list.png" alt="List"></img></a>
|
17
18
|
<a href="https://www.dropbox.com/s/ynn9kb0ykcdishp/4search.png" target="_blank"><img src="https://raw.github.com/bogem/nehm/master/Pictures/4search.png" alt="Search"></img></a>
|
18
19
|
|
19
20
|
<p><b>(click to zoom)</b></p>
|
@@ -33,7 +34,9 @@ Nehm developer doesn't responsible for any illegal usage of this program</i></b>
|
|
33
34
|
|
34
35
|
## Installation
|
35
36
|
|
36
|
-
**1. Install
|
37
|
+
**1. [Install Ruby](https://www.ruby-lang.org/en/documentation/installation/)**
|
38
|
+
|
39
|
+
**2. Install `taglib` library**
|
37
40
|
|
38
41
|
**Mac OS X:**
|
39
42
|
|
@@ -49,23 +52,25 @@ Debian/Ubuntu: `sudo apt-get install libtag1-dev`
|
|
49
52
|
|
50
53
|
Fedora/RHEL: `sudo yum install taglib-devel`
|
51
54
|
|
52
|
-
**
|
55
|
+
**3. Install `nehm` gem:**
|
53
56
|
|
54
57
|
`gem install nehm`
|
55
58
|
|
56
59
|
## First usage
|
57
60
|
|
58
|
-
If you just installed nehm
|
61
|
+
If you just installed `nehm`, write any command for its setup
|
59
62
|
|
60
63
|
For example, `nehm help`
|
61
64
|
|
62
|
-
nehm should answer like this:
|
65
|
+
`nehm` should answer like this:
|
63
66
|
```
|
64
67
|
Hello!
|
65
68
|
Before using the nehm, you should set it up:
|
66
69
|
Enter path to desirable download directory (press enter to set it to ...
|
67
70
|
```
|
68
71
|
|
72
|
+
And then follow instruction, which `nehm` gives
|
73
|
+
|
69
74
|
## Usage Examples
|
70
75
|
|
71
76
|
Type `nehm help` to list of all available commands or `nehm help COMMAND` for specific command
|
data/lib/nehm/command.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Nehm
|
2
2
|
class HelpCommand < Command
|
3
3
|
|
4
|
-
SPACES_BTWN_NAME_AND_DESC =
|
4
|
+
SPACES_BTWN_NAME_AND_DESC = 15
|
5
5
|
|
6
6
|
def execute
|
7
7
|
command_name = options[:args].pop
|
@@ -65,19 +65,17 @@ module Nehm
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def show_info(hash)
|
68
|
-
@longest ||=
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
end
|
68
|
+
@longest ||=
|
69
|
+
Proc.new do
|
70
|
+
names = []
|
71
|
+
names += @cmd.arguments.keys unless @cmd.arguments.empty?
|
72
|
+
names += @cmd.options_descs.keys unless @cmd.options_descs.empty?
|
73
|
+
find_longest_name(names).length
|
74
|
+
end.call
|
76
75
|
|
77
76
|
hash.each do |name, desc|
|
78
|
-
|
79
|
-
|
80
|
-
UI.say " #{name.green}#{' ' * (need_spaces + SPACES_BTWN_NAME_AND_DESC)}#{desc}"
|
77
|
+
space_count = @longest + SPACES_BTWN_NAME_AND_DESC
|
78
|
+
UI.say " #{name.green.ljust(space_count)}#{desc}"
|
81
79
|
end
|
82
80
|
end
|
83
81
|
|
data/lib/nehm/track.rb
CHANGED
data/lib/nehm/track_manager.rb
CHANGED
@@ -12,7 +12,6 @@ module Nehm
|
|
12
12
|
|
13
13
|
def process_tracks(tracks)
|
14
14
|
tracks.reverse_each do |track|
|
15
|
-
UI.newline
|
16
15
|
dl(track)
|
17
16
|
tag(track)
|
18
17
|
track.artwork.suicide
|
@@ -40,7 +39,6 @@ module Nehm
|
|
40
39
|
posts = Client.tracks(limit, offset, :posts, @uid)
|
41
40
|
return nil if posts.empty?
|
42
41
|
|
43
|
-
posts.reject! { |hash| hash['type'] == 'playlist' }
|
44
42
|
posts.map! { |hash| hash['track'] }
|
45
43
|
filter(posts)
|
46
44
|
convert(posts)
|
@@ -107,7 +105,7 @@ module Nehm
|
|
107
105
|
unless @uid
|
108
106
|
UI.error "You didn't logged in"
|
109
107
|
UI.say "Login from #{'nehm configure'.yellow} " \
|
110
|
-
"or use #{'
|
108
|
+
"or use #{'from PERMALINK'.yellow} option"
|
111
109
|
UI.term
|
112
110
|
end
|
113
111
|
|
@@ -117,7 +115,7 @@ module Nehm
|
|
117
115
|
if dl_path
|
118
116
|
ENV['dl_path'] = dl_path
|
119
117
|
else
|
120
|
-
UI.error "You
|
118
|
+
UI.error "You didn't set up download path!"
|
121
119
|
UI.say "Set it up from #{'nehm configure'.yellow} " \
|
122
120
|
"or use #{'to PATH'.yellow} option"
|
123
121
|
UI.term
|
@@ -132,9 +130,13 @@ module Nehm
|
|
132
130
|
end
|
133
131
|
|
134
132
|
def filter(tracks)
|
135
|
-
# Removing unstreamable tracks
|
136
133
|
first_length = tracks.length
|
137
|
-
|
134
|
+
|
135
|
+
# Filters
|
136
|
+
tracks.select! do |hash|
|
137
|
+
hash['type'] != 'playlist' || hash['streamable'] unless hash.nil?
|
138
|
+
end
|
139
|
+
|
138
140
|
diff = first_length - tracks.length
|
139
141
|
|
140
142
|
UI.warning "Was skipped #{diff} undownloadable track(s)" if diff > 0
|
@@ -1,4 +1,14 @@
|
|
1
1
|
module Nehm
|
2
|
+
|
3
|
+
##
|
4
|
+
# TracksViewCommand is a super class for all commands, that show tracks
|
5
|
+
# in list and let download selected tracks. When creating a new
|
6
|
+
# TracksViewCommand, define #get_tracks (protected), #initialize, #arguments, #program_name,
|
7
|
+
# #summary and #usage. You can also define #execute if you need, but
|
8
|
+
# you must place also 'super' in this inherited method
|
9
|
+
#
|
10
|
+
# See 'list_command.rb' or 'search_command.rb' as example
|
11
|
+
|
2
12
|
class TracksViewCommand < Command
|
3
13
|
|
4
14
|
DEFAULT_LIMIT = 10
|
@@ -38,7 +48,10 @@ module Nehm
|
|
38
48
|
|
39
49
|
protected
|
40
50
|
|
41
|
-
def get_tracks
|
51
|
+
def get_tracks
|
52
|
+
raise StandardError, "You must define 'get_tracks' method"
|
53
|
+
end
|
54
|
+
|
42
55
|
|
43
56
|
def show_menu(tracks)
|
44
57
|
UI.menu do |menu|
|
@@ -73,6 +86,7 @@ module Nehm
|
|
73
86
|
end
|
74
87
|
|
75
88
|
def download_tracks_from_queue
|
89
|
+
UI.newline
|
76
90
|
@track_manager.process_tracks(@queue)
|
77
91
|
end
|
78
92
|
|
data/lib/nehm/version.rb
CHANGED
data/nehm.gemspec
CHANGED
@@ -19,7 +19,6 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = 'nehm'
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
spec.required_ruby_version = '>= 1.9.3'
|
22
|
-
spec.post_install_message = "Don't forget to install Taglib from OS' package manager!"
|
23
22
|
|
24
23
|
spec.add_dependency 'certifi'
|
25
24
|
spec.add_dependency 'colored'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nehm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Albert Nigmatzianov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: certifi
|
@@ -132,7 +132,7 @@ homepage: http://www.github.com/bogem/nehm
|
|
132
132
|
licenses:
|
133
133
|
- MIT
|
134
134
|
metadata: {}
|
135
|
-
post_install_message:
|
135
|
+
post_install_message:
|
136
136
|
rdoc_options: []
|
137
137
|
require_paths:
|
138
138
|
- lib
|