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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b7b5a093d924d4c0b0946c9f1c1f76e037c00473
4
- data.tar.gz: 6936412ff37648761b9acbffab81b9c9efe29764
3
+ metadata.gz: 2dd607618f6af1f48b5c1372e6231e7ac1ce276c
4
+ data.tar.gz: dbc913a388fd6472861c5278f7a8aae2d7b0774e
5
5
  SHA512:
6
- metadata.gz: bd34219c39964f2b5067d7d811fb000054dc6fc3644cc365af5d86dfa7dcb2329e0d01600f4c60e6ab8866d9c42e25a8a093feed7de0190ff8e6b5b7b1b6bd99
7
- data.tar.gz: 62aee34228b95a69f0c59482924cff3bc757b92c8c576e09d409be1e08f54f38d34fcc70bf14d4b5ed4eb40be60e07fc8aea134f4d305954da595a1dbcd672f0
6
+ metadata.gz: 2eb43b8406afce2f01ebabea8c2e24f9cff4990699ef867dfbb725cc135a048330acd34a8c078ce40fded93431d07676a71382f1f7734a151898807996ba8400
7
+ data.tar.gz: 158bf6e51ecd12fafa3f645ebe7f0e90bab7a793ff9a9143ce31e6ca191ab9cc7d89462adbff8cc60b5892485bf0723a19ff08a64b0e05fdff5691d371b2c0fe
data/.gitignore CHANGED
@@ -1,5 +1,5 @@
1
1
  .DS_Store
2
- .bundle
3
- .ruby-version
4
- Gemfile.lock
5
- pkg/*
2
+ /.bundle/
3
+ /.ruby-version
4
+ /Gemfile.lock
5
+ /pkg/
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.2
1
+ 0.3.3
@@ -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
- elsif line == '</array>'
38
- yield(Playlist.new(itunes_name: playlist_name, tracks: playlist_tracks)) if playlist_name.present?
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
- playlist_name = value
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.2
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-01-28 00:00:00.000000000 Z
11
+ date: 2015-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport