kagu 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/kagu/playlist.rb +3 -3
- data/lib/kagu/track.rb +1 -2
- data/lib/kagu.rb +9 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d63ebef06f4a301d40205bd5fb3968605c05a00d6c179839b87623eaea617c7
|
4
|
+
data.tar.gz: 00add6c458440f5e4b26a5141b22b602c9c5555cec62ceffb61b3c6e40977bef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e8a3186584bc2d4e29ce6fca5315c7a51bbdfe1af54207ff90544cca5eef14d14aeaa045690e41a14ffd597e4ea71fb3c0f0e1eddddbadc3613626e42d20d94
|
7
|
+
data.tar.gz: 70c013d695a15f25e853a6efe98d2f074c2de0001b9ab4e604e5baf9a1d51d6d813601517a0f9bc9ab3894a945261fd8f8bebcc033b5ec6801ae07e7f4c96487
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.3
|
data/lib/kagu/playlist.rb
CHANGED
@@ -31,7 +31,7 @@ module Kagu
|
|
31
31
|
Kagu.logger.info('Kagu') { "Adding #{tracks.size} track(s) to playlist #{name.inspect}" }
|
32
32
|
tracks.map(&:id).each_slice(500) do |ids|
|
33
33
|
AppleScript.execute(%Q{
|
34
|
-
tell application
|
34
|
+
tell application #{Kagu::OSX_APP_NAME.inspect}
|
35
35
|
set playlistToPush to user playlist #{name.inspect}
|
36
36
|
set idsToAdd to {#{ids.join(',')}}
|
37
37
|
repeat with idToAdd in idsToAdd
|
@@ -48,7 +48,7 @@ module Kagu
|
|
48
48
|
def clear
|
49
49
|
Kagu.logger.info('Kagu') { "Removing all tracks from playlist #{name.inspect}" }
|
50
50
|
AppleScript.execute(%Q{
|
51
|
-
tell application
|
51
|
+
tell application #{Kagu::OSX_APP_NAME.inspect}
|
52
52
|
delete tracks of playlist #{name.inspect}
|
53
53
|
end tell
|
54
54
|
})
|
@@ -60,7 +60,7 @@ module Kagu
|
|
60
60
|
def create
|
61
61
|
Kagu.logger.info('Kagu') { "Creating playlist #{name.inspect}" }
|
62
62
|
AppleScript.execute(%Q{
|
63
|
-
tell application
|
63
|
+
tell application #{Kagu::OSX_APP_NAME.inspect}
|
64
64
|
if not (exists user playlist #{name.inspect}) then
|
65
65
|
make new user playlist with properties { name: #{name.inspect} }
|
66
66
|
end if
|
data/lib/kagu/track.rb
CHANGED
@@ -6,7 +6,6 @@ module Kagu
|
|
6
6
|
include Comparable
|
7
7
|
|
8
8
|
MANDATORY_ATTRIBUTES = %w(added_at id length path)
|
9
|
-
IS_MAC_OS = RUBY_PLATFORM =~ /darwin/
|
10
9
|
|
11
10
|
attr_reader :added_at, :album, :artist, :bpm, :genre, :id, :length, :path, :title, :year
|
12
11
|
|
@@ -110,7 +109,7 @@ module Kagu
|
|
110
109
|
|
111
110
|
def xml_location=(value)
|
112
111
|
path = CGI.unescape(html_entities_decode(value).gsub('+', '%2B')).gsub(/\Afile:\/\/(localhost)?/, '')
|
113
|
-
path = path.encode('UTF-8', 'UTF-8-MAC') if IS_MAC_OS
|
112
|
+
path = path.encode('UTF-8', 'UTF-8-MAC') if Kagu::IS_MAC_OS
|
114
113
|
self.path = path
|
115
114
|
end
|
116
115
|
|
data/lib/kagu.rb
CHANGED
@@ -9,6 +9,15 @@ lib_path = "#{__dir__}/kagu"
|
|
9
9
|
|
10
10
|
module Kagu
|
11
11
|
|
12
|
+
IS_MAC_OS = RUBY_PLATFORM =~ /darwin/
|
13
|
+
OSX_APP_NAME = begin
|
14
|
+
if IS_MAC_OS
|
15
|
+
`sw_vers -productVersion`.chomp.to_f >= 10.15 ? 'Music' : 'iTunes'
|
16
|
+
else
|
17
|
+
nil
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
12
21
|
mattr_accessor :logger, instance_writer: false, instance_reader: false
|
13
22
|
self.logger = Logger.new(nil)
|
14
23
|
|