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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0334dfd2cbbf21419dd63838d1f1c2ddf33799086aeb6c4f424f641fb848366
4
- data.tar.gz: 9a20fd6dcb1014b70c1e5819ecda2d1134e69e69749269437a59685b67c2e451
3
+ metadata.gz: 7d63ebef06f4a301d40205bd5fb3968605c05a00d6c179839b87623eaea617c7
4
+ data.tar.gz: 00add6c458440f5e4b26a5141b22b602c9c5555cec62ceffb61b3c6e40977bef
5
5
  SHA512:
6
- metadata.gz: f72d388cb967ea25ef360c378036956f3b7566c393614688733a1fd4316ed6b9f68928df97539df74f494e5ae2fcb5160e2a9bff60a6af0b9a0d8532cdb9d85d
7
- data.tar.gz: 9f405adb7ed3da432c01d5466666326ac34de34bb796d3525699bf8cc93806c8fe60ad530ec849c85136bb67a6eca815ad089be09b0f2c8d486cc80e12aa7b2c
6
+ metadata.gz: 5e8a3186584bc2d4e29ce6fca5315c7a51bbdfe1af54207ff90544cca5eef14d14aeaa045690e41a14ffd597e4ea71fb3c0f0e1eddddbadc3613626e42d20d94
7
+ data.tar.gz: 70c013d695a15f25e853a6efe98d2f074c2de0001b9ab4e604e5baf9a1d51d6d813601517a0f9bc9ab3894a945261fd8f8bebcc033b5ec6801ae07e7f4c96487
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.2
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 "Music"
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 "Music"
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 "Music"
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kagu
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexis Toulotte