nehm 1.3.3 → 1.4.2

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: 9bf19dcd813d15eaaa99341e35776f10b4659c34
4
- data.tar.gz: a569b37fb0261e6b873b4080cc94934e4d95a4aa
3
+ metadata.gz: 720165cf1bb886b479357651ef70597a724ae003
4
+ data.tar.gz: 2189aad4a535796a4099e127c50bb3aef11410e6
5
5
  SHA512:
6
- metadata.gz: 4a10ba0e6aa0dfe912de49f81bbcb57d9844768946ad65edab9e50ac73c35c53f9c34517c5557ebdb7533e3a4d1fef348cf487e50695d86167c612e13e8d0925
7
- data.tar.gz: 6870f0928cea34964ae4cae6123e47cc410cc96e156869e531898edcfa62585884eb243ce79af9c8f5a7f8e65f628eed537df87bc74e5ff8d8d010ff47ab17b9
6
+ metadata.gz: 2b735c675fc41539522eab2707028d34d65f823a9c7cb6c634a61aff9c49237e0d706208595b355f5aa71b28543c587edd3492061e82aaa0b4f14d3f91ae5007
7
+ data.tar.gz: 3b329df0e0171250dfa45f5906f2f2a00ae31efea6063c3e43986e32d173d5e704e4c464f64623ba3323e9674fd840443477121b93b6f36d29879f6461d96228
data/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # nehm change log
2
2
 
3
+ ## 1.4.2
4
+
5
+ * Fix: app fails if you didn't set up playlist (again)
6
+
7
+ ## 1.4.1
8
+
9
+ * Fix: app fails if you didn't set up playlist
10
+
11
+ ## 1.4
12
+
13
+ * Now nehm can automatically add track to iTunes playlist. Enter `nehm configure` to set it up
14
+ * Also you can download tracks with custom iTunes playlist with `playlist PLAYLIST` feature. See the 'Usage' for instructions
15
+ * Handle more errors
16
+ * Update `nehm help` command:
17
+ * Add 'Summary' article
18
+ * Convenient read improvements
19
+ * Edit warning messages
20
+ * Minor improvements and fixes
21
+
3
22
  ## 1.3.3
4
23
 
5
24
  * Add `to current` feature
data/README.md CHANGED
@@ -66,11 +66,15 @@ Go to usage for further instructions
66
66
 
67
67
  `nehm get post from nasa` or `nehm dl like from bogem`
68
68
 
69
- * To get tracks to custom directory
69
+ * To get tracks to another directory
70
70
 
71
71
  `nehm get post from nasa to ~/Downloads` or `nehm dl like from bogem to current`
72
72
 
73
- (if you type *..to current*, nehm will get track to current working directory)
73
+ *(if you type `to current`, nehm will get track to current working directory)*
74
+
75
+ * To get tracks to another playlist
76
+
77
+ `nehm get post playlist MyPlaylist`
74
78
 
75
79
  * And of course you can get or download track from url
76
80
 
@@ -92,12 +96,16 @@ Go to usage for further instructions
92
96
 
93
97
  **Q: What is permalink?**
94
98
 
95
- A: Permalink is the last word in your profile url. Example: for profile url 'soundcloud.com/qwerty' permalink is 'qwerty'
99
+ A: Permalink is the last word in your profile url. **Example:** for profile url ***soundcloud.com/qwerty*** permalink is ***qwerty***
96
100
 
97
101
  ## Contributing
98
102
 
99
103
  Bug reports and pull requests are welcome on GitHub at https://github.com/bogem/nehm.
100
104
 
105
+ ## License
106
+
107
+ MIT License
108
+
101
109
  ## Links
102
110
 
103
111
  My SoundCloud profile: https://soundcloud.com/bogem
