shellify 1.1.0 → 1.1.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 +4 -4
- data/lib/shellify/cli.rb +23 -6
- data/lib/shellify/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c748de7e87dfdb2e9567cac439dc39d3f5db091658150abebfe0e1ac3ce23ab7
|
4
|
+
data.tar.gz: 568c613808ae76d1ef896cf6b5c66bb6e46d87e9a1df0a44ff0dc4e569f4fc4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e271d469bb73af4ab35d10e405ea03f68d62014e4ed5bcc4fc715dee83683013ecc9e9187233d5876b73c23f672a8992625ee22f919c026fc7e48cda1a4936e5
|
7
|
+
data.tar.gz: a80d854ea294d1646136bbd92dbcd2b34bafb4fbd78d11a1e97d415d6fab0d7fb97a6388a375d0a2fca250d41f00bc64d6b84ee2d99a7bdae0f29b2a87b7108a
|
data/lib/shellify/cli.rb
CHANGED
@@ -74,14 +74,16 @@ module Shellify
|
|
74
74
|
command :like do |c|
|
75
75
|
c.description = 'Save the current song to your library'
|
76
76
|
c.action do
|
77
|
-
|
77
|
+
exit_with_message(local_track_message, 0) if track_is_local?(playing)
|
78
|
+
@user.save_tracks!([playing])
|
78
79
|
end
|
79
80
|
end
|
80
81
|
|
81
82
|
command :unlike do |c|
|
82
83
|
c.description = 'Remove the current song from your library'
|
83
84
|
c.action do
|
84
|
-
|
85
|
+
exit_with_message(local_track_message, 0) if track_is_local?(playing)
|
86
|
+
@user.remove_tracks!([playing])
|
85
87
|
end
|
86
88
|
end
|
87
89
|
|
@@ -99,10 +101,11 @@ module Shellify
|
|
99
101
|
c.action do |args, options|
|
100
102
|
return puts " Nothing playing" unless @user.player.playing?
|
101
103
|
|
104
|
+
exit_with_message(local_track_message, 0) if track_is_local?(playing)
|
102
105
|
playlist = @user.playlists.find { |p| p.name == args[0] }
|
103
106
|
return puts " Playlist not found" unless playlist
|
104
107
|
|
105
|
-
playlist.add_tracks!([
|
108
|
+
playlist.add_tracks!([playing])
|
106
109
|
end
|
107
110
|
end
|
108
111
|
|
@@ -111,10 +114,11 @@ module Shellify
|
|
111
114
|
c.action do |args, options|
|
112
115
|
return puts " Nothing playing" unless @user.player.playing?
|
113
116
|
|
117
|
+
exit_with_message(local_track_message, 0) if track_is_local?(playing)
|
114
118
|
playlist = @user.playlists.find { |p| p.name == args[0] }
|
115
119
|
return puts " Playlist not found" unless playlist
|
116
120
|
|
117
|
-
playlist.remove_tracks!([
|
121
|
+
playlist.remove_tracks!([playing])
|
118
122
|
end
|
119
123
|
end
|
120
124
|
|
@@ -176,12 +180,25 @@ module Shellify
|
|
176
180
|
|
177
181
|
private
|
178
182
|
|
183
|
+
def playing
|
184
|
+
@user.player.currently_playing
|
185
|
+
end
|
186
|
+
|
187
|
+
def local_track_message
|
188
|
+
" Shellify can't perform this action for local tracks"
|
189
|
+
end
|
190
|
+
|
191
|
+
def track_is_local?(track)
|
192
|
+
track.uri.split(':')[1] == 'local'
|
193
|
+
end
|
194
|
+
|
179
195
|
def print_current_song
|
180
|
-
playing = @user.player.currently_playing
|
181
196
|
puts ' Now Playing:'
|
182
197
|
puts " #{playing.name} - #{playing.artists.first.name} - "\
|
183
198
|
"#{duration_to_s(@user.player.progress)}/#{duration_to_s(playing.duration_ms)}"\
|
184
|
-
"#{" - ♥" if @user.saved_tracks?([playing]).first}"
|
199
|
+
"#{" - ♥" if !track_is_local?(playing) && @user.saved_tracks?([playing]).first}"\
|
200
|
+
"#{" - local" if track_is_local?(playing)}"
|
201
|
+
|
185
202
|
end
|
186
203
|
|
187
204
|
def exit_with_message(message, code = 1)
|
data/lib/shellify/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shellify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Derek Povah
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01
|
11
|
+
date: 2022-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|