Class: Podcast::Mp3File

Inherits:
Object
  • Object
show all
Defined in:
lib/podcast.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#albumObject

Returns the value of attribute album.



93
94
95
# File 'lib/podcast.rb', line 93

def album
  @album
end

#artistObject

Returns the value of attribute artist.



93
94
95
# File 'lib/podcast.rb', line 93

def artist
  @artist
end

#fileObject

Returns the value of attribute file.



93
94
95
# File 'lib/podcast.rb', line 93

def file
  @file
end

#lengthObject

Returns the value of attribute length.



93
94
95
# File 'lib/podcast.rb', line 93

def length
  @length
end

#mtimeObject

Returns the value of attribute mtime.



93
94
95
# File 'lib/podcast.rb', line 93

def mtime
  @mtime
end

#pathObject

Returns the value of attribute path.



93
94
95
# File 'lib/podcast.rb', line 93

def path
  @path
end

#titleObject

Returns the value of attribute title.



93
94
95
# File 'lib/podcast.rb', line 93

def title
  @title
end

#typeObject

Returns the value of attribute type.



93
94
95
# File 'lib/podcast.rb', line 93

def type
  @type
end

Instance Method Details

#to_sObject



110
111
112
# File 'lib/podcast.rb', line 110

def to_s
    "#{@artist} -- #{@album} -- #{@title}"
end