Class: Net::DAAP::Song
- Inherits:
-
Object
- Object
- Net::DAAP::Song
- 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
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
-
#get ⇒ 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.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/net/daap/song.rb', line 7 def initialize(args) info = args[:song_info] @size = info['daap.songsize'] @album = info['daap.songalbum'] @name = info['dmap.itemname'] @artist = info['daap.songartist'] @format = info['daap.songformat'] @persistentid = info['dmap.persistentid'] @id = info['dmap.itemid'] @daap = args[:daap] @db = args[:db] end |
Instance Attribute Details
#album ⇒ Object (readonly)
Returns the value of attribute album.
5 6 7 |
# File 'lib/net/daap/song.rb', line 5 def album @album end |
#artist ⇒ Object (readonly)
Returns the value of attribute artist.
5 6 7 |
# File 'lib/net/daap/song.rb', line 5 def artist @artist end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
5 6 7 |
# File 'lib/net/daap/song.rb', line 5 def format @format end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/net/daap/song.rb', line 5 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/net/daap/song.rb', line 5 def name @name end |
#persistentid ⇒ Object (readonly)
Returns the value of attribute persistentid.
5 6 7 |
# File 'lib/net/daap/song.rb', line 5 def persistentid @persistentid end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
5 6 7 |
# File 'lib/net/daap/song.rb', line 5 def size @size end |
Instance Method Details
#get ⇒ Object
Fetches the song data from the DAAP server and returns it.
21 22 23 24 |
# File 'lib/net/daap/song.rb', line 21 def get filename = "#{@id}.#{@format}" return @daap.get_song("databases/#{@db.id}/items/#{filename}") end |