nehm 2.2 → 2.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8bf7e68091443c74df5a8e00dcc08a999727ce5a
4
- data.tar.gz: a0e51c37733f016e288897e6810c2ad9b189b814
3
+ metadata.gz: 8ef72ee45232c3392418a466fdbb1dc7dc190c65
4
+ data.tar.gz: b5158776e4e34d80ef33d00ee778beb51e478d05
5
5
  SHA512:
6
- metadata.gz: f0234c789ef84484ff2cc78432a971035fb2bd7ae985b3760cc0231e3b5cd8cf247497ed7d5f1f80f1b14861722a751f0032feb2d759c5ea4926f5d09889a6b7
7
- data.tar.gz: 1983f674098e5a068b1fa944e773afaad4e5530f6cefc5cc13415f374f2b756e6e221e3ab594bfb6c99581f3e4c38ce0b42d31757675150bf3150f2574ecc301
6
+ metadata.gz: fb586861dc9ed9e2065adfeb3eac510a7793db7590150c0a030ceaade3e1c053737c43fe37d013bfb617d3b0c3213189b1d060a7b88606947fe1cf5e400d80f4
7
+ data.tar.gz: 32e2611f1e840d59d7a2c91d80318b05c8c84d8fa335fbf7d81ff57e8e5b9219eab2ff911712eb0cdd5c845855272b568e76822f55a051d820abedfbab3ab2d9
@@ -1,5 +1,8 @@
1
1
  # nehm change log
2
2
 
3
+ ## 2.2.1
4
+ * Small improvements
5
+
3
6
  ## 2.2
4
7
  * Rename `select` command to `list`
5
8
  * Some prettifying things in `help`
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/5gy6c5nzrsvhlv0/3select.png" target="_blank"><img src="https://raw.github.com/bogem/nehm/master/Pictures/3select.png" alt="List"></img></a>
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 `taglib` library**
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
- **2. Install `nehm` gem:**
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, write any command for its setup
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
@@ -53,6 +53,7 @@ module Nehm
53
53
  # be left in #options[:args]
54
54
 
55
55
  def execute
56
+ raise StandardError, 'generic command has no actions'
56
57
  end
57
58
 
58
59
  ##
@@ -1,7 +1,7 @@
1
1
  module Nehm
2
2
  class HelpCommand < Command
3
3
 
4
- SPACES_BTWN_NAME_AND_DESC = 3
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 ||= nil
69
-
70
- unless @longest
71
- names = []
72
- names += @cmd.arguments.keys unless @cmd.arguments.empty?
73
- names += @cmd.options_descs.keys unless @cmd.options_descs.empty?
74
- @longest ||= find_longest_name(names).length
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
- need_spaces = @longest - name.length
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
 
@@ -45,7 +45,8 @@ module Nehm
45
45
  end
46
46
 
47
47
  def summary
48
- 'Get list of likes or posts from your account and download selected'
48
+ 'Get list of likes or posts from your account and download, set tags ' \
49
+ 'and add to iTunes selected'
49
50
  end
50
51
 
51
52
  def usage
@@ -47,7 +47,8 @@ module Nehm
47
47
  end
48
48
 
49
49
  def summary
50
- 'Search tracks, print them nicely and download selected tracks'
50
+ 'Search tracks, print them nicely and download, set tags and add ' \
51
+ 'to iTunes selected'
51
52
  end
52
53
 
53
54
  def usage
@@ -30,7 +30,7 @@ module Nehm
30
30
  end
31
31
 
32
32
  def file_name
33
- "#{full_name.tr(',./\\\'$%"', '')}.mp3"
33
+ "#{full_name.tr(",./'\\\"$%", '')}.mp3"
34
34
  end
35
35
 
36
36
  def file_path
@@ -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 #{'[from PERMALINK]'.yellow} option"
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 don't set up download path!"
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
- tracks.select! { |hash| hash['streamable'] }
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; end
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
 
@@ -1,3 +1,3 @@
1
1
  module Nehm
2
- VERSION = '2.2'.freeze
2
+ VERSION = '2.2.1'.freeze
3
3
  end
@@ -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: '2.2'
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-18 00:00:00.000000000 Z
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: Don't forget to install Taglib from OS' package manager!
135
+ post_install_message:
136
136
  rdoc_options: []
137
137
  require_paths:
138
138
  - lib