kagu 3.0.9 → 3.0.10
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/playlists.rb +2 -1
- data/lib/kagu/swift_helper.rb +2 -7
- data/lib/kagu/track.rb +5 -10
- data/lib/kagu/tracks.rb +2 -1
- 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: 9edb39356c4523c2f2682c519ad5557d91cdc20107ca3022d0222be2fd66f9bb
|
4
|
+
data.tar.gz: d35d8c4c55f71acc49d89a904a6cc43186d561988b0669ba6a751452ef339603
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6368d27b74e8d21b14ade2233c91a63be38e6013415eda29b1ae0ddb4f2715316e7a392bf6bbf128ddbcd27e130ed387f280f75d26d6ea520942d99713d3ebc
|
7
|
+
data.tar.gz: ba74cc6b7117ee7f50517b625f0bbcffa2b20169e4baae4b21c4a8f36663b7ecd8d5158aaa5bcbeca84e321e77869e3f155bbcd78269a62ad900403b1cac90f1
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.0.
|
1
|
+
3.0.10
|
data/lib/kagu/playlists.rb
CHANGED
@@ -32,7 +32,7 @@ module Kagu
|
|
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,8 +22,8 @@ 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
|
@@ -31,6 +31,7 @@ module Kagu
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def relative_path(directory)
|
34
|
+
return nil if path.blank?
|
34
35
|
directory = directory.to_s
|
35
36
|
directory.present? ? Pathname.new(path.to_s.gsub(/\A#{Regexp.escape(directory)}\//, '')) : path
|
36
37
|
end
|
@@ -79,13 +80,7 @@ module Kagu
|
|
79
80
|
value = value.to_s.presence
|
80
81
|
value = URI.unescape(URI.parse(value).path).presence if value.is_a?(String) && value.starts_with?('file://')
|
81
82
|
value = value.encode('UTF-8', 'UTF-8-MAC') if value.present? && Kagu::IS_MAC_OS
|
82
|
-
|
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
|
83
|
+
@path = value.present? ? Pathname.new(value) : nil
|
89
84
|
end
|
90
85
|
|
91
86
|
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
|