@@ -0,0 +1,17 @@
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
5
+
6
+ def self.list_of_playlists
7
+ output = `osascript #{script_path(:list_of_playlists)}`
8
+ output.chomp.split(', ')
9
+ end
10
+
11
+ module_function
12
+
13
+ def script_path(script_name)
14
+ applescripts_path = File.expand_path('applescripts', __dir__)
15
+ File.join(applescripts_path, "#{script_name.to_s}.applescript")
16
+ end
17
+ end
@@ -0,0 +1,10 @@
1
+ on run argv
2
+ set posixFile to first item of argv
3
+ set playlistName to second item of argv
4
+
5
+ tell application "iTunes"
6
+ set p to posixFile
7
+ set a to (p as POSIX file)
8
+ add a to playlist playlistName
9
+ end tell
10
+ end run
@@ -0,0 +1,3 @@
1
+ tell application "iTunes"
2
+ get name of playlists
3
+ end tell
data/lib/nehm/client.rb CHANGED
@@ -1,9 +1,10 @@
1
+ require 'certifi'
1
2
  require 'soundcloud'
2
3
 
3
4
  # Just a Soundcloud API client.
4
5
  module Client
5
6
  # Set a SSL certificate file path for SC API
6
- ENV['SSL_CERT_FILE'] = File.join(__dir__, 'cacert.pem')
7
+ ENV['SSL_CERT_FILE'] = Certifi.where
7
8
 
8
9
  # SoundCloud API client ID
9
10
  CLIENT_ID = '11a37feb6ccc034d5975f3f803928a32'
@@ -2,20 +2,38 @@
2
2
  module Configure
3
3
  def self.menu
4
4
  loop do
5
- puts 'Download path: ' + Paint[PathControl.dl_path, :magenta] if PathControl.dl_path
6
- puts 'iTunes path: ' + Paint[PathControl.itunes_path_name, :magenta] if PathControl.itunes_path
7
- puts 'Permalink: ' + Paint[Config[:permalink], :cyan] if Config[:permalink]
5
+ output = ''
6
+ options = [['Download path', Config[:dl_path], :magenta],
7
+ ['Permalink', Config[:permalink], :cyan],
8
+ ['iTunes path', PathControl.itunes_root_path, :magenta],
9
+ ['iTunes playlist', PlaylistControl.playlist, :cyan]]
10
+
11
+ options.each do |option|
12
+ # option[0] - name
13
+ # option[1] - value
14
+ # option[2] - color
15
+ output << option[0] + ': '
16
+ output <<
17
+ unless option[1].nil? && option[1].to_s.empty?
18
+ Paint[option[1], option[2]]
19
+ else
20
+ Paint["doesn't set up", 'gold']
21
+ end
22
+ output << "\n"
23
+ end
24
+
25
+ puts output
8
26
  puts "\n"
9
27
 
10
28
  HighLine.new.choose do |menu|
11
29
  menu.prompt = Paint['Choose setting', :yellow]
12
30
 
13
31
  menu.choice('Edit download path'.freeze) { PathControl.set_dl_path }
14
- menu.choice('Edit itunes path'.freeze) { PathControl.set_itunes_path } unless OS.linux?
15
32
  menu.choice('Edit permalink'.freeze) { UserControl.log_in }
16
- menu.choice('Exit'.freeze) { exit }
33
+ menu.choice('Edit iTunes path'.freeze) { PathControl.set_itunes_path } unless OS.linux?
34
+ menu.choice('Edit iTunes playlist'.freeze) { PlaylistControl.set_playlist } unless OS.linux?
35
+ menu.choice('Exit'.freeze) { puts 'Goodbye!'; exit }
17
36
  end
18
- sleep(1)
19
37
  puts "\n"
20
38
  end
21
39
  end
data/lib/nehm/get.rb CHANGED
@@ -4,35 +4,27 @@ require 'fileutils'
4
4
  # TrackUtils module responds to 'nehm get/dl ...' commands
5
5
  module Get
6
6
  def self.[](get_or_dl, args)
