muzak 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/muzak/album.rb +6 -10
- data/lib/muzak/const.rb +1 -1
- data/lib/muzak/index.rb +16 -2
- data/lib/muzak/player/mpv.rb +0 -2
- 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: b64a222cbd2a691404714a63b195ee2a78bb82b3
|
4
|
+
data.tar.gz: 8d5547a8facf37798f822e53c97d9070dd29b6aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 999969bedb0fb6d2ea42fa856266702f2464207d6e3480eaccf8cad09f69b260e7981e8c7dc119cf0e02dfba0a9bf821230c1f8eb199137f9739e1d8866fa772
|
7
|
+
data.tar.gz: db562a2611427925e9c2a1621b5d294f6597dba8813647d9035ef7ecc57d8293b90f4f30c53f055b5b22a684ba418e0e2ecf9a5606c1a3268af47bb0d3144cf6
|
data/lib/muzak/album.rb
CHANGED
@@ -10,17 +10,13 @@ module Muzak
|
|
10
10
|
# @return [String] the path to the album's cover art
|
11
11
|
attr_reader :cover_art
|
12
12
|
|
13
|
-
# @
|
14
|
-
#
|
15
|
-
|
13
|
+
# @param title [String] the album's title
|
14
|
+
# @param songs [Array<Song>] the album's songs
|
15
|
+
# @param cover_art [String] the album's cover art
|
16
|
+
def initialize(title, songs, cover_art = nil)
|
16
17
|
@title = title
|
17
|
-
@
|
18
|
-
|
19
|
-
unless album_hash["deep-songs"].empty?
|
20
|
-
@songs = album_hash["deep-songs"]
|
21
|
-
else
|
22
|
-
@songs = album_hash["songs"].map { |s| Song.new(s) }
|
23
|
-
end
|
18
|
+
@songs = songs
|
19
|
+
@cover_art = cover_art
|
24
20
|
end
|
25
21
|
end
|
26
22
|
end
|
data/lib/muzak/const.rb
CHANGED
data/lib/muzak/index.rb
CHANGED
@@ -19,6 +19,8 @@ module Muzak
|
|
19
19
|
|
20
20
|
# @param index_file [String] the path of the index data file
|
21
21
|
def initialize(file: INDEX_FILE)
|
22
|
+
debug "loading index from '#{INDEX_FILE}'..."
|
23
|
+
|
22
24
|
@hash = Marshal.load(File.read file)
|
23
25
|
end
|
24
26
|
|
@@ -45,7 +47,12 @@ module Muzak
|
|
45
47
|
|
46
48
|
artists.each do |a|
|
47
49
|
@hash["artists"][a]["albums"].each do |title, album_hash|
|
48
|
-
|
50
|
+
if deep?
|
51
|
+
songs = album_hash["deep-songs"]
|
52
|
+
else
|
53
|
+
songs = album_hash["songs"].map { |s| Song.new(s) }
|
54
|
+
end
|
55
|
+
albums_hash[title] = Album.new(title, songs, album_hash["cover"])
|
49
56
|
end
|
50
57
|
end
|
51
58
|
|
@@ -64,7 +71,14 @@ module Muzak
|
|
64
71
|
# @return [Array<Album>] all albums by the given artist
|
65
72
|
def albums_by(artist)
|
66
73
|
if artists.include?(artist)
|
67
|
-
@hash["artists"][artist]["albums"].map
|
74
|
+
@hash["artists"][artist]["albums"].map do |title, album_hash|
|
75
|
+
if deep?
|
76
|
+
songs = album_hash["deep-songs"]
|
77
|
+
else
|
78
|
+
songs = album_hash["songs"].map { |s| Song.new(s) }
|
79
|
+
end
|
80
|
+
Album.new(title, songs, album_hash["cover"])
|
81
|
+
end
|
68
82
|
else
|
69
83
|
error "no such artist: '#{artist}'" unless @hash["artists"].key?(artist)
|
70
84
|
[]
|
data/lib/muzak/player/mpv.rb
CHANGED
@@ -170,8 +170,6 @@ module Muzak
|
|
170
170
|
# Get mpv's currently loaded song.
|
171
171
|
# @return [Song, nil] the currently loaded song
|
172
172
|
def now_playing
|
173
|
-
path = @mpv.get_property "path"
|
174
|
-
return if path&.empty?
|
175
173
|
@_now_playing ||= Song.new(@mpv.get_property "path")
|
176
174
|
end
|
177
175
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: muzak
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Woodruff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: taglib-ruby
|