nehm 1.5.4 → 1.5.5.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: 9da0b37e8738ecc87f3169744ac7bad706e04814
4
- data.tar.gz: ccc01546551cd7f5836a59cb16d1323347917470
3
+ metadata.gz: 8b56162720e521296eab895683dc2fa1c8829d9d
4
+ data.tar.gz: edfdc21208cc7ef4fcf079b10c76717a64ef6a6d
5
5
  SHA512:
6
- metadata.gz: 3a2405ccecfd65c5012471cc694caae4735c92a75e923c77e95f0bf9551309a7a2d5b350d2e7caf50b4cb5015113fe7bc6b3f5924ae3fffe4fff6b3abad0c97c
7
- data.tar.gz: 1933d9e9b7430102a13a6b01e423109190fc5559a37c88eb651fe5a321899ad1ea8307d1c7e2a7455d91905718824162fe4b8b0b1b3881f9d6dec35f82869906
6
+ metadata.gz: b136d0b1e1db0198a9ed64e8dca40208f08f8218d606f5ecbfac05652270745f171ed0b41895502c1be0717b2acd6f2d82961f4fd96a20768a1201009ddb1b3f
7
+ data.tar.gz: cc7b42a50791e55e5014b8da6f4d295d9ad7c66d1cfa8564942f916ae2ca0328efae6e8d2f70c8a217b858db2c4efead95b58990e020291c2f68039279bdf8a5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # nehm change log
2
2
 
3
+ ## 1.5.5.1
4
+ * Fix bug with `nil` in user class
5
+
6
+ ## 1.5.5
7
+ * Add `version` command
8
+ * Some bug fixes for Linux users
9
+ * Edit some output messages
10
+ * Minor optimizations
11
+
3
12
  ## 1.5.4
4
13
  * Add availability to get/dl 300+ likes and posts
5
14
  * More convenient CLI
@@ -21,7 +30,6 @@
21
30
  * Add `url` option to `dl` and `get`
22
31
 
23
32
  ## 1.5
24
-
25
33
  * Add support for Ruby 1.9.3
26
34
  * Edit application structure
27
35
  * Improve performance when adding tracks to iTunes library
@@ -29,16 +37,13 @@
29
37
  * Prettify `nehm help`
30
38
 
31
39
  ## 1.4.2
32
-
33
40
  * Fix: app fails if you didn't set up playlist (again)
34
41
  * Reduce gem size
35
42
 
36
43
  ## 1.4.1
37
-
38
44
  * Fix: app fails if you didn't set up playlist
39
45
 
40
46
  ## 1.4
41
-
42
47
  * Now nehm can automatically add track to iTunes playlist. Enter `nehm configure` to set it up
43
48
  * Also you can download tracks with custom iTunes playlist with `playlist PLAYLIST` feature. See the 'Usage' for instructions
44
49
  * Handle more errors
@@ -49,91 +54,70 @@
49
54
  * Minor improvements and fixes
50
55
 
51
56
  ## 1.3.3
52
-
53
57
  * Add `to current` feature
54
58
 
55
59
  ## 1.3.2
56
-
57
60
  * Add check for no user's posts/likes
58
61
 
59
62
  ## 1.3.1.1
60
-
61
63
  * Minor changes
62
64
 
63
65
  ## 1.3.1
64
-
65
66
  * Edit looped configure menu
66
67
 
67
68
  ## 1.3
68
-
69
69
  * Now you can type short paths to download and iTunes paths while configuring nehm (e.g. ~/Music)
70
70
  * Configure menu doesn't automatically exit after choose
71
71
  * nehm doesn't ask for iTunes path by first run
72
72
 
73
73
  ## 1.2.2
74
-
75
74
  * Tracks has got now year tag
76
75
 
77
76
  ## 1.2.1
78
-
79
77
  * Minor technical update
80
78
 
81
79
  ## 1.2
82
-
83
80
  * Add `to PARHTODIRECTORY` feature. See the 'Usage' for instructions
84
81
  * Improve readability of help
85
82
  * Add some error checks
86
83
 
87
84
  ## 1.1
88
-
89
85
  * Add `from PERMALINK` feature. See the 'Usage' for instructions
90
86
 
91
87
  ## 1.0.7.1
92
-
93
88
  * Remove useless dependency :)
94
89
 
95
90
  ## 1.0.7
96
-
97
91
  * Add paint dependency
98
92
 
99
93
  ## 1.0.6.1
