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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b08eefd3115d43cbe5cd3668fc4dcab6b2393b52
4
- data.tar.gz: c1f896f13a89eeac413c7f3dc7f4be5341bc8dcd
3
+ metadata.gz: 5bd2f9e928ec72d11c65ff7e1a8d4ab251e401c8
4
+ data.tar.gz: 0422b2fceff29c45f852fe547670e6cd17753505
5
5
  SHA512:
6
- metadata.gz: bb02cb4c2974269b3de4c6d2e661f1e9b4e00b5e25fd4c3936bc4ccd806bfed6aad887681542bae3602010738e426e4c894a8861e2da738bd3689a0bb1d96445
7
- data.tar.gz: f88c3e0575446c42bee43d55b2394275c5f83525994eae2732f3b09d749fa63b4291efde25d073d04cac340a66d24581a175b0291baf784c107c353dca85f2b3
6
+ metadata.gz: fa9bfb36d31c334f211885c42e0c85bc2eae664b4fc7e7ef8000a38f6933124de3bf5be6b0e56762aa83a6974e2770764780483944301c332575833319e7bd50
7
+ data.tar.gz: 36b2cfedab998142757a7a871868fa1d885b718a25560c468d80a09f4975a79714936405ebe296b92384d42684dd081f5f406c6e435457663f7255940a40c444
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # nehm change log
2
2
 
3
+ ## 1.5.3
4
+ * Fix bugs, associated with special characters in track's name
5
+ * Minor improvements
6
+
3
7
  ## 1.5.2
4
8
  * Binary now works if you use nehm from source
5
9
  * Minor improvements
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. First, you should install `taglib` library**
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. Then you can install `nehm` gem:**
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
- * To get (download to download directory, set tags and add to iTunes library) your last like
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
- * To get your last post (last track or repost from your profile)
50
+ * Get your last post (last track or repost from your profile)
54
51
 
55
52
  `nehm get post`
56
53
 
57
- * To get multiple last posts or likes
54
+ * Get multiple last posts or likes
58
55
 
59
56
  `nehm get 3 posts` or `nehm get 3 likes`
60
57
 
61
- * To just download and set tags any track, you can input
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
- * To get tracks from another user
62
+ * Get tracks from another user
66
63
 
67
64
  `nehm get post from nasa` or `nehm dl like from bogem`
68
65
 
69
- * To get tracks to another directory
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
- * To get tracks to another iTunes playlist
72
+ * Get tracks to another iTunes playlist
76
73
 
77
74
  `nehm get post playlist MyPlaylist`
78
75
 
79
- * And of course you can get or download track from url
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
- * Also, you can configure nehm (change download directory, permalink)
84
+ * Configure (change download directory, permalink, playlist)
88
85
 
89
86
  `nehm configure`
90
87
 
91
- * For help, just input
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 on GitHub at https://github.com/bogem/nehm.
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/path_control'
12
+ require 'nehm/path_manager'
13
13
  require 'nehm/playlist'
14
- require 'nehm/playlist_control'
14
+ require 'nehm/playlist_manager'
15
15
  require 'nehm/track'
16
16
  require 'nehm/user'
17
- require 'nehm/user_control'
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
- PathControl.set_dl_path
50
+ PathManager.set_dl_path
51
51
  puts "\n"
52
52
 
53
53
  unless OS.linux?
54
- PlaylistControl.set_playlist
54
+ PlaylistManager.set_playlist
55
55
  puts "\n"
56
56
  end
57
57
 
58
- UserControl.log_in
58
+ UserManager.log_in
59
59
 
60
60
  puts Paint['Now you can use nehm :)', :green]
61
61
  end
@@ -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
@@ -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[PlaylistControl.playlist, :cyan] unless OS.linux?
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) { PathControl.set_dl_path }
14
- menu.choice('Edit permalink'.freeze) { UserControl.log_in }
15
- menu.choice('Edit iTunes playlist'.freeze) { PlaylistControl.set_playlist } unless OS.linux?
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
- # Using arrays instead of hashes to improve performance
8
- options = [['to', PathControl, :temp_dl_path=],
9
- ['from', UserControl, :temp_user=],
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
- # option[0] - option name
14
- # option[1] - module
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[1].send(option[2], value)
18
+ option[:module].send(option[:setter], value)
23
19
  end
24
20
  end
25
21
 
26
- user = UserControl.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 = PlaylistControl.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 '" + path + "' -L " + url
66
+ command = "curl -# -o \"" + path + "\" -L " + url
71
67
  `#{command}`
72
68
  end
73
69
 
@@ -1,6 +1,4 @@
1
- module PathControl
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 = PathControl.tilde_to_home(path) if PathControl.tilde_at_top?(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 = PathControl.tilde_to_home(path) if PathControl.tilde_at_top?(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 PlaylistControl
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 unset default playlist)')
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
@@ -19,11 +19,11 @@ class Track
19
19
  end
20
20
 
21
21
  def file_name
22
- "#{name}.mp3".tr('/ ', '')
22
+ "#{name}.mp3".tr('/', '')
23
23
  end
24
24
 
25
25
  def file_path
26
- File.join(PathControl.dl_path, file_name)
26
+ File.join(PathManager.dl_path, file_name)
27
27
  end
28
28
 
29
29
  def id
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 UserControl
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 UserControl.logged_in?
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
@@ -1,3 +1,3 @@
1
1
  module Nehm
2
- VERSION = '1.5.2'.freeze
2
+ VERSION = '1.5.3'.freeze
3
3
  end
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{^(test|spec|features)/}) }
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.2
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-23 00:00:00.000000000 Z
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/path_control.rb
140
+ - lib/nehm/path_manager.rb
141
141
  - lib/nehm/playlist.rb
142
- - lib/nehm/playlist_control.rb
142
+ - lib/nehm/playlist_manager.rb
143
143
  - lib/nehm/track.rb
144
144
  - lib/nehm/user.rb
145
- - lib/nehm/user_control.rb
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