7
- user =
8
- # If option 'from ...' typed
9
- if args.include? 'from'
10
- index = args.index('from')
11
- permalink = args[index + 1]
7
+ # Processing arguments
8
+ # Using arrays instead of hashes to improve performance
9
+ options = [['to', PathControl, :temp_dl_path=],
10
+ ['from', UserControl, :temp_user=],
11
+ ['playlist', PlaylistControl, :temp_playlist=]]
12
+
13
+ options.each do |option|
14
+ # option[0] - option name
15
+ # option[1] - module
16
+ # option[2] - setter method
17
+ if args.include? option[0]
18
+ index = args.index(option[0])
19
+ value = args[index + 1]
12
20
  args.delete_at(index + 1)
13
21
  args.delete_at(index)
14
22
 
15
- UserControl.user(permalink)
16
- else
17
- UserControl.default_user
23
+ option[1].send(option[2], value)
18
24
  end
19
-
20
- # If option 'to ...' typed
21
- if args.include? 'to'
22
- index = args.index('to')
23
- path = args[index + 1]
24
- args.delete_at(index + 1)
25
- args.delete_at(index)
26
-
27
- # If 'to ~/../..' typed
28
- path = PathControl.tilde_to_home(path) if PathControl.tilde_at_top?(path)
29
-
30
- # If 'to current' typed
31
- path = Dir.pwd if path == 'current'
32
-
33
- PathControl.temp_dl_path = path
34
25
  end
35
26
 
27
+ user = UserControl.user
36
28
  tracks = []
37
29
  tracks +=
38
30
  case args.last
@@ -54,11 +46,31 @@ module Get
54
46
  exit
55
47
  end
56
48
 
49
+ # Check if iTunes path set up
50
+ if !PathControl.itunes_path && get_or_dl == :get && !OS.linux?
51
+ puts Paint["You don't set up iTunes path!", :yellow]
52
+ puts "Your track won't add to iTunes library"
53
+ itunes_set_up = false
54
+ else
55
+ itunes_set_up = true
56
+ end
57
+
58
+ # Check if iTunes playlist set up
59
+ playlist = PlaylistControl.playlist
60
+ if !playlist && !playlist.to_s.empty? && get_or_dl == :get && !OS.linux?
61
+ puts Paint["You don't set up iTunes playlist!", :yellow]
62
+ puts "Your track won't add to iTunes playlist"
63
+ end
64
+
57
65
  tracks.each do |track|
58
66
  dl(track)
59
67
  dl(track.artwork)
60
68
  tag(track)
61
- cp(track) unless (get_or_dl == :dl) || (OS.linux?)
69
+ if itunes_set_up && !OS.linux? && get_or_dl == :get
70
+ cp(track)
71
+ wait_while_itunes_add_track_to_lib(track) unless playlist.to_s.empty?
72
+ playlist.add_track(track.file_path) unless playlist.to_s.empty?
73
+ end
62
74
  track.artwork.suicide
63
75
  end
64
76
  puts Paint['Done!', :green]
@@ -76,7 +88,7 @@ module Get
76
88
  path = arg.file_path
77
89
  url = arg.url
78
90
  command = "curl -# -o '" + path + "' -L " + url
79
- system(command)
91
+ `#{command}`
80
92
  end
81
93
 
82
94
  def tag(track)
@@ -104,4 +116,11 @@ module Get
104
116
  puts 'Adding to iTunes library'
105
117
  FileUtils.cp(track.file_path, PathControl.itunes_path)
106
118
  end
119
+
120
+ # Check when iTunes will add track to its library from 'Auto' directory
121
+ def wait_while_itunes_add_track_to_lib(track)
122
+ loop do
123
+ break unless File.exist?(File.join(PathControl.itunes_path, track.file_name))
124
+ end
125
+ end
107
126
  end
data/lib/nehm/help.rb CHANGED
@@ -26,38 +26,46 @@ module Help
26
26
  def configure
