kagu 3.0.7 → 3.2.0
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/kagu.gemspec +2 -1
- data/lib/kagu.rb +1 -0
- data/lib/kagu/attributes_initializer.rb +1 -1
- data/lib/kagu/playlists.rb +3 -2
- data/lib/kagu/swift_helper.rb +2 -7
- data/lib/kagu/track.rb +6 -13
- data/lib/kagu/tracks.rb +2 -1
- metadata +28 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1c1858a37f00f8823ce4ebacf2b9bb96837da05c1e7be296fcbcd1461afe03f
|
4
|
+
data.tar.gz: f8d1d56f7e6e90a3afa12aeabf4f2804dda4d7e3bd4c0be9cfcb1b282a4078d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88e72ddf7e6960712558490d614f9e82aa78c6908f5300ac8d29ff587a2e40ee59a471ed9538b03155e0b130bfb15211b3b2baf6ce45e34e338c0f8a3cc1e909
|
7
|
+
data.tar.gz: 9d0fe80ce5dc1a8a857409f60425ff349a555a374893ba0c26cd5fea177c0774f4acb21cd0c920d5d0cf28701edbf024a3351e865a3ef80bb9a5129234682305
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.0
|
1
|
+
3.2.0
|
data/kagu.gemspec
CHANGED
@@ -16,9 +16,10 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.required_ruby_version = '>= 2.0.0'
|
17
17
|
|
18
18
|
s.add_dependency 'activesupport', '>= 4.1.0', '< 7.0.0'
|
19
|
+
s.add_dependency 'addressable', '>= 2.7.0', '< 3.0.0'
|
19
20
|
s.add_dependency 'applescript', '>= 1.0', '< 2.0'
|
20
21
|
|
21
22
|
s.add_development_dependency 'byebug', '>= 3.2.0', '< 12.0.0'
|
22
23
|
s.add_development_dependency 'rake', '>= 10.3.0', '< 14.0.0'
|
23
|
-
s.add_development_dependency 'rspec', '>= 3.1.0', '< 3.
|
24
|
+
s.add_development_dependency 'rspec', '>= 3.1.0', '< 3.11.0'
|
24
25
|
end
|
data/lib/kagu.rb
CHANGED
@@ -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/playlists.rb
CHANGED
@@ -28,11 +28,11 @@ 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
|
}
|
35
|
-
}) do |line|
|
35
|
+
}).each do |line|
|
36
36
|
if line == 'BEGIN_PLAYLIST'
|
37
37
|
playlist_name = nil
|
38
38
|
playlist_tracks = []
|
@@ -44,6 +44,7 @@ module Kagu
|
|
44
44
|
playlist_tracks << tracks[line]
|
45
45
|
end
|
46
46
|
end
|
47
|
+
nil
|
47
48
|
end
|
48
49
|
|
49
50
|
end
|
data/lib/kagu/swift_helper.rb
CHANGED
@@ -2,7 +2,7 @@ module Kagu
|
|
2
2
|
|
3
3
|
module SwiftHelper
|
4
4
|
|
5
|
-
def self.execute(code
|
5
|
+
def self.execute(code)
|
6
6
|
tempfile = Tempfile.new
|
7
7
|
begin
|
8
8
|
tempfile << code
|
@@ -12,12 +12,7 @@ module Kagu
|
|
12
12
|
begin
|
13
13
|
stdout, stderr, result = Open3.capture3("swift #{tempfile.path.inspect}")
|
14
14
|
raise(stderr.presence || "Swift command returned with code: #{result.exitstatus}") unless result.success?
|
15
|
-
|
16
|
-
stdout.lines.each { |line| yield(line.chomp) }
|
17
|
-
nil
|
18
|
-
else
|
19
|
-
stdout
|
20
|
-
end
|
15
|
+
stdout.lines.map(&:chomp)
|
21
16
|
ensure
|
22
17
|
tempfile.unlink
|
23
18
|
end
|
data/lib/kagu/track.rb
CHANGED
@@ -5,7 +5,7 @@ module Kagu
|
|
5
5
|
include AttributesInitializer
|
6
6
|
include Comparable
|
7
7
|
|
8
|
-
MANDATORY_ATTRIBUTES = %w(added_at id length
|
8
|
+
MANDATORY_ATTRIBUTES = %w(added_at id length)
|
9
9
|
|
10
10
|
attr_reader :added_at, :album, :artist, :bpm, :genre, :id, :length, :path, :title, :year
|
11
11
|
|
@@ -22,19 +22,14 @@ module Kagu
|
|
22
22
|
super || self == other
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
26
|
-
path.file?
|
25
|
+
def exists_on_disk?
|
26
|
+
path.present? && path.file?
|
27
27
|
end
|
28
28
|
|
29
29
|
def hash
|
30
30
|
[artist, title].hash
|
31
31
|
end
|
32
32
|
|
33
|
-
def relative_path(directory)
|
34
|
-
directory = directory.to_s
|
35
|
-
directory.present? ? Pathname.new(path.to_s.gsub(/\A#{Regexp.escape(directory)}\//, '')) : path
|
36
|
-
end
|
37
|
-
|
38
33
|
def to_s
|
39
34
|
"#{artist} - #{title}"
|
40
35
|
end
|
@@ -77,11 +72,9 @@ module Kagu
|
|
77
72
|
|
78
73
|
def path=(value)
|
79
74
|
value = value.to_s.presence
|
80
|
-
value = URI.unescape(URI.parse(value).path) if value.is_a?(String) && value.starts_with?('file://')
|
81
|
-
value = value.encode('UTF-8', 'UTF-8-MAC') if Kagu::IS_MAC_OS
|
82
|
-
@path = Pathname.new(value)
|
83
|
-
raise Error.new("No such file: #{path.to_s.inspect}") if path.exist? && !exists?
|
84
|
-
Kagu.logger.error('Kagu') { "No such track: #{path.inspect}" } unless exists?
|
75
|
+
value = Addressable::URI.unescape(Addressable::URI.parse(value).path).presence if value.is_a?(String) && value.starts_with?('file://')
|
76
|
+
value = value.encode('UTF-8', 'UTF-8-MAC') if value.present? && Kagu::IS_MAC_OS
|
77
|
+
@path = value.present? ? Pathname.new(value) : nil
|
85
78
|
end
|
86
79
|
|
87
80
|
def title=(value)
|
data/lib/kagu/tracks.rb
CHANGED
@@ -35,7 +35,7 @@ module Kagu
|
|
35
35
|
printObjectProperty(name: "year", value: track.year)
|
36
36
|
print("END_TRACK")
|
37
37
|
}
|
38
|
-
}) do |line|
|
38
|
+
}).each do |line|
|
39
39
|
if line == 'BEGIN_TRACK'
|
40
40
|
attributes = {}
|
41
41
|
elsif line == 'END_TRACK'
|
@@ -44,6 +44,7 @@ module Kagu
|
|
44
44
|
attributes[match[1]] = JSON.parse(match[2])
|
45
45
|
end
|
46
46
|
end
|
47
|
+
nil
|
47
48
|
end
|
48
49
|
|
49
50
|
end
|
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.2.0
|
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: 2021-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -30,6 +30,26 @@ dependencies:
|
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 7.0.0
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: addressable
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 2.7.0
|
40
|
+
- - "<"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 3.0.0
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 2.7.0
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 3.0.0
|
33
53
|
- !ruby/object:Gem::Dependency
|
34
54
|
name: applescript
|
35
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -99,7 +119,7 @@ dependencies:
|
|
99
119
|
version: 3.1.0
|
100
120
|
- - "<"
|
101
121
|
- !ruby/object:Gem::Version
|
102
|
-
version: 3.
|
122
|
+
version: 3.11.0
|
103
123
|
type: :development
|
104
124
|
prerelease: false
|
105
125
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -109,7 +129,7 @@ dependencies:
|
|
109
129
|
version: 3.1.0
|
110
130
|
- - "<"
|
111
131
|
- !ruby/object:Gem::Version
|
112
|
-
version: 3.
|
132
|
+
version: 3.11.0
|
113
133
|
description: API to manage macOS Music tracks and playlists
|
114
134
|
email: al@alweb.org
|
115
135
|
executables: []
|
@@ -134,7 +154,7 @@ homepage: https://github.com/alexistoulotte/kagu
|
|
134
154
|
licenses:
|
135
155
|
- MIT
|
136
156
|
metadata: {}
|
137
|
-
post_install_message:
|
157
|
+
post_install_message:
|
138
158
|
rdoc_options: []
|
139
159
|
require_paths:
|
140
160
|
- lib
|
@@ -149,8 +169,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
169
|
- !ruby/object:Gem::Version
|
150
170
|
version: '0'
|
151
171
|
requirements: []
|
152
|
-
rubygems_version: 3.
|
153
|
-
signing_key:
|
172
|
+
rubygems_version: 3.2.15
|
173
|
+
signing_key:
|
154
174
|
specification_version: 4
|
155
175
|
summary: API for macOS Music
|
156
176
|
test_files: []
|