ruby-mpd 0.2.2 → 0.2.3

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
  SHA1:
3
- metadata.gz: 81250c9495f0879f017e77346e5701490cec542e
4
- data.tar.gz: 6ccc64d7af2eda39221f4bd6850ac6632272ba9a
3
+ metadata.gz: b78cfe440cb52c23cdb96e3c920797cec192adf4
4
+ data.tar.gz: 7bcbd0c9634377e11617dc2e71c9754d8435300f
5
5
  SHA512:
6
- metadata.gz: d78618dd432adb46e35d84bb251fa40b7e07c8f00627151e92488175e02287856c0b69af4cc5892488505080467c094e5826c83f7c4b30d92bd702dce2fcadac
7
- data.tar.gz: ea64e58ddc5aa05be097ba2cff590d4d80017e902b4c1b7d9152cbbe73daae40129a2a85241499bf0a4c019f8154129bd33e8d368d00d5d808255d79d19986e6
6
+ metadata.gz: 9cc8405f580660de9322ff63eaa01b34d85b593b394f5583fa71a9f158eea97bd1247e7e779053873a4b19740d73ae54402061a3164042078cadae4cf70fcd4e
7
+ data.tar.gz: 2f529fee81a65c1b676956181c11c3b066f8e0a7c3a4a68ba737efd45e70433a1b7b6c3acd7406f10cd0e75dcfbce6765629a96601cbccf3909317334ce90273
@@ -1,3 +1,5 @@
1
+ require "uri"
2
+
1
3
  class MPD
2
4
  # An object representing an .m3u playlist stored by MPD.
3
5
  #
@@ -22,7 +24,15 @@ class MPD
22
24
  # Lists the songs in the playlist. Playlist plugins are supported.
23
25
  # @return [Array<MPD::Song>] songs in the playlist.
24
26
  def songs
25
- @mpd.send_command(:listplaylistinfo, @name).map {|hash| Song.new(hash) }
27
+ result = @mpd.send_command(:listplaylistinfo, @name)
28
+ if result.to_s =~ URI::regexp
29
+ Song.new({:file => result, :time => 0})
30
+ else
31
+ result.map {|hash| Song.new(hash) }
32
+ end
33
+ rescue TypeError
34
+ puts "Files inside Playlist '#{@name}' do not exist!"
35
+ return nil
26
36
  rescue NotFound
27
37
  return [] # we rescue in the case the playlist doesn't exist.
28
38
  end
@@ -1,3 +1,3 @@
1
1
  class MPD
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-mpd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blaž Hrastnik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-07 00:00:00.000000000 Z
11
+ date: 2013-06-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A powerful, modern and feature complete library for the Music Player
14
14
  Daemon.