27
27
  puts Paint['Input: ', :yellow] + 'nehm configure'
28
28
  puts "\n"
29
- puts Paint['Available options:', :yellow]
30
- puts ' No options'
29
+ puts Paint['Summary:', :yellow]
30
+ puts ' Configuring nehm app'
31
31
  end
32
32
 
33
33
  def dl
34
- puts Paint['Input: ', :yellow] + 'nehm dl OPTIONS [from PERMALINK] [to PATHTODIRECTORY]'
34
+ puts Paint['Input: ', :yellow] + 'nehm dl OPTIONS [from PERMALINK] [to PATH_TO_DIRECTORY] [playlist ITUNES_PLAYLIST]'
35
+ puts "\n"
36
+ puts Paint['Summary:', :yellow]
37
+ puts ' Downloading tracks from SoundCloud and setting tags'
35
38
  puts "\n"
36
39
  puts Paint['OPTIONS:', :yellow]
37
- puts ' ' + Paint['post', :green] + ' - Downloading and setting tags last post(track or repost) from your profile'
38
- puts ' ' + Paint['<number> posts', :green] + ' - Downloading and setting tags last <number> posts from your profile'
39
- puts ' ' + Paint['like', :green] + ' - Downloading and setting tags your last like'
40
- puts ' ' + Paint['<number> likes', :green] + ' - Downloading and setting tags your last <number> likes'
40
+ puts ' ' + Paint['post', :green] + ' Do same with last post (track or repost) from your profile'
41
+ puts ' ' + Paint['<number> posts', :green] + ' Do same with last <number> posts from your profile'
42
+ puts ' ' + Paint['like', :green] + ' Do same with tags your last like'
43
+ puts ' ' + Paint['<number> likes', :green] + ' Do same with tags your last <number> likes'
41
44
  puts "\n"
42
45
  puts Paint['Extra options:', :yellow]
43
- puts ' ' + Paint['from PERMALINK', :green] + ' - Do the aforecited operations from custom user profile'
44
- puts ' ' + Paint['to PATHTODIRECTORY', :green] + ' - Do the aforecited operations to custom directory'
45
- puts ' ' + Paint['to current', :green] + ' - Do the aforecited operations to current working directory'
46
+ puts ' ' + Paint['from PERMALINK', :green] + ' Do aforecited operations from custom user profile'
47
+ puts ' ' + Paint['to PATH_TO_DIRECTORY', :green] + ' Do aforecited operations to custom directory'
48
+ puts ' ' + Paint['to current', :green] + ' Do aforecited operations to current working directory'
49
+ puts ' ' + Paint['playlist ITUNES_PLAYLIST', :green] + ' Do aforecited operations to custom iTunes playlist'
46
50
  end
47
51
 
48
52
  def get
49
- puts Paint['Input: ', :yellow] + 'nehm get OPTIONS [from PERMALINK] [to PATHTODIRECTORY]'
53
+ puts Paint['Input: ', :yellow] + 'nehm get OPTIONS [from PERMALINK] [to PATH_TO_DIRECTORY] [playlist ITUNES_PLAYLIST]'
54
+ puts "\n"
55
+ puts Paint['Summary:', :yellow]
56
+ puts ' Downloading tracks, setting tags and adding to your iTunes library tracks from Soundcloud'
50
57
  puts "\n"
51
58
  puts Paint['OPTIONS:', :yellow]
