Class: Net::DAAP::Song
- Inherits:
-
Object
- Object
- Net::DAAP::Song
- Includes:
- Comparable
- Defined in:
- lib/net/daap/song.rb
Overview
This class contains song information returned from the DAAP server.
Instance Attribute Summary collapse
-
#album ⇒ Object
readonly
Returns the value of attribute album.
-
#artist ⇒ Object
readonly
Returns the value of attribute artist.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
(also: #to_s)
readonly
Returns the value of attribute name.
-
#persistentid ⇒ Object
readonly
Returns the value of attribute persistentid.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#get(&block) ⇒ Object
Fetches the song data from the DAAP server and returns it.
-
#initialize(args) ⇒ Song
constructor
A new instance of Song.
Constructor Details
#initialize(args) ⇒ Song
Returns a new instance of Song.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/net/daap/song.rb', line 10 def initialize(args) @size = args['daap.songsize'] @album = args[:album] @name = args['dmap.itemname'] #@artist = args['daap.songartist'] @artist = args[:artist] @format = args['daap.songformat'] @persistentid = args['dmap.persistentid'] @id = args['dmap.itemid'] @daap = args[:daap] @db = args[:db] end |
Instance Attribute Details
#album ⇒ Object (readonly)
Returns the value of attribute album.
6 7 8 |
# File 'lib/net/daap/song.rb', line 6 def album @album end |
#artist ⇒ Object (readonly)
Returns the value of attribute artist.
6 7 8 |
# File 'lib/net/daap/song.rb', line 6 def artist @artist end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
6 7 8 |
# File 'lib/net/daap/song.rb', line 6 def format @format end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/net/daap/song.rb', line 6 def id @id end |
#name ⇒ Object (readonly) Also known as: to_s
Returns the value of attribute name.
6 7 8 |
# File 'lib/net/daap/song.rb', line 6 def name @name end |
#persistentid ⇒ Object (readonly)
Returns the value of attribute persistentid.
6 7 8 |
# File 'lib/net/daap/song.rb', line 6 def persistentid @persistentid end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
6 7 8 |
# File 'lib/net/daap/song.rb', line 6 def size @size end |
Instance Method Details
#<=>(other) ⇒ Object
29 30 31 |
# File 'lib/net/daap/song.rb', line 29 def <=>(other) name <=> other.name end |
#get(&block) ⇒ Object
Fetches the song data from the DAAP server and returns it.
24 25 26 27 |
# File 'lib/net/daap/song.rb', line 24 def get(&block) filename = "#{@id}.#{@format}" @daap.get_song("databases/#{@db.id}/items/#{filename}", &block) end |