100
-
101
94
  * Edit gem description
102
95
  * Edit dependencies
103
96
 
104
97
  ## 1.0.6
105
-
106
98
  * Add check for invalid number of likes/posts
107
99
  * Add `CHANGELOG.md`
108
100
  * Use `OPTIONS` instead of `[options]` in help
109
101
 
110
102
  ## 1.0.5
111
-
112
103
  * Fix bundler development dependency
113
104
 
114
105
  ## 1.0.4
115
-
116
106
  * Edit summary in gemspec
117
107
 
118
108
  ## 1.0.3
119
-
120
109
  * Change description of nehm
121
110
 
122
111
  ## 1.0.2
123
-
124
112
  * Edit path to nehm version in Rakefile
125
113
  * Fix: nehm fails, then setting tags to track
126
114
 
127
115
  ## 1.0.1
128
-
129
116
  * Rakefile:
130
-
131
117
  * Add push (push to rubygems.org) task
132
118
  * Modify tasks
133
-
134
119
  * Edit required Ruby version
135
120
  * Fix: if you type invalid argument in `nehm get`, then app fails
136
121
 
137
122
  ## 1.0
138
-
139
123
  * First release!
data/bin/nehm CHANGED
@@ -3,4 +3,4 @@ nehm_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
3
3
  $LOAD_PATH.unshift(nehm_dir) unless $LOAD_PATH.include?(nehm_dir)
4
4
  require 'nehm'
5
5
 
6
- App.do(ARGV)
6
+ Nehm::App.do(ARGV)
data/lib/nehm.rb CHANGED
@@ -15,52 +15,57 @@ require 'nehm/playlist_manager'
15
15
  require 'nehm/track'
16
16
  require 'nehm/user'
17
17
  require 'nehm/user_manager'
18
+ require 'nehm/version'
18
19
 
19
- module App
20
- def self.do(args)
21
- init unless initialized?
20
+ module Nehm
21
+ module App
22
+ def self.do(args)
23
+ init unless initialized?
22
24
 
23
- command = args.shift
24
- case command
25
- when 'get'
26
- Get[:get, args]
27
- when 'dl'
28
- Get[:dl, args]
29
- when 'configure'
30
- Configure.menu
31
- when 'help', nil
32
- Help.show(args.first)
33
- else
34
- puts Paint["Invalid command '#{command}'", :red]
35
- puts "Input #{Paint['nehm help', :yellow]} for all avalaible commands"
36
- end
37
-
38
- # SIGINT
39
- rescue Interrupt
40
- puts "\nGoodbye!"
41
- end
25
+ command = args.shift
26
+ case command
27
+ when 'get'
28
+ Get[:get, args]
29
+ when 'dl'
30
+ Get[:dl, args]
31
+ when 'configure'
32
+ Configure.menu
33
+ when 'version'
34
+ puts Nehm::VERSION
35
+ when 'help', nil
36
+ Help.show(args.first)
37
+ else
38
+ puts Paint["Invalid command '#{command}'", :red]
39
+ puts "Input #{Paint['nehm help', :yellow]} for all avalaible commands"
40
+ end
42
41
 
43
- module_function
42
+ # SIGINT
43
+ rescue Interrupt
44
+ puts "\nGoodbye!"
45
+ end
44
46
 
45
- def init
46
- puts Paint['Hello!', :green]
47
- puts 'Before using the nehm, you should set it up:'
48
- Cfg.create unless Cfg.exist?
47
+ module_function
49
48
 
50
- PathManager.set_dl_path
51
- puts "\n"
49
+ def init
50
+ puts Paint['Hello!', :green]
51
+ puts 'Before using the nehm, you should set it up:'
52
+ Cfg.create unless Cfg.exist?
52
53
 
53
- unless OS.linux?
54
- PlaylistManager.set_playlist
54
+ PathManager.set_dl_path
55
55
  puts "\n"
56
- end
57
56
 
58
- UserManager.log_in
57
+ unless OS.linux?
58
+ PlaylistManager.set_playlist
59
+ puts "\n"
60
+ end
59
61
 
60
- puts Paint['Now you can use nehm :)', :green]
61
- end
62
+ UserManager.log_in
63
+
64
+ puts Paint["Now you can use nehm!\n", :green]
65
+ end
62
66
 
63
- def initialized?
64
- File.exist?(Cfg::FILE_PATH)
67
+ def initialized?
68
+ File.exist?(Cfg::FILE_PATH)
69
+ end
65
70
  end