52
- puts ' ' + Paint['post', :green] + ' - Downloading, setting tags and adding to your iTunes library last post(track or repost) from your profile'
53
- puts ' ' + Paint['<number> posts', :green] + ' - Downloading, setting tags and adding to your iTunes library last <number> posts from your profile'
54
- puts ' ' + Paint['like', :green] + ' - Downloading, setting tags and adding to your iTunes library your last like'
55
- puts ' ' + Paint['<number> likes', :green] + ' - Downloading, setting tags and adding to your iTunes library your last <number> likes'
59
+ puts ' ' + Paint['post', :green] + ' Do same with last post (track or repost) from your profile'
60
+ puts ' ' + Paint['<number> posts', :green] + ' Do same with last <number> posts from your profile'
61
+ puts ' ' + Paint['like', :green] + ' Do same with your last like'
62
+ puts ' ' + Paint['<number> likes', :green] + ' Do same with your last <number> likes'
56
63
  puts "\n"
57
64
  puts Paint['Extra options:', :yellow]
58
- puts ' ' + Paint['from PERMALINK', :green] + ' - Do the aforecited operations from profile with PERMALINK'
59
- puts ' ' + Paint['to PATHTODIRECTORY', :green] + ' - Do the aforecited operations to custom directory'
60
- puts ' ' + Paint['to current', :green] + ' - Do the aforecited operations to current working directory'
65
+ puts ' ' + Paint['from PERMALINK', :green] + ' Do aforecited operations from profile with PERMALINK'
66
+ puts ' ' + Paint['to PATH_TO_DIRECTORY', :green] + ' Do aforecited operations to custom directory'
67
+ puts ' ' + Paint['to current', :green] + ' Do aforecited operations to current working directory'
68
+ puts ' ' + Paint['playlist ITUNES_PLAYLIST', :green] + ' Do aforecited operations to custom iTunes playlist'
61
69
  end
62
70
 
63
71
  def permalink
@@ -1,6 +1,8 @@
1
- class PathControl
1
+ module PathControl
2
+ attr_reader :temp_dl_path
3
+
2
4
  def self.dl_path
3
- @temp_dl_path || Config[:dl_path]
5
+ @temp_dl_path || default_dl_path
4
6
  end
5
7
 
6
8
  def self.set_dl_path
@@ -24,16 +26,22 @@ class PathControl
24
26
  puts Paint["Download directory set up to #{Paint[path, :magenta]}", :green]
25
27
  break
26
28
  else
27
- puts Paint["This directory doesn't exist. Please enter path again", :red]
29
+ puts Paint["This directory doesn't exist. Please enter correct path", :red]
28
30
  end
29
31
  end
30
32
  end
31
33
 
32
34
  def self.temp_dl_path=(path)
35
+ # If 'to ~/../..' entered
36
+ path = PathControl.tilde_to_home(path) if PathControl.tilde_at_top?(path)
37
+
38
+ # If 'to current' entered
39
+ path = Dir.pwd if path == 'current'
40
+
33
41
  if Dir.exist?(path)
34
42
  @temp_dl_path = path
35
43
  else
36
- puts Paint['Invalid path!', :red]
44
+ puts Paint['Invalid download path! Please enter correct path', :red]
37
45
  exit
38
46
  end
39
47
  end
@@ -43,7 +51,7 @@ class PathControl
43
51
  end
44
52
 
45
53
  # Use in Configure.menu
46
- def self.itunes_path_name
54
+ def self.itunes_root_path
47
55
  PathControl.itunes_path.sub("/iTunes\ Media/Automatically\ Add\ to\ iTunes.localized", '')
48
56
  end
49
57
 
@@ -67,16 +75,21 @@ class PathControl
67
75
 
68
76
  if Dir.exist?(path)
69
77
  Config[:itunes_path] = path
70
- puts Paint["iTunes directory set up to #{Paint[path, :magenta]}", :green]
78
+ puts Paint["iTunes directory set up to #{Paint[PathControl.itunes_root_path, :magenta]}", :green]
71
79
  break
72
80
  else
73
- puts Paint["This directory doesn't exist. Please enter path again", :red]
81
+ puts Paint["This directory doesn't exist. Please enter correct path", :red]
74
82
  end
75
83
  end
76
84
  end
77
85
 
78
86
  def self.set_itunes_path_to_default
