kagu 0.3.2 → 0.3.3
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/.gitignore +4 -4
- data/VERSION +1 -1
- data/lib/kagu/playlists.rb +10 -3
- data/lib/kagu/tracks.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2dd607618f6af1f48b5c1372e6231e7ac1ce276c
|
4
|
+
data.tar.gz: dbc913a388fd6472861c5278f7a8aae2d7b0774e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2eb43b8406afce2f01ebabea8c2e24f9cff4990699ef867dfbb725cc135a048330acd34a8c078ce40fded93431d07676a71382f1f7734a151898807996ba8400
|
7
|
+
data.tar.gz: 158bf6e51ecd12fafa3f645ebe7f0e90bab7a793ff9a9143ce31e6ca191ab9cc7d89462adbff8cc60b5892485bf0723a19ff08a64b0e05fdff5691d371b2c0fe
|
data/.gitignore
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
.DS_Store
|
2
|
-
|
3
|
-
|
4
|
-
Gemfile.lock
|
5
|
-
pkg
|
2
|
+
/.bundle/
|
3
|
+
/.ruby-version
|
4
|
+
/Gemfile.lock
|
5
|
+
/pkg/
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.3
|
data/lib/kagu/playlists.rb
CHANGED
@@ -30,12 +30,15 @@ module Kagu
|
|
30
30
|
end while !line.starts_with?('<key>Playlists</key>')
|
31
31
|
playlist_name = nil
|
32
32
|
playlist_tracks = []
|
33
|
+
skip_next = false
|
33
34
|
while !file.eof? && (line = file.readline.strip)
|
34
35
|
if line == '<key>Master</key><true/>'
|
35
36
|
playlist_name = nil
|
37
|
+
skip_next = true
|
36
38
|
next
|
37
|
-
|
38
|
-
|
39
|
+
end
|
40
|
+
if line == '</array>'
|
41
|
+
yield(Playlist.new(itunes_name: playlist_name, tracks: playlist_tracks)) if playlist_name.present? && playlist_tracks.any?
|
39
42
|
playlist_name = nil
|
40
43
|
playlist_tracks = []
|
41
44
|
next
|
@@ -45,7 +48,11 @@ module Kagu
|
|
45
48
|
name = match[1]
|
46
49
|
value = match[3]
|
47
50
|
if name == 'Name'
|
48
|
-
|
51
|
+
if skip_next
|
52
|
+
skip_next = false
|
53
|
+
else
|
54
|
+
playlist_name = value
|
55
|
+
end
|
49
56
|
elsif name == 'Track ID'
|
50
57
|
playlist_tracks << tracks[value.to_i]
|
51
58
|
end
|
data/lib/kagu/tracks.rb
CHANGED
@@ -4,6 +4,8 @@ module Kagu
|
|
4
4
|
|
5
5
|
include Enumerable
|
6
6
|
|
7
|
+
EXTENSIONS = %w(.aac .flac .mp3 .wav)
|
8
|
+
|
7
9
|
attr_reader :library
|
8
10
|
|
9
11
|
def initialize(library)
|
@@ -24,7 +26,7 @@ module Kagu
|
|
24
26
|
value = match[3]
|
25
27
|
attributes[name] = value
|
26
28
|
end while (line = file.readline.strip) != '</dict>'
|
27
|
-
yield(Track.new(attributes)) if attributes['itunes_track_type'] == 'File' && attributes['itunes_podcast'].blank?
|
29
|
+
yield(Track.new(attributes)) if attributes['itunes_track_type'] == 'File' && attributes['itunes_podcast'].blank? && EXTENSIONS.include?(File.extname(attributes['itunes_location'].try(:downcase)))
|
28
30
|
end
|
29
31
|
end
|
30
32
|
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: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexis Toulotte
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|