kagu 3.0.4 → 3.0.9
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/attributes_initializer.rb +1 -1
- data/lib/kagu/playlist.rb +5 -3
- data/lib/kagu/playlists.rb +1 -1
- data/lib/kagu/track.rb +11 -6
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2b1c6ebb0b79f29eba4fe24a7dd3d79296ae91f0bbea0fb0fc7983bf835e281
|
4
|
+
data.tar.gz: ca3eccc89f387079b124934601b42d55189caeb21655dcc2ba10b4925229cf44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9342fa71cbb60dc112d72a1578b1f0e08efe82bf2fcbafe90a3bf5bf1fb481bb5cc46df116227a5fea2076f68697dcc6bcc4eb695011acdab9b17a52ff0b7e58
|
7
|
+
data.tar.gz: bf93af997250a6721bce474f3004a15721245d21ca0d8efd8d47144fc3a374b3eb46695a7b249c4c0546daad8f95be8163db80db19a9e770726d470518ed2264
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.0.
|
1
|
+
3.0.9
|
@@ -7,7 +7,7 @@ module Kagu
|
|
7
7
|
send("#{name}=", value) if respond_to?("#{name}=", true)
|
8
8
|
end
|
9
9
|
self.class.const_get(:MANDATORY_ATTRIBUTES).each do |attribute|
|
10
|
-
raise Error.new("#{self.class}##{attribute} is mandatory") if send(attribute).nil?
|
10
|
+
raise Error.new("#{self.class}##{attribute} is mandatory for #{inspect}") if send(attribute).nil?
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
data/lib/kagu/playlist.rb
CHANGED
@@ -30,12 +30,14 @@ module Kagu
|
|
30
30
|
def add_tracks
|
31
31
|
return if tracks.empty?
|
32
32
|
Kagu.logger.info('Kagu') { "Adding #{tracks.size} track(s) to playlist #{name.inspect}" }
|
33
|
-
tracks.map(&:id).each_slice(
|
34
|
-
conditions = ids.map { |id| "persistent ID is #{id.inspect}" }
|
33
|
+
tracks.map(&:id).each_slice(500) do |ids|
|
35
34
|
AppleScript.execute(%Q{
|
36
35
|
tell application #{Kagu::OSX_APP_NAME.inspect}
|
37
36
|
set playlistToPush to user playlist #{name.inspect}
|
38
|
-
|
37
|
+
set idsToAdd to {#{ids.map(&:inspect).join(',')}}
|
38
|
+
repeat with idToAdd in idsToAdd
|
39
|
+
duplicate (tracks of library playlist 1 whose persistent ID is idToAdd) to playlistToPush
|
40
|
+
end repeat
|
39
41
|
end tell
|
40
42
|
})
|
41
43
|
end
|
data/lib/kagu/playlists.rb
CHANGED
@@ -28,7 +28,7 @@ module Kagu
|
|
28
28
|
print("BEGIN_PLAYLIST")
|
29
29
|
print(playlist.name)
|
30
30
|
for track in playlist.items.filter({ $0.mediaKind == ITLibMediaItemMediaKind.kindSong }) {
|
31
|
-
print(String(
|
31
|
+
print(String(track.persistentID.uint64Value, radix: 16).uppercased())
|
32
32
|
}
|
33
33
|
print("END_PLAYLIST")
|
34
34
|
}
|
data/lib/kagu/track.rb
CHANGED
@@ -59,7 +59,8 @@ module Kagu
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def bpm=(value)
|
62
|
-
|
62
|
+
value = value.to_s =~ /\A[0-9]+\z/ ? value.to_i : nil
|
63
|
+
@bpm = (value && value > 0) ? value : nil
|
63
64
|
end
|
64
65
|
|
65
66
|
def genre=(value)
|
@@ -76,11 +77,15 @@ module Kagu
|
|
76
77
|
|
77
78
|
def path=(value)
|
78
79
|
value = value.to_s.presence
|
79
|
-
value = URI.unescape(URI.parse(value).path) if value.is_a?(String) && value.starts_with?('file://')
|
80
|
-
value = value.encode('UTF-8', 'UTF-8-MAC') if Kagu::IS_MAC_OS
|
81
|
-
|
82
|
-
|
83
|
-
|
80
|
+
value = URI.unescape(URI.parse(value).path).presence if value.is_a?(String) && value.starts_with?('file://')
|
81
|
+
value = value.encode('UTF-8', 'UTF-8-MAC') if value.present? && Kagu::IS_MAC_OS
|
82
|
+
if value.present?
|
83
|
+
@path = Pathname.new(value)
|
84
|
+
raise Error.new("No such file: #{path.to_s.inspect}") if path.exist? && !exists?
|
85
|
+
Kagu.logger.error('Kagu') { "No such track: #{path.inspect}" } unless exists?
|
86
|
+
else
|
87
|
+
@path = nil
|
88
|
+
end
|
84
89
|
end
|
85
90
|
|
86
91
|
def title=(value)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kagu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexis Toulotte
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -134,7 +134,7 @@ homepage: https://github.com/alexistoulotte/kagu
|
|
134
134
|
licenses:
|
135
135
|
- MIT
|
136
136
|
metadata: {}
|
137
|
-
post_install_message:
|
137
|
+
post_install_message:
|
138
138
|
rdoc_options: []
|
139
139
|
require_paths:
|
140
140
|
- lib
|
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
150
|
version: '0'
|
151
151
|
requirements: []
|
152
152
|
rubygems_version: 3.0.3
|
153
|
-
signing_key:
|
153
|
+
signing_key:
|
154
154
|
specification_version: 4
|
155
155
|
summary: API for macOS Music
|
156
156
|
test_files: []
|