79
- Config[:itunes_path] = File.join(ENV['HOME'], "/Music/iTunes/iTunes\ Media/Automatically\ Add\ to\ iTunes.localized")
87
+ itunes_path = File.join(ENV['HOME'], "/Music/iTunes/iTunes\ Media/Automatically\ Add\ to\ iTunes.localized")
88
+ if Dir.exist?(itunes_path)
89
+ Config[:itunes_path] = itunes_path
90
+ else
91
+ puts Paint["Don't know where your iTunes path. Set it up manually from ", 'gold'] + Paint['nehm configure', :yellow]
92
+ end
80
93
  end
81
94
 
82
95
  def self.tilde_to_home(path)
@@ -84,6 +97,18 @@ class PathControl
84
97
  end
85
98
 
86
99
  def self.tilde_at_top?(path)
87
- path[0] == '~' ? true : false
100
+ path[0] == '~'
101
+ end
102
+
103
+ module_function
104
+
105
+ def default_dl_path
106
+ if Config[:dl_path]
107
+ Config[:dl_path]
108
+ else
109
+ puts Paint["You don't set up download path!", :red]
110
+ puts "Set it up from #{Paint['nehm configure', :yellow]} or use #{Paint['[to PATH_TO_DIRECTORY]', :yellow]} option"
111
+ exit
112
+ end
88
113
  end
89
114
  end
@@ -0,0 +1,16 @@
1
+ class Playlist
2
+ attr_reader :name
3
+
4
+ def initialize(name)
5
+ @name = name
6
+ end
7
+
8
+ def add_track(track_path)
9
+ puts 'Adding to playlist'
10
+ AppleScript.add_track_to_playlist(track_path, @name)
11
+ end
12
+
13
+ def to_s
14
+ @name
15
+ end
16
+ end
@@ -0,0 +1,37 @@
1
+ module PlaylistControl
2
+ def self.playlist
3
+ if @temp_playlist
4
+ @temp_playlist
5
+ elsif !Config[:playlist].nil?
6
+ Playlist.new(Config[:playlist])
7
+ end
8
+ end
9
+
10
+ def self.set_playlist
11
+ loop do
12
+ playlist = HighLine.new.ask('Enter name of default iTunes playlist to which you want add tracks (press Enter to unset default playlist)')
13
+ if playlist == ''
14
+ Config[:playlist] = ''
15
+ puts Paint['Default iTunes playlist unset', :green]
16
+ break
17
+ end
18
+
19
+ if AppleScript.list_of_playlists.include? playlist
20
+ Config[:playlist] = playlist
21
+ puts Paint["Default iTunes playlist set up to #{playlist}", :green]
22
+ break
23
+ else
24
+ puts Paint['Invalid playlist name. Please enter correct name', :red]
25
+ end
26
+ end
27
+ end
28
+
29
+ def self.temp_playlist=(playlist)
30
+ if AppleScript.list_of_playlists.include? playlist
31
+ @temp_playlist = Playlist.new(playlist)
32
+ else
33
+ puts Paint['Invalid playlist name. Please enter correct name', :red]
34
+ exit
35
+ end
36
+ end
37
+ end
data/lib/nehm/track.rb CHANGED
@@ -19,7 +19,7 @@ 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
@@ -1,13 +1,4 @@
1
1
  module UserControl
2
- def self.default_user
3
- if UserControl.logged_in?
4
- User.new(Config[:default_id])
5
- else
6
- puts Paint["You didn't logged in", :red]
7
- puts "Input #{Paint['nehm configure', :yellow]} to login"
8
- exit
9
- end
10
- end
11
2
 
12
3
  def self.logged_in?
13
4
  Config.key?(:default_id)
@@ -29,18 +20,32 @@ module UserControl
29
20
  end
30
21
  end
31
22
 
32
- def self.user(permalink)
23
+ def self.temp_user=(permalink)
33
24
  if user_exist?(permalink)