66
71
  end
@@ -1,21 +1,24 @@
1
- module AppleScript
2
- def self.add_track_to_playlist(track_path, playlist_name)
3
- `osascript \"#{script_path(:add_track_to_playlist)}\" \"#{track_path}\" \"#{playlist_name}\" > /dev/null`
4
- end
1
+ module Nehm
2
+ # Module which works with AppleScript scripts
3
+ module AppleScript
4
+ def self.add_track_to_playlist(track_path, playlist_name)
5
+ `osascript \"#{script_path(:add_track_to_playlist)}\" \"#{track_path}\" \"#{playlist_name}\" > /dev/null`
6
+ end
5
7
 
6
- def self.list_of_playlists
7
- output = `osascript \"#{script_path(:list_of_playlists)}\"`
8
- output.chomp.split(', ')
9
- end
8
+ def self.list_of_playlists
9
+ output = `osascript \"#{script_path(:list_of_playlists)}\"`
10
+ output.chomp.split(', ')
11
+ end
10
12
 
11
- def self.music_master_library
12
- `osascript \"#{script_path(:music_master_library)}\"`
13
- end
13
+ def self.music_master_library
14
+ `osascript \"#{script_path(:music_master_library)}\"`
15
+ end
14
16
 
15
- module_function
17
+ module_function
16
18
 
17
- def script_path(script_name)
18
- applescripts_path = File.expand_path(File.join(File.dirname(__FILE__), 'applescripts'))
19
- File.join(applescripts_path, "#{script_name.to_s}.applescript")
19
+ def script_path(script_name)
20
+ applescripts_path = File.expand_path(File.join(File.dirname(__FILE__), 'applescripts'))
21
+ File.join(applescripts_path, "#{script_name.to_s}.applescript")
22
+ end
20
23
  end
21
24
  end
data/lib/nehm/artwork.rb CHANGED
@@ -1,30 +1,32 @@
1
- # Artwork objects contains all needed information of track's artwork
2
- class Artwork
3
- def initialize(track)
4
- @track = track
5
- end
1
+ module Nehm
2
+ # Artwork objects contains all needed information of track's artwork
3
+ class Artwork
4
+ def initialize(track)
5
+ @track = track
6
+ end
6
7
 
7
- def file_path
8
- File.join('/tmp', "#{@track.id}.jpg")
9
- end
8
+ def file_path
9
+ File.join('/tmp', "#{@track.id}.jpg")
10
+ end
10
11
 
11
- # Use in Get.dl
12
- def name
13
- 'artwork'
14
- end
12
+ # Use in Get.dl
13
+ def name
14
+ 'artwork'
15
+ end
15
16
 
16
- def suicide
17
- File.delete(file_path)
18
- end
17
+ def suicide
18
+ File.delete(file_path)
19
+ end
19
20
 
20
- def url
21
- hash = @track.hash
22
- url =
23
- if hash['artwork_url'].nil?
24
- hash['user']['avatar_url']
25
- else
26
- hash['artwork_url']
27
- end
28
- url.sub('large', 't500x500')
21
+ def url
22
+ hash = @track.hash
23
+ url =
24
+ if hash['artwork_url'].nil?
25
+ hash['user']['avatar_url']
26
+ else
27
+ hash['artwork_url']
28
+ end
29
+ url.sub('large', 't500x500')
30
+ end
29
31
  end
30
32
  end
data/lib/nehm/cfg.rb CHANGED
@@ -1,27 +1,30 @@
1
1
  require 'bogy'
2
2
 
3
- # Cfg module manipulate with nehm's config file (~/.nehmconfig)
4
- module Cfg
5
- FILE_PATH = File.join(ENV['HOME'], '.nehmconfig')
6
- CONFIG_FILE = Bogy.new(file: FILE_PATH)
7
3
 
8
- def self.[](key)
9
- CONFIG_FILE[key.to_s]
10
- end
4
+ module Nehm
5
+ # Cfg module manipulates with nehm's config file (~/.nehmconfig)
6
+ module Cfg
7
+ FILE_PATH = File.join(ENV['HOME'], '.nehmconfig')
8
+ CONFIG_FILE = Bogy.new(file: FILE_PATH)
11
9
 
12
- def self.[]=(key, value)
13
- CONFIG_FILE[key.to_s] = value
14
- end
10
+ def self.[](key)
11
+ CONFIG_FILE[key.to_s]
12
+ end
15
13
 
