nehm 1.5.2 → 1.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +16 -19
- data/lib/nehm.rb +6 -6
- data/lib/nehm/applescript.rb +3 -3
- data/lib/nehm/configure.rb +5 -4
- data/lib/nehm/get.rb +9 -13
- data/lib/nehm/{path_control.rb → path_manager.rb} +11 -13
- data/lib/nehm/{playlist_control.rb → playlist_manager.rb} +2 -2
- data/lib/nehm/track.rb +2 -2
- data/lib/nehm/user.rb +1 -0
- data/lib/nehm/{user_control.rb → user_manager.rb} +2 -2
- data/lib/nehm/version.rb +1 -1
- data/nehm.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5bd2f9e928ec72d11c65ff7e1a8d4ab251e401c8
|
4
|
+
data.tar.gz: 0422b2fceff29c45f852fe547670e6cd17753505
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa9bfb36d31c334f211885c42e0c85bc2eae664b4fc7e7ef8000a38f6933124de3bf5be6b0e56762aa83a6974e2770764780483944301c332575833319e7bd50
|
7
|
+
data.tar.gz: 36b2cfedab998142757a7a871868fa1d885b718a25560c468d80a09f4975a79714936405ebe296b92384d42684dd081f5f406c6e435457663f7255940a40c444
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
# nehm
|
2
2
|
|
3
|
+
![ScreenShot](https://raw.github.com/bogem/nehm/master/Screenshots/screenshot.png)
|
4
|
+
|
3
5
|
*nehm* is a console tool, which downloads, sets IDv3 tags and adds to your iTunes library your SoundCloud posts or likes in convenient way
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
7
|
-
**1.
|
9
|
+
**1. Install `taglib` library**
|
8
10
|
|
9
11
|
**Mac OS X:**
|
10
12
|
|
@@ -20,12 +22,10 @@ Debian/Ubuntu: `sudo apt-get install libtag1-dev`
|
|
20
22
|
|
21
23
|
Fedora/RHEL: `sudo yum install taglib-devel`
|
22
24
|
|
23
|
-
**2.
|
25
|
+
**2. Install `nehm` gem:**
|
24
26
|
|
25
27
|
`gem install nehm`
|
26
28
|
|
27
|
-
**That's all!**
|
28
|
-
|
29
29
|
## First usage
|
30
30
|
|
31
31
|
If you just installed nehm, write any command for its setup
|
@@ -39,44 +39,41 @@ Before using the nehm, you should set it up:
|
|
39
39
|
Enter path to desirable download directory (press enter to set it to ...
|
40
40
|
```
|
41
41
|
|
42
|
-
**Now you can use nehm!**
|
43
|
-
Go to usage for further instructions
|
44
|
-
|
45
42
|
## Usage
|
46
43
|
|
47
44
|
**!!nehm doesn't add tracks to iTunes library, if you use Linux!!**
|
48
45
|
|
49
|
-
*
|
46
|
+
* Get (download to download directory, set tags and add to iTunes library) your last like
|
50
47
|
|
51
48
|
`nehm get like`
|
52
49
|
|
53
|
-
*
|
50
|
+
* Get your last post (last track or repost from your profile)
|
54
51
|
|
55
52
|
`nehm get post`
|
56
53
|
|
57
|
-
*
|
54
|
+
* Get multiple last posts or likes
|
58
55
|
|
59
56
|
`nehm get 3 posts` or `nehm get 3 likes`
|
60
57
|
|
61
|
-
*
|
58
|
+
* Just download and set tags any track, you can input
|
62
59
|
|
63
60
|
`nehm dl post` or `nehm dl like` or `nehm dl 3 likes`
|
64
61
|
|
65
|
-
*
|
62
|
+
* Get tracks from another user
|
66
63
|
|
67
64
|
`nehm get post from nasa` or `nehm dl like from bogem`
|
68
65
|
|
69
|
-
*
|
66
|
+
* Get tracks to another directory
|
70
67
|
|
71
68
|
`nehm get post from nasa to ~/Downloads` or `nehm dl like from bogem to current`
|
72
69
|
|
73
|
-
*(if you type `to current`, nehm will get track to current working directory)*
|
70
|
+
*(if you type `to current`, `nehm` will get track to current working directory)*
|
74
71
|
|
75
|
-
*
|
72
|
+
* Get tracks to another iTunes playlist
|
76
73
|
|
77
74
|
`nehm get post playlist MyPlaylist`
|
78
75
|
|
79
|
-
*
|
76
|
+
* Get or download track from url
|
80
77
|
|
81
78
|
`nehm get https://soundcloud.com/nasa/delta-iv-launch`
|
82
79
|
|
@@ -84,11 +81,11 @@ Go to usage for further instructions
|
|
84
81
|
|
85
82
|
`nehm dl https://soundcloud.com/nasa/delta-iv-launch`
|
86
83
|
|
87
|
-
*
|
84
|
+
* Configure (change download directory, permalink, playlist)
|
88
85
|
|
89
86
|
`nehm configure`
|
90
87
|
|
91
|
-
*
|
88
|
+
* Help
|
92
89
|
|
93
90
|
`nehm help`
|
94
91
|
|
@@ -100,7 +97,7 @@ A: Permalink is the last word in your profile url. **Example:** for profile url
|
|
100
97
|
|
101
98
|
## Contributing
|
102
99
|
|
103
|
-
Bug reports and pull requests are welcome
|
100
|
+
Bug reports and pull requests are welcome.
|
104
101
|
|
105
102
|
## License
|
106
103
|
|
data/lib/nehm.rb
CHANGED
@@ -9,12 +9,12 @@ require 'nehm/client'
|
|
9
9
|
require 'nehm/get'
|
10
10
|
require 'nehm/help'
|
11
11
|
require 'nehm/os'
|
12
|
-
require 'nehm/
|
12
|
+
require 'nehm/path_manager'
|
13
13
|
require 'nehm/playlist'
|
14
|
-
require 'nehm/
|
14
|
+
require 'nehm/playlist_manager'
|
15
15
|
require 'nehm/track'
|
16
16
|
require 'nehm/user'
|
17
|
-
require 'nehm/
|
17
|
+
require 'nehm/user_manager'
|
18
18
|
|
19
19
|
module App
|
20
20
|
def self.do(args)
|
@@ -47,15 +47,15 @@ module App
|
|
47
47
|
puts 'Before using the nehm, you should set it up:'
|
48
48
|
Cfg.create unless Cfg.exist?
|
49
49
|
|
50
|
-
|
50
|
+
PathManager.set_dl_path
|
51
51
|
puts "\n"
|
52
52
|
|
53
53
|
unless OS.linux?
|
54
|
-
|
54
|
+
PlaylistManager.set_playlist
|
55
55
|
puts "\n"
|
56
56
|
end
|
57
57
|
|
58
|
-
|
58
|
+
UserManager.log_in
|
59
59
|
|
60
60
|
puts Paint['Now you can use nehm :)', :green]
|
61
61
|
end
|
data/lib/nehm/applescript.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
module AppleScript
|
2
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`
|
3
|
+
`osascript \"#{script_path(:add_track_to_playlist)}\" \"#{track_path}\" \"#{playlist_name}\" > /dev/null`
|
4
4
|
end
|
5
5
|
|
6
6
|
def self.list_of_playlists
|
7
|
-
output = `osascript #{script_path(:list_of_playlists)}`
|
7
|
+
output = `osascript \"#{script_path(:list_of_playlists)}\"`
|
8
8
|
output.chomp.split(', ')
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.music_master_library
|
12
|
-
`osascript #{script_path(:music_master_library)}`
|
12
|
+
`osascript \"#{script_path(:music_master_library)}\"`
|
13
13
|
end
|
14
14
|
|
15
15
|
module_function
|
data/lib/nehm/configure.rb
CHANGED
@@ -4,17 +4,18 @@ module Configure
|
|
4
4
|
loop do
|
5
5
|
puts 'Download path: ' + Paint[Cfg[:dl_path], :magenta]
|
6
6
|
puts 'Permalink: ' + Paint[Cfg[:permalink], :cyan]
|
7
|
-
puts 'iTunes playlist: ' + Paint[
|
7
|
+
puts 'iTunes playlist: ' + Paint[PlaylistManager.playlist, :cyan] unless OS.linux?
|
8
8
|
puts "\n"
|
9
9
|
|
10
10
|
HighLine.new.choose do |menu|
|
11
11
|
menu.prompt = Paint['Choose setting', :yellow]
|
12
12
|
|
13
|
-
menu.choice('Edit download path'.freeze) {
|
14
|
-
menu.choice('Edit permalink'.freeze) {
|
15
|
-
menu.choice('Edit iTunes playlist'.freeze) {
|
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
16
|
menu.choice('Exit'.freeze) { puts 'Goodbye!'; exit }
|
17
17
|
end
|
18
|
+
sleep(1)
|
18
19
|
puts "\n"
|
19
20
|
end
|
20
21
|
end
|
data/lib/nehm/get.rb
CHANGED
@@ -4,26 +4,22 @@ require 'taglib'
|
|
4
4
|
module Get
|
5
5
|
def self.[](get_or_dl, args)
|
6
6
|
# Processing arguments
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
['playlist', PlaylistControl, :temp_playlist=]]
|
7
|
+
options = [{ name: 'to', module: PathManager, setter: :temp_dl_path= },
|
8
|
+
{ name: 'from', module: UserManager, setter: :temp_user= },
|
9
|
+
{ name: 'playlist', module: PlaylistManager, setter: :temp_playlist= }]
|
11
10
|
|
12
11
|
options.each do |option|
|
13
|
-
|
14
|
-
|
15
|
-
# option[2] - setter method
|
16
|
-
if args.include? option[0]
|
17
|
-
index = args.index(option[0])
|
12
|
+
if args.include? option[:name]
|
13
|
+
index = args.index(option[:name])
|
18
14
|
value = args[index + 1]
|
19
15
|
args.delete_at(index + 1)
|
20
16
|
args.delete_at(index)
|
21
17
|
|
22
|
-
option[
|
18
|
+
option[:module].send(option[:setter], value)
|
23
19
|
end
|
24
20
|
end
|
25
21
|
|
26
|
-
user =
|
22
|
+
user = UserManager.user
|
27
23
|
tracks = []
|
28
24
|
tracks +=
|
29
25
|
case args.last
|
@@ -45,7 +41,7 @@ module Get
|
|
45
41
|
exit
|
46
42
|
end
|
47
43
|
|
48
|
-
playlist =
|
44
|
+
playlist = PlaylistManager.playlist
|
49
45
|
tracks.each do |track|
|
50
46
|
dl(track)
|
51
47
|
dl(track.artwork)
|
@@ -67,7 +63,7 @@ module Get
|
|
67
63
|
puts 'Downloading ' + arg.name
|
68
64
|
path = arg.file_path
|
69
65
|
url = arg.url
|
70
|
-
command = "curl -# -o
|
66
|
+
command = "curl -# -o \"" + path + "\" -L " + url
|
71
67
|
`#{command}`
|
72
68
|
end
|
73
69
|
|
@@ -1,6 +1,4 @@
|
|
1
|
-
module
|
2
|
-
attr_reader :temp_dl_path
|
3
|
-
|
1
|
+
module PathManager
|
4
2
|
def self.dl_path
|
5
3
|
@temp_dl_path || default_dl_path
|
6
4
|
end
|
@@ -22,7 +20,7 @@ module PathControl
|
|
22
20
|
path = default_path if path == '' && default_path
|
23
21
|
|
24
22
|
# If tilde at top of the line of path
|
25
|
-
path =
|
23
|
+
path = PathManager.tilde_to_home(path) if PathManager.tilde_at_top?(path)
|
26
24
|
|
27
25
|
if Dir.exist?(path)
|
28
26
|
Cfg[:dl_path] = path
|
@@ -36,7 +34,7 @@ module PathControl
|
|
36
34
|
|
37
35
|
def self.temp_dl_path=(path)
|
38
36
|
# If 'to ~/../..' entered
|
39
|
-
path =
|
37
|
+
path = tilde_to_home(path) if tilde_at_top?(path)
|
40
38
|
|
41
39
|
# If 'to current' entered
|
42
40
|
path = Dir.pwd if path == 'current'
|
@@ -49,14 +47,6 @@ module PathControl
|
|
49
47
|
end
|
50
48
|
end
|
51
49
|
|
52
|
-
def self.tilde_to_home(path)
|
53
|
-
File.join(ENV['HOME'], path[1..-1])
|
54
|
-
end
|
55
|
-
|
56
|
-
def self.tilde_at_top?(path)
|
57
|
-
path[0] == '~'
|
58
|
-
end
|
59
|
-
|
60
50
|
module_function
|
61
51
|
|
62
52
|
def default_dl_path
|
@@ -68,4 +58,12 @@ module PathControl
|
|
68
58
|
exit
|
69
59
|
end
|
70
60
|
end
|
61
|
+
|
62
|
+
def tilde_at_top?(path)
|
63
|
+
path[0] == '~'
|
64
|
+
end
|
65
|
+
|
66
|
+
def tilde_to_home(path)
|
67
|
+
File.join(ENV['HOME'], path[1..-1])
|
68
|
+
end
|
71
69
|
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
module
|
1
|
+
module PlaylistManager
|
2
2
|
def self.playlist
|
3
3
|
@temp_playlist || default_user_playlist || music_master_library
|
4
4
|
end
|
5
5
|
|
6
6
|
def self.set_playlist
|
7
7
|
loop do
|
8
|
-
playlist = HighLine.new.ask('Enter name of default iTunes playlist to which you want add tracks (press Enter to
|
8
|
+
playlist = HighLine.new.ask('Enter name of default iTunes playlist to which you want add tracks (press Enter to set it to default iTunes Music library)')
|
9
9
|
if playlist == ''
|
10
10
|
Cfg[:playlist] = nil
|
11
11
|
puts Paint['Default iTunes playlist unset', :green]
|
data/lib/nehm/track.rb
CHANGED
data/lib/nehm/user.rb
CHANGED
@@ -33,6 +33,7 @@ class User
|
|
33
33
|
|
34
34
|
# Official SC API wrapper doesn't support for posts
|
35
35
|
# So I should get posts by HTTP requests
|
36
|
+
#TODO: Get more than 300 posts (max limit = 300)
|
36
37
|
conn = Faraday.new(url: 'https://api-v2.soundcloud.com/')
|
37
38
|
response = conn.get("/profile/soundcloud:users:#{@id}?limit=#{count}&offset=0")
|
38
39
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module UserManager
|
2
2
|
def self.user
|
3
3
|
@temp_user || default_user
|
4
4
|
end
|
@@ -35,7 +35,7 @@ module UserControl
|
|
35
35
|
module_function
|
36
36
|
|
37
37
|
def default_user
|
38
|
-
if
|
38
|
+
if UserManager.logged_in?
|
39
39
|
User.new(Cfg[:default_id])
|
40
40
|
else
|
41
41
|
puts Paint["You didn't logged in", :red]
|
data/lib/nehm/version.rb
CHANGED
data/nehm.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.homepage = 'http://www.github.com/bogem/nehm'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
17
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(Screenshots)/}) }
|
18
18
|
spec.bindir = 'bin'
|
19
19
|
spec.executables = 'nehm'
|
20
20
|
spec.require_paths = ['lib']
|
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: 1.5.
|
4
|
+
version: 1.5.3
|
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-08-
|
11
|
+
date: 2015-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: soundcloud
|
@@ -137,12 +137,12 @@ files:
|
|
137
137
|
- lib/nehm/get.rb
|
138
138
|
- lib/nehm/help.rb
|
139
139
|
- lib/nehm/os.rb
|
140
|
-
- lib/nehm/
|
140
|
+
- lib/nehm/path_manager.rb
|
141
141
|
- lib/nehm/playlist.rb
|
142
|
-
- lib/nehm/
|
142
|
+
- lib/nehm/playlist_manager.rb
|
143
143
|
- lib/nehm/track.rb
|
144
144
|
- lib/nehm/user.rb
|
145
|
-
- lib/nehm/
|
145
|
+
- lib/nehm/user_manager.rb
|
146
146
|
- lib/nehm/version.rb
|
147
147
|
- nehm.gemspec
|
148
148
|
homepage: http://www.github.com/bogem/nehm
|