34
25
  user = Client.get('/resolve', url: "https://soundcloud.com/#{permalink}")
35
- User.new(user.id)
26
+ @temp_user = User.new(user.id)
36
27
  else
37
28
  puts Paint['Invalid permalink. Please enter correct permalink', :red]
38
29
  exit
39
30
  end
40
31
  end
41
32
 
33
+ def self.user
34
+ @temp_user || default_user
35
+ end
36
+
42
37
  module_function
43
38
 
39
+ def default_user
40
+ if UserControl.logged_in?
41
+ User.new(Config[:default_id])
42
+ else
43
+ puts Paint["You didn't logged in", :red]
44
+ puts "Login from #{Paint['nehm configure', :yellow]} or use #{Paint['[from PERMALINK]', :yellow]} option"
45
+ exit
46
+ end
47
+ end
48
+
44
49
  def user_exist?(permalink)
45
50
  Client.get('/resolve', url: "https://soundcloud.com/#{permalink}")
46
51
 
data/lib/nehm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Nehm
2
- VERSION = '1.3.3'.freeze
2
+ VERSION = '1.4.2'.freeze
3
3
  end
data/lib/nehm.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'highline'
2
2
  require 'paint'
3
3
 
4
+ require 'nehm/applescript'
4
5
  require 'nehm/artwork'
5
6
  require 'nehm/config'
6
7
  require 'nehm/configure'
@@ -9,6 +10,8 @@ require 'nehm/get'
9
10
  require 'nehm/help'
10
11
  require 'nehm/os'
11
12
  require 'nehm/path_control'
13
+ require 'nehm/playlist'
14
+ require 'nehm/playlist_control'
12
15
  require 'nehm/track'
13
16
  require 'nehm/user'
14
17
  require 'nehm/user_control'
@@ -31,6 +34,10 @@ module App
31
34
  puts Paint['Invalid command', :red]
32
35
  puts "Input #{Paint['nehm help', :yellow]} for all avalaible commands"
33
36
  end
37
+
38
+ # SIGINT
39
+ rescue Interrupt
40
+ puts "\nGoodbye!"
34
41
  end
35
42
 
36
43
  module_function
@@ -43,7 +50,13 @@ module App
43
50
  PathControl.set_dl_path
44
51
  puts "\n"
45
52
 
46
- PathControl.set_itunes_path_to_default
53
+ unless OS.linux?
54
+ PathControl.set_itunes_path_to_default
55
+ puts "\n"
56
+
57
+ PlaylistControl.set_playlist
58
+ puts "\n"
59
+ end
47
60
 
48
61
  UserControl.log_in
49
62
 
data/nehm.gemspec CHANGED
@@ -18,12 +18,12 @@ Gem::Specification.new do |spec|
18
18
  spec.bindir = 'bin'
19
19
  spec.executables = 'nehm'
20
20
  spec.require_paths = ['lib']
21
- spec.required_ruby_version = '>= 1.9'
21
+ spec.required_ruby_version = '>= 2.0'
22
22
 
23
- spec.add_development_dependency 'bundler', '>= 1.10.5'
24
- spec.add_dependency 'soundcloud', '>= 0.3.2'
25
- spec.add_dependency 'taglib-ruby', '>= 0.7.0'
26
- spec.add_dependency 'faraday', '>= 0.9.1'
27
- spec.add_dependency 'highline', '>= 1.7.2'
28
- spec.add_dependency 'paint'
23
+ spec.add_dependency 'soundcloud', '>= 0.3.2'
24
+ spec.add_dependency 'taglib-ruby', '>= 0.7.0'
25
+ spec.add_dependency 'faraday', '>= 0.9.1'
26
+ spec.add_dependency 'highline', '>= 1.7.2'
27
+ spec.add_dependency 'certifi'
28
+ spec.add_dependency 'paint'
29
29
  end