kagu 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/kagu/track.rb +5 -3
- data/lib/kagu/tracks.rb +1 -1
- data/spec/kagu/track_spec.rb +6 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5ee245442c267a40154a6a11b7eccd99a62be90
|
4
|
+
data.tar.gz: fbe64a1a1b1f9053817c5698fc8922b8c74faf0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfb00c6c688e780c32fad7a2f0bf12c8ff25c6ff12c76025945a21a3aaf0303a98a026a45e5fd51d625a64cd41f939ce9dc88e6ee4f6bc03e77034880094fefb
|
7
|
+
data.tar.gz: c3e40682f72c76e41fbdcb88a171664fc9f5ba4ac28bd4bb8ba1e7cb0ac4ec8a0d6fc7fe9d9ed3f7ccfd9eeeae32af621844d44555ff005fd2819a5d12e74aab
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.0
|
data/lib/kagu/track.rb
CHANGED
@@ -12,7 +12,6 @@ module Kagu
|
|
12
12
|
|
13
13
|
def initialize(attributes = {})
|
14
14
|
super
|
15
|
-
raise Error.new("No such file: #{path.inspect}") if File.exists?(path) && !exists?
|
16
15
|
end
|
17
16
|
|
18
17
|
def <=>(other)
|
@@ -84,8 +83,9 @@ module Kagu
|
|
84
83
|
end
|
85
84
|
|
86
85
|
def itunes_location=(value)
|
87
|
-
|
88
|
-
|
86
|
+
path = CGI.unescape(html_entities_decode(value).gsub('+', '%2B')).gsub(/\Afile:\/\/(localhost)?/, '')
|
87
|
+
path = path.encode('UTF-8', 'UTF-8-MAC') if IS_MAC_OS
|
88
|
+
self.path = path
|
89
89
|
end
|
90
90
|
|
91
91
|
def itunes_name=(value)
|
@@ -110,6 +110,8 @@ module Kagu
|
|
110
110
|
|
111
111
|
def path=(value)
|
112
112
|
@path = value.to_s.presence
|
113
|
+
raise Error.new("No such file: #{path.inspect}") if File.exists?(path) && !exists?
|
114
|
+
Kagu.logger.warn('Kagu') { "No such iTunes track: #{path.inspect}" } unless exists?
|
113
115
|
end
|
114
116
|
|
115
117
|
def title=(value)
|
data/lib/kagu/tracks.rb
CHANGED
data/spec/kagu/track_spec.rb
CHANGED
@@ -207,7 +207,12 @@ describe Kagu::Track do
|
|
207
207
|
}.not_to raise_error
|
208
208
|
end
|
209
209
|
|
210
|
-
it '
|
210
|
+
it 'logs a warning if not exist' do
|
211
|
+
expect(Kagu.logger).to receive(:warn)
|
212
|
+
Kagu::Track.new(attributes.merge(path: '/tmp/bar.mp3'))
|
213
|
+
end
|
214
|
+
|
215
|
+
it 'raise an error if exists but not a file' do
|
211
216
|
expect {
|
212
217
|
Kagu::Track.new(attributes.merge(path: '/tmp'))
|
213
218
|
}.to raise_error(Kagu::Error, 'No such file: "/tmp"')
|