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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2b1c6ebb0b79f29eba4fe24a7dd3d79296ae91f0bbea0fb0fc7983bf835e281
4
- data.tar.gz: ca3eccc89f387079b124934601b42d55189caeb21655dcc2ba10b4925229cf44
3
+ metadata.gz: 9edb39356c4523c2f2682c519ad5557d91cdc20107ca3022d0222be2fd66f9bb
4
+ data.tar.gz: d35d8c4c55f71acc49d89a904a6cc43186d561988b0669ba6a751452ef339603
5
5
  SHA512:
6
- metadata.gz: 9342fa71cbb60dc112d72a1578b1f0e08efe82bf2fcbafe90a3bf5bf1fb481bb5cc46df116227a5fea2076f68697dcc6bcc4eb695011acdab9b17a52ff0b7e58
7
- data.tar.gz: bf93af997250a6721bce474f3004a15721245d21ca0d8efd8d47144fc3a374b3eb46695a7b249c4c0546daad8f95be8163db80db19a9e770726d470518ed2264
6
+ metadata.gz: a6368d27b74e8d21b14ade2233c91a63be38e6013415eda29b1ae0ddb4f2715316e7a392bf6bbf128ddbcd27e130ed387f280f75d26d6ea520942d99713d3ebc
7
+ data.tar.gz: ba74cc6b7117ee7f50517b625f0bbcffa2b20169e4baae4b21c4a8f36663b7ecd8d5158aaa5bcbeca84e321e77869e3f155bbcd78269a62ad900403b1cac90f1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.0.9
1
+ 3.0.10
@@ -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
@@ -2,7 +2,7 @@ module Kagu
2
2
 
3
3
  module SwiftHelper
4
4
 
5
- def self.execute(code, &block)
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
- if block_given?
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
@@ -5,7 +5,7 @@ module Kagu
5
5
  include AttributesInitializer
6
6
  include Comparable
7
7
 
8
- MANDATORY_ATTRIBUTES = %w(added_at id length path)
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 exists?
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
- 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
83
+ @path = value.present? ? Pathname.new(value) : nil
89
84
  end
90
85
 
91
86
  def title=(value)
@@ -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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kagu
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.9
4
+ version: 3.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexis Toulotte