16
- def self.create
17
- File.open(FILE_PATH, 'w+') { |f| f.write("---\napp: nehm") }
18
- end
14
+ def self.[]=(key, value)
15
+ CONFIG_FILE[key.to_s] = value
16
+ end
19
17
 
20
- def self.exist?
21
- File.exist?(FILE_PATH)
22
- end
18
+ def self.create
19
+ File.open(FILE_PATH, 'w+') { |f| f.write("---\napp: nehm") }
20
+ end
21
+
22
+ def self.exist?
23
+ File.exist?(FILE_PATH)
24
+ end
23
25
 
24
- def self.key?(key)
25
- CONFIG_FILE.to_h.key?(key.to_s)
26
+ def self.key?(key)
27
+ CONFIG_FILE.to_h.key?(key.to_s)
28
+ end
26
29
  end
27
30
  end
data/lib/nehm/client.rb CHANGED
@@ -1,21 +1,23 @@
1
1
  require 'certifi'
2
2
  require 'soundcloud'
3
3
 
4
- # Just a Soundcloud API client.
5
- module Client
6
- # Set a SSL certificate file path for SC API
7
- ENV['SSL_CERT_FILE'] = Certifi.where
4
+ module Nehm
5
+ # Soundcloud API client.
6
+ module Client
7
+ # Set a SSL certificate file path for SC API
8
+ ENV['SSL_CERT_FILE'] = Certifi.where
8
9
 
9
- # SoundCloud API client ID
10
- CLIENT_ID = '11a37feb6ccc034d5975f3f803928a32'
10
+ # SoundCloud API client ID
11
+ CLIENT_ID = '11a37feb6ccc034d5975f3f803928a32'
11
12
 
12
- def self.get(*args)
13
- sc_client.get(*args)
14
- end
13
+ def self.get(*args)
14
+ sc_client.get(*args)
15
+ end
15
16
 
16
- module_function
17
+ module_function
17
18
 
18
- def sc_client
19
- @client ||= Soundcloud.new(client_id: CLIENT_ID)
19
+ def sc_client
20
+ @client ||= Soundcloud.new(client_id: CLIENT_ID)
21
+ end
20
22
  end
21
23
  end
@@ -1,22 +1,24 @@
1
- # Configure module responds to 'nehm configure' command
2
- module Configure
3
- def self.menu
4
- loop do
5
- puts "Download path: #{Paint[Cfg[:dl_path], :magenta]}"
6
- puts "Permalink: #{Paint[Cfg[:permalink], :cyan]}"
7
- puts "iTunes playlist: #{Paint[PlaylistManager.playlist, :cyan]}" unless OS.linux?
8
- puts "\n"
1
+ module Nehm
2
+ # Configure module responds to 'nehm configure' command
3
+ module Configure
4
+ def self.menu
5
+ loop do
6
+ puts "Download path: #{Paint[Cfg[:dl_path], :magenta]}"
7
+ puts "Permalink: #{Paint[Cfg[:permalink], :cyan]}"
8
+ puts "iTunes playlist: #{Paint[PlaylistManager.playlist, :cyan]}" unless OS.linux?
9
+ puts "\n"
9
10
 
10
- HighLine.new.choose do |menu|
11
- menu.prompt = Paint['Choose setting', :yellow]
11
+ HighLine.new.choose do |menu|
12
+ menu.prompt = Paint['Choose setting', :yellow]
12
13
 
13
- menu.choice('Edit download path'.freeze) { PathManager.set_dl_path }
14
- menu.choice('Edit permalink'.freeze) { UserManager.log_in }
15
- menu.choice('Edit iTunes playlist'.freeze) { PlaylistManager.set_playlist } unless OS.linux?
16
- menu.choice('Exit'.freeze) { puts 'Goodbye!'; exit }
14
+ menu.choice('Edit download path'.freeze) { PathManager.set_dl_path }
15
+ menu.choice('Edit permalink'.freeze) { UserManager.log_in }
16
+ menu.choice('Edit iTunes playlist'.freeze) { PlaylistManager.set_playlist } unless OS.linux?
17
+ menu.choice('Exit'.freeze) { puts 'Goodbye!'; exit }
18
+ end
19
+ sleep(1)
20
+ puts "\n"
17
21
  end
18
- sleep(1)
19
- puts "\n"
20
22
  end
21
23
  end
22
24
  end