Class: Podcast::Mp3File
- Inherits:
-
Object
- Object
- Podcast::Mp3File
- Defined in:
- lib/podcast.rb
Instance Attribute Summary collapse
-
#album ⇒ Object
Returns the value of attribute album.
-
#artist ⇒ Object
Returns the value of attribute artist.
-
#file ⇒ Object
Returns the value of attribute file.
-
#length ⇒ Object
Returns the value of attribute length.
-
#mtime ⇒ Object
Returns the value of attribute mtime.
-
#path ⇒ Object
Returns the value of attribute path.
-
#title ⇒ Object
Returns the value of attribute title.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(f) ⇒ Mp3File
constructor
A new instance of Mp3File.
- #to_s ⇒ Object
Constructor Details
#initialize(f) ⇒ Mp3File
Returns a new instance of Mp3File.
96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/podcast.rb', line 96 def initialize(f) file = File.new(f) info = Mp3Info.open(f) tag = info.tag() @file = f @artist = tag['artist'] @album = tag['album'] @title = tag['title'] @path = file.path() @length = file.stat.size() @mtime = file.stat.mtime() @type = 'audio/mpeg' end |
Instance Attribute Details
#album ⇒ Object
Returns the value of attribute album.
93 94 95 |
# File 'lib/podcast.rb', line 93 def album @album end |
#artist ⇒ Object
Returns the value of attribute artist.
93 94 95 |
# File 'lib/podcast.rb', line 93 def artist @artist end |
#file ⇒ Object
Returns the value of attribute file.
93 94 95 |
# File 'lib/podcast.rb', line 93 def file @file end |
#length ⇒ Object
Returns the value of attribute length.
93 94 95 |
# File 'lib/podcast.rb', line 93 def length @length end |
#mtime ⇒ Object
Returns the value of attribute mtime.
93 94 95 |
# File 'lib/podcast.rb', line 93 def mtime @mtime end |
#path ⇒ Object
Returns the value of attribute path.
93 94 95 |
# File 'lib/podcast.rb', line 93 def path @path end |
#title ⇒ Object
Returns the value of attribute title.
93 94 95 |
# File 'lib/podcast.rb', line 93 def title @title end |
#type ⇒ Object
Returns the value of attribute type.
93 94 95 |
# File 'lib/podcast.rb', line 93 def type @type end |
Instance Method Details
#to_s ⇒ Object
110 111 112 |
# File 'lib/podcast.rb', line 110 def to_s "#{@artist} -- #{@album} -- #